예제 #1
0
 public ActionGib(ICurio origin, ICurio target, int score, SoundReference splat)
 {
     Origin = origin;
     Target = target;
     Score  = score;
     Splat  = splat;
 }
예제 #2
0
        /// <summary>
        /// Get AudioSource from a sound reference
        /// </summary>
        /// <param name="soundRef">Sound reference</param>
        /// <returns>AudioSource</returns>
        public AudioSource GetSourceForSoundReference(SoundReference soundRef)
        {
            if (soundRef.internalRef.Sequence < 0)
            {
                return(null);
            }

            SoundChannel channel;

            if (soundRef.internalRef.SoundChannel >= 0 && soundRef.internalRef.SoundChannel < RBHardware.HW_MAX_SOUND_CHANNELS)
            {
                channel = mSoundChannels[soundRef.internalRef.SoundChannel];
            }
            else
            {
                return(null);
            }

            // Check if this reference is outdated
            if (channel.Sequence != soundRef.internalRef.Sequence)
            {
                return(null);
            }

            return(channel.Source);
        }
예제 #3
0
 public ActionPlayerDamage(ICurio origin, ICurio target, int damage, SoundReference hitSound)
 {
     Origin   = origin;
     Target   = target;
     Damage   = damage;
     HitSound = hitSound;
 }
예제 #4
0
        private AudioSource GetSourceForSoundReference(SoundReference soundRef)
        {
            if (soundRef.Sequence < 0)
            {
                return(null);
            }

            SoundChannel channel;

            if (soundRef.SoundChannel >= 0 && soundRef.SoundChannel < RetroBlitHW.HW_MAX_SOUND_CHANNELS)
            {
                channel = mSoundChannels[soundRef.SoundChannel];
            }
            else
            {
                return(null);
            }

            // Check if this reference is outdated
            if (channel.Sequence != soundRef.Sequence)
            {
                return(null);
            }

            return(channel.Source);
        }
예제 #5
0
 public ActionCorpseGib(ICurio origin, ICurio target, int score, SoundReference splat, int particles = 30, float radius = 32)
 {
     Origin    = origin;
     Target    = target;
     Score     = score;
     Radius    = radius;
     Particles = particles;
     Splat     = splat;
 }
예제 #6
0
 public BehaviorDecay(ICurio curio, float time, int score, int particles, float radius, SoundReference splat)
 {
     Curio     = curio;
     Decay     = new Slider(time);
     Score     = score;
     Particles = particles;
     Radius    = radius;
     Splat     = splat;
 }
예제 #7
0
 public ActionDamage(ICurio origin, ICurio target, int damage, int score, int blood, SoundReference hitSound)
 {
     Origin   = origin;
     Target   = target;
     Damage   = damage;
     Score    = score;
     Blood    = blood;
     HitSound = hitSound;
 }
예제 #8
0
        /// <summary>
        /// Get pitch of playing sound
        /// </summary>
        /// <param name="soundReference">Sound reference</param>
        /// <returns>Pitch</returns>
        public float SoundPitchGet(SoundReference soundReference)
        {
            var source = GetSourceForSoundReference(soundReference);

            if (source == null)
            {
                return(0);
            }

            return(source.pitch);
        }
예제 #9
0
        /// <summary>
        /// Get volume of playing sound
        /// </summary>
        /// <param name="soundReference">Sound reference</param>
        /// <returns>Volume</returns>
        public float SoundVolumeGet(SoundReference soundReference)
        {
            var source = GetSourceForSoundReference(soundReference);

            if (source == null)
            {
                return(0);
            }

            return(source.volume);
        }
예제 #10
0
        /// <summary>
        /// Checks if sound is playing
        /// </summary>
        /// <param name="soundReference">Sound reference</param>
        /// <returns>True if playing</returns>
        public bool SoundIsPlaying(SoundReference soundReference)
        {
            var source = GetSourceForSoundReference(soundReference);

            if (source == null)
            {
                return(false);
            }

            return(source.isPlaying);
        }
예제 #11
0
        /// <summary>
        /// Set loop flag for playing sound
        /// </summary>
        /// <param name="soundReference">Sound reference</param>
        /// <param name="loop">True if should loop</param>
        public void SoundLoopSet(SoundReference soundReference, bool loop)
        {
            var source = GetSourceForSoundReference(soundReference);

            if (source == null)
            {
                return;
            }

            source.loop = loop;
        }
예제 #12
0
    private Sound GetSoundBySoundReference(SoundReference soundReference)
    {
        switch (soundReference)
        {
        case SoundReference.SONG_THEME:
            return(_sounds[0]);

        default:
            Debug.LogWarning($"AudioManager.Instance.GetAudioSourceByEnum returned empty sound on soundReference: {soundReference}");
            return(_sounds[0]);
        }
    }
