コード例 #1
0
        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();
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
 public void WillEnterState(CoroutineRunner runner)
 {
     this.runner = runner;
     OnEnterState();
 }