public override void Execute()
        {
            if (target == null)
            {
                throw Dependancy.FormatException(nameof(target), this);
            }

            target.Show();
        }
        public override void Execute()
        {
            if (audioSource == null)
            {
                throw Dependancy.FormatException(nameof(audioSource), this);
            }

            StartCoroutine(Procedure());
        }
Пример #3
0
        public override void Execute()
        {
            if (audioSource == null)
            {
                throw Dependancy.FormatException(nameof(audioSource), this);
            }

            if (clip == null)
            {
                throw Dependancy.FormatException(nameof(clip), this);
            }

            switch (playMode)
            {
            case PlaybackMode.Loop:
                if (audioSource.isPlaying)
                {
                    audioSource.Stop();
                }
                audioSource.clip = clip;
                audioSource.loop = true;
                audioSource.Play();
                break;

            case PlaybackMode.OverridingOneShot:
            case PlaybackMode.AdditiveOneShot:
                if (playMode == PlaybackMode.OverridingOneShot && audioSource.isPlaying)
                {
                    audioSource.Stop();
                }
                audioSource.PlayOneShot(clip);
                break;

            default:
                throw new NotImplementedException();
            }
        }