예제 #13
0
    public void PlaySoundEffect(SoundReference soundEffectReference)
    {
        switch (soundEffectReference)
        {
        case SoundReference.EFFECT_JUMP:
            GetSoundBySoundReference(soundEffectReference).Play();
            break;

        default:
            Debug.LogWarning($"Attempted to play non-sound-effect: {soundEffectReference} as a sound effect, no action taken");
            break;
        }
    }
예제 #14
0
    public void PlaySong(SoundReference songReference)
    {
        switch (songReference)
        {
        case SoundReference.SONG_THEME:
            GetSoundBySoundReference(songReference).Play();
            break;

        default:
            Debug.LogWarning($"Attempted to play non-song SoundReference: {songReference} as a song, no action taken");
            break;
        }
    }
예제 #15
0
        /// <summary>
        /// Stop playing a sound
        /// </summary>
        /// <param name="soundReference">Sound reference</param>
        public void SoundStop(SoundReference soundReference)
        {
            var source = GetSourceForSoundReference(soundReference);

            if (source == null)
            {
                return;
            }

            var channel = mSoundChannels[soundReference.SoundChannel];

            channel.Sequence = -1;

            source.Stop();
        }
예제 #16
0
        /// <summary>
        /// Set pitch of playing sound
        /// </summary>
        /// <param name="soundReference">Sound reference</param>
        /// <param name="pitch">Pitch</param>
        public void SoundPitchSet(SoundReference soundReference, float pitch)
        {
            if (pitch < 0)
            {
                return;
            }

            var source = GetSourceForSoundReference(soundReference);

            if (source == null)
            {
                return;
            }

            source.pitch = pitch;
        }
예제 #17
0
        /// <summary>
        /// Set volume of playing sound
        /// </summary>
        /// <param name="soundReference">Sound reference</param>
        /// <param name="volume">Volume</param>
        public void SoundVolumeSet(SoundReference soundReference, float volume)
        {
            if (volume < 0)
            {
                return;
            }

            var source = GetSourceForSoundReference(soundReference);

            if (source == null)
            {
                return;
            }

            source.volume = volume;
        }
예제 #18
0
        /// <summary>
        /// Set sound position of a playing sound
        /// </summary>
        /// <param name="soundReference">Sound reference of playing sound</param>
        /// <param name="pos">Position to set</param>
        public void SoundPosSet(SoundReference soundReference, Vector3 pos)
        {
            var source = GetSourceForSoundReference(soundReference);

            if (source == null)
            {
                return;
            }

            Vector3 center = new Vector3(RB.DisplaySize.width / 2, RB.DisplaySize.height / 2, 0);

            center = Vector3.zero;

            source.transform.position = pos;
            source.spatialBlend       = 1;
        }
예제 #19
0
        /// <summary>
        /// Handle scene entry
        /// </summary>
        public override void Enter()
        {
            soundCoin.Load("Demos/DemoReel/Coin");
            soundExplosion.Load("Demos/DemoReel/Explosion");
            soundJump.Load("Demos/DemoReel/Jump");
            soundLaser.Load("Demos/DemoReel/Laser");
            soundC5Note.Load("Demos/DemoReel/C5Note");
            soundWaterfall.Load("Demos/DemoReel/Waterfall");

            mMusicTicks     = 0;
            mMusicTurnSpeed = 0;
            mNextButton.Reset();
            mPrevButton.Reset();
            mMusicPlayButton.Reset();
            mPositionalButton.Reset();

            for (int i = 0; i < mPianoButtons.Length; i++)
            {
                mPianoButtons[i].Reset();
            }

            for (int i = 0; i < mEffectButtons.Length; i++)
            {
                mEffectButtons[i].Reset();
            }

            mSpriteSheet1.Load("Demos/DemoReel/Sprites");
            mSpriteSheet1.grid = new SpriteGrid(new Vector2i(16, 16));

            mSpriteSheet2.Create(RB.DisplaySize);

            mPosSoundRef = RB.SoundPlay(soundWaterfall, 0, 1, 100);
            RB.SoundLoopSet(mPosSoundRef, true);

            base.Enter();
        }
예제 #20
0
 public ActionHitVisual(ICurio origin, ICurio target, SoundReference hitSound)
 {
     Origin   = origin;
     Target   = target;
     HitSound = hitSound;
 }
예제 #21
0
 public ActionEnemyHit(ICurio origin, ICurio target, SoundReference hitSound)
 {
     Origin   = origin;
     Target   = target;
     HitSound = hitSound;
 }