Obstacles According to difficulties
parent
7ac0cfaf4a
commit
0a9a8da387
@ -0,0 +1,39 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7e82af5507a3f3745885b4e14a26d858
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue