public ActionGib(ICurio origin, ICurio target, int score, SoundReference splat) { Origin = origin; Target = target; Score = score; Splat = splat; }
/// <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); }
public ActionPlayerDamage(ICurio origin, ICurio target, int damage, SoundReference hitSound) { Origin = origin; Target = target; Damage = damage; HitSound = hitSound; }
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); }
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; }
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; }
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; }
/// <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); }
/// <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); }
/// <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); }
/// <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; }
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]); } }
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; } }
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; } }
/// <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(); }
/// <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; }
/// <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; }
/// <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; }
/// <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(); }
public ActionHitVisual(ICurio origin, ICurio target, SoundReference hitSound) { Origin = origin; Target = target; HitSound = hitSound; }
public ActionEnemyHit(ICurio origin, ICurio target, SoundReference hitSound) { Origin = origin; Target = target; HitSound = hitSound; }