public LockBlock(Vector2 position, EntityID id, bool stepMusicProgress, string spriteName, string unlock_sfx) : base(position, 32f, 32f, false) { ID = id; DisableLightsInside = false; this.stepMusicProgress = stepMusicProgress; Add(new PlayerCollider(new Action <Player>(OnPlayer), new Circle(60f, 16f, 16f), null)); Add(sprite = GFX.SpriteBank.Create("lockdoor_" + spriteName)); sprite.Play("idle", false, false); sprite.Position = new Vector2(Width / 2f, Height / 2f); bool flag = string.IsNullOrWhiteSpace(unlock_sfx); if (flag) { unlockSfxName = "event:/game/03_resort/key_unlock"; bool flag2 = spriteName == "temple_a"; if (flag2) { unlockSfxName = "event:/game/05_mirror_temple/key_unlock_light"; } else { bool flag3 = spriteName == "temple_b"; if (flag3) { unlockSfxName = "event:/game/05_mirror_temple/key_unlock_dark"; } } } else { unlockSfxName = SFX.EventnameByHandle(unlock_sfx); } }
public override void OnNewLaserbeam(Laserbeam laserbeams) { Player player = base.Scene.Tracker.GetEntity <Player>(); Vector2 position = player != null && atPlayer ? player.Position : Position; float pitch = NoteHelper.relativeA4ToFreq(this.pitch - 69) / 440f; FMOD.Studio.EventInstance instance = Audio.Play(SFX.EventnameByHandle(sound), position); instance?.setVolume(volume); instance?.setPitch(pitch); }