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.
40 lines
1.1 KiB
C#
40 lines
1.1 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();
|
|
Debug.Log("list: " + list[list.Count-1].name);
|
|
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;
|
|
//if (difficultyLevel == 0)
|
|
//{
|
|
// return easyObstacleObjs;
|
|
//}
|
|
//else if (difficultyLevel == 1)
|
|
//{
|
|
// return mediumObstacleObjs;
|
|
//}
|
|
//else
|
|
//{
|
|
// return HardObstacleObjs;
|
|
//}
|
|
}
|
|
}
|