public void StopAllSounds() { awaitingSlots.Clear(); for (int i = 0; i < playingSources.Count; i++) { AudioSource source = playingSources[i]; CoroutineRunner runner = source.GetComponent <CoroutineRunner>(); Assert.IsFalse(runner == null, "Trying to stop sound from invalid source"); runner.StopAllCoroutines(); source.Stop(); AddSingleSource(ref source, ref availableSources); } playingSources.Clear(); }
public void SetState(ScriptableState state) { if (currentState != null) { currentState.WillLeaveState(); } currentState = state; if (currentState != null) { if (runner == null) { runner = CoroutineRunner.Instantiate(this.name); DontDestroyOnLoad(runner); } currentState.WillEnterState(runner); } }
public void WillEnterState(CoroutineRunner runner) { this.runner = runner; OnEnterState(); }