Ejemplo n.º 1
0
        private void PlayNukeKeypadSound(EntityUid uid, int number, NukeComponent?component = null)
        {
            if (!Resolve(uid, ref component))
            {
                return;
            }

            // This is a C mixolydian blues scale.
            // 1 2 3    C D Eb
            // 4 5 6    E F F#
            // 7 8 9    G A Bb
            var semitoneShift = number switch
            {
                1 => 0,
                2 => 2,
                3 => 3,
                4 => 4,
                5 => 5,
                6 => 6,
                7 => 7,
                8 => 9,
                9 => 10,
                0 => component.LastPlayedKeypadSemitones + 12,
                _ => 0
            };

            // Don't double-dip on the octave shifting
            component.LastPlayedKeypadSemitones = number == 0 ? component.LastPlayedKeypadSemitones : semitoneShift;

            SoundSystem.Play(component.KeypadPressSound.GetSound(), Filter.Pvs(uid), uid,
                             AudioHelpers.ShiftSemitone(semitoneShift).WithVolume(-5f));
        }