using System.Collections; using System.Collections.Generic; using UnityEngine; public class Obstacle : MonoBehaviour { public List easyObstacleObjs; public List mediumObstacleObjs; public List hardObstacleObjs; private void Start() { Starter(); } public void Starter() { List list = DifficultyList(); Debug.Log("list: " + list[list.Count-1].name); int rand = Random.Range(0, list.Count); list[rand].gameObject.SetActive(true); } List 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; //} } }