add all mechanics
This commit is contained in:
parent
87383d5b8c
commit
0e2a7cc7c3
434 changed files with 238349 additions and 2092 deletions
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class MainMenuHandler : MonoBehaviour
|
||||
{
|
||||
|
|
@ -11,15 +13,21 @@ public class MainMenuHandler : MonoBehaviour
|
|||
[SerializeField] private Transform uiMovingObject;
|
||||
[SerializeField] private DialogueScript startingScript;
|
||||
|
||||
[Header("Scene Transition")]
|
||||
[SerializeField] private Image screenFade;
|
||||
[SerializeField] private float fadeSpeed;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
//uiAnimator.SetTrigger(gameStartAction);
|
||||
screenFade.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void StartGame()
|
||||
{
|
||||
LevelSwitcher.instance.SwitchLevel(2, startingScript);
|
||||
screenFade.gameObject.SetActive(true);
|
||||
screenFade.color = Color.clear;
|
||||
StartCoroutine(FadeScreen(2, startingScript));
|
||||
}
|
||||
|
||||
public void StartEndless()
|
||||
|
|
@ -41,4 +49,19 @@ public class MainMenuHandler : MonoBehaviour
|
|||
{
|
||||
uiAnimator.SetTrigger(closeUIAction);
|
||||
}
|
||||
|
||||
private IEnumerator FadeScreen(int sceneToSwitchTo, DialogueScript scriptToShow)
|
||||
{
|
||||
float state = 0f;
|
||||
while (state < 1f)
|
||||
{
|
||||
state += Time.deltaTime * fadeSpeed;
|
||||
screenFade.color = Color.Lerp(Color.clear, Color.black, state);
|
||||
if (state >= 1)
|
||||
{
|
||||
LevelSwitcher.instance.SwitchLevel(sceneToSwitchTo, scriptToShow);
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue