Started making main menu
This commit is contained in:
@@ -21,15 +21,20 @@ namespace Fruitomation.Game
|
||||
}
|
||||
|
||||
Instance = this;
|
||||
|
||||
|
||||
Canvas canvas = gameObject.AddComponent<Canvas>();
|
||||
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
|
||||
|
||||
|
||||
GameObject overlayGo = new("Overlay");
|
||||
overlayGo.transform.SetParent(canvas.transform);
|
||||
|
||||
|
||||
Transition = overlayGo.AddComponent<SceneControllerTransition>();
|
||||
Transition.OnCreation(canvas);
|
||||
|
||||
#if UNITY_EDITOR
|
||||
#else // Only does start transition on non editor builds
|
||||
StartCoroutine(EndLoadInternal(2.5f));
|
||||
#endif
|
||||
}
|
||||
|
||||
private const float FadeMultiplier = 4f;
|
||||
@@ -61,9 +66,10 @@ namespace Fruitomation.Game
|
||||
operation.allowSceneActivation = true;
|
||||
}
|
||||
|
||||
private IEnumerator EndLoadInternal()
|
||||
private IEnumerator EndLoadInternal(float waitTime = 0.2f)
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(0.2f);
|
||||
Transition.LerpValue = 1f;
|
||||
yield return new WaitForSecondsRealtime(waitTime);
|
||||
Transition.GoingUp = true;
|
||||
|
||||
float lerp = 0f;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Fruitomation.Global
|
||||
BuildingMenu,
|
||||
Building,
|
||||
UpgradeMenu,
|
||||
Paused,
|
||||
MainMenu,
|
||||
Editing,
|
||||
Default
|
||||
}
|
||||
|
||||
@@ -35,7 +35,8 @@ namespace Fruitomation.UI
|
||||
|
||||
PauseButton.onClick.AddListener(() =>
|
||||
{
|
||||
GameStateController.State = GameState.Paused;
|
||||
GameStateController.State = GameState.MainMenu;
|
||||
SceneController.StartLoadOf("MainMenu");
|
||||
});
|
||||
|
||||
EditButton.onClick.AddListener(() =>
|
||||
|
||||
@@ -89,15 +89,8 @@ namespace Fruitomation.UI
|
||||
UpdateMouseStateBuilding();
|
||||
break;
|
||||
|
||||
case GameState.UpgradeMenu:
|
||||
case GameState.Paused:
|
||||
case GameState.Default:
|
||||
case GameState.Editing:
|
||||
case GameState.BuildingMenu:
|
||||
break; // No extra logic needed
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
case var _:
|
||||
break;
|
||||
}
|
||||
|
||||
CurrentMouseClickStrength = Mathf.Clamp(CurrentMouseClickStrength, MinStrength, MaxStrength);
|
||||
|
||||
Reference in New Issue
Block a user