IEnumerator RestTime() { for (int i = 0; i < dispensers.Length; i++) { DispenserScript dispenser = dispensers[i].gameObject.GetComponent <DispenserScript>(); dispenser.FillCode(); dispenser.TurnOn(); } yield return(new WaitForSeconds(10)); StartCoroutine(CreateEnemies()); }
void OnCollisionEnter(Collision c){ DispenserScript target = c.transform.GetComponent<DispenserScript>(); if (target != null) { target.EnterSignal(signalType); } if (c.gameObject.tag != "MainCamera"){ Destroy(gameObject); } }
void Awake() { firstGame = PlayerPrefs.GetInt("first", 0); adShownCounter = PlayerPrefs.GetInt("adShown", 0); Coins = PlayerPrefs.GetInt("Coins"); HighScore = PlayerPrefs.GetInt("HighScore"); if (instance != null) { Debug.LogError("More than one GameManager in scene"); } else { instance = this; } dispenser = FindObjectOfType <DispenserScript>(); }