예제 #1
0
        private byte PlayWalkingSound(byte cubeId, DynamicEntitySoundTrack entityTrack)
        {
            List <SoundMetaData> sounds;
            byte soundIndex = 0;

            // play a water sound
            if (_stepsSounds.TryGetValue(cubeId, out sounds))
            {
                // choose another sound to avoid playing the same sound one after another
                while (sounds.Count > 1 && entityTrack.LastSound == soundIndex)
                {
                    soundIndex = (byte)_rnd.Next(0, sounds.Count);
                }

                if (entityTrack.isLocalSound)
                {
                    _soundEngine.StartPlay2D(sounds[soundIndex].Alias, SourceCategory.FX);
                }
                else
                {
                    _soundEngine.StartPlay3D(sounds[soundIndex].Alias, new Vector3((float)entityTrack.Entity.Position.X, (float)entityTrack.Entity.Position.Y, (float)entityTrack.Entity.Position.Z), SourceCategory.FX);
                }
            }

            return(soundIndex);
        }
예제 #2
0
 private void PressableControlPressedSome(object sender, EventArgs e)
 {
     _soundEngine.StartPlay2D("ButtonPressed", SourceCategory.FX);
 }