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.
63 lines
1.6 KiB
C#
63 lines
1.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Obstacle : MonoBehaviour
|
|
{
|
|
public List<GameObject> easyObstacleObjs;
|
|
public List<GameObject> mediumObstacleObjs;
|
|
public List<GameObject> hardObstacleObjs;
|
|
|
|
private void Start()
|
|
{
|
|
Starter();
|
|
}
|
|
public void Starter()
|
|
{
|
|
List<GameObject> list = DifficultyList();
|
|
int rand = Random.Range(0, list.Count);
|
|
list[rand].gameObject.SetActive(true);
|
|
}
|
|
List<GameObject> DifficultyList()
|
|
{
|
|
int difficultyLevel = (int)GameManager.instance.difficultyLevel;
|
|
//return difficultyLevel == 0 ? easyObstacleObjs : difficultyLevel == 1 ? mediumObstacleObjs : hardObstacleObjs;
|
|
int percentAge = Random.Range(0, 100);
|
|
|
|
if (difficultyLevel == 0)
|
|
{
|
|
return easyObstacleObjs;
|
|
}
|
|
else if (difficultyLevel == 1)
|
|
{
|
|
if (percentAge < 75)
|
|
{
|
|
return mediumObstacleObjs;
|
|
}
|
|
else
|
|
{
|
|
Debug.Log("Difficulty Medium but Obstacle Easy");
|
|
return easyObstacleObjs;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (percentAge < 75)
|
|
{
|
|
|
|
return hardObstacleObjs;
|
|
}
|
|
else if (percentAge >= 75 && percentAge < 87)
|
|
{
|
|
Debug.Log("Difficulty Hard but Obstacle Medium");
|
|
return mediumObstacleObjs;
|
|
}
|
|
else
|
|
{
|
|
Debug.Log("Difficulty Hard but Obstacle Easy");
|
|
return easyObstacleObjs;
|
|
}
|
|
}
|
|
}
|
|
}
|