IEnumerator enableTraps() { _isCREnableTrapsRunning = true; if (switchType.Equals(SwitchType.Simultaneously)) { foreach (Trap trap in traps) { trap.enableTrap(); yield return(null); } } else { for (int itrap = 0; itrap < traps.Length; itrap++) { Trap trap = traps[itrap]; trap.enableTrap(); while (!trap.trapDone) { yield return(null); } } } _isCREnableTrapsRunning = false; }
void Update() { if (switchType.Equals(SwitchType.Timer) && switchTime != 0 && Time.time >= switchTime) { FlipSwitch(); switchTime = 0; } }