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

            target.Hide();
        }
Beispiel #2
0
        public override void Execute()
        {
            if (audioSource == null)
            {
                throw Dependancy.FormatException(nameof(audioSource), this);
            }

            StartCoroutine(Procedure());
        }
        protected virtual void Start()
        {
            var relay = GetComponent <Relay>();

            if (relay == null)
            {
                throw Dependancy.FormatException(nameof(Relay), GetType().Name);
            }

            relay.Event += Action;
        }
        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();
            }
        }