Menu functionality for the game Fey Foray
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.UI; | |
public class FadeIn : MonoBehaviour | |
{ | |
public float fadeTime; | |
private Image blackScreen; | |
void Start() | |
{ | |
blackScreen = GetComponent<Image>(); | |
} | |
void Update() | |
{ | |
blackScreen.CrossFadeAlpha(0f, fadeTime, false); | |
if(blackScreen.color.a == 0) | |
{ | |
gameObject.SetActive(false); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using Cinemachine; | |
using UnityEngine; | |
using UnityEngine.SceneManagement; | |
using UnityEngine.UIElements; | |
public class GameOver : MonoBehaviour | |
{ | |
public string levelSelect; | |
public string mainMenu; | |
private LevelManager theLevelManager; | |
// Start is called before the first frame update | |
void Start() | |
{ | |
theLevelManager = FindObjectOfType<LevelManager>(); | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
} | |
public void Restart() | |
{ | |
PlayerPrefs.SetInt("coinCount", 0); | |
SceneManager.LoadScene(SceneManager.GetActiveScene().name); | |
Time.timeScale = 1f; | |
} | |
public void QuitToMainMenu() | |
{ | |
SceneManager.LoadScene(mainMenu); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.SceneManagement; | |
public class IntroScreen : MonoBehaviour | |
{ | |
public string mainMenu; | |
[Tooltip("Insert Pause Screen")] | |
public GameObject theIntroScreen; | |
public float pausedTimeScale; | |
private LevelManager _theLevelManager; | |
private CharacterController _thePlayer; | |
void Start() | |
{ | |
_theLevelManager = FindObjectOfType<LevelManager>(); | |
_thePlayer = FindObjectOfType<CharacterController>(); | |
Time.timeScale = 0; | |
_theLevelManager.levelMusic.Pause(); | |
} | |
public void IntroScreenGo() | |
{ | |
Time.timeScale = pausedTimeScale; | |
theIntroScreen.SetActive(true); | |
} | |
public void ResumeGame() | |
{ | |
Time.timeScale = 1; | |
theIntroScreen.SetActive(false); | |
_theLevelManager.levelMusic.Play(); | |
} | |
public void QuitToMainMenu() | |
{ | |
Time.timeScale = 1f; | |
SceneManager.LoadScene(mainMenu); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment