private void Awake() { if (Instance == null) { Instance = this; } }
// Use this for initialization void Start() { if (GameObject.Find("Load Game Controller") != null) { gameGontroller = GameObject.Find("Load Game Controller").GetComponent <LoadGameController>(); powerUpContainer = GameObject.Find("Power Up Container"); currentPowerUps = gameGontroller.saveData.powerUps; } foreach (PowerUp power in Enum.GetValues(typeof(PowerUp))) { allPowerups.Add(power); } List <PowerUp> possibleChoices = allPowerups; possibleChoices.RemoveAll(power => currentPowerUps.Contains(power)); System.Random random = new System.Random(); for (int i = 0; i < numberOfPowerChoices; i++) { int index = random.Next(0, possibleChoices.Count); powerUpChoices.Add(possibleChoices[index]); possibleChoices.RemoveAt(index); } populatePowerUpUIElements(); }