You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
FlyingFred/Assets/GameManager.cs

40 lines
1.0 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum DifficultyLevel
{
easy, medium, hard,
}
public class GameManager : MonoBehaviour
{
public DifficultyLevel difficultyLevel;
public List<int> difficultyScores;
public float Score;
public static GameManager instance;
public bool isGameOver = false;
public void Awake()
{
instance = this;
}
private void Start()
{
StartCoroutine(ScoreUpdateRoutine());
}
IEnumerator ScoreUpdateRoutine()
{
difficultyLevel = DifficultyLevel.easy;
while (!isGameOver)
{
Score++;
UIManager.instance.ScoreText.text = Score.ToString();
if(Score > difficultyScores[(int)difficultyLevel] && (int)difficultyLevel< difficultyScores.Count-1)
{
difficultyLevel++;
}
Debug.Log("difficulty Level: " + (int)difficultyLevel);
yield return new WaitForSeconds(1);
}
}
}