Beispiel #1
0
        public override void Update(TimeSpan elapsed)
        {
            MouseState ms = Mouse.GetState();

            if (activeStroke != null) {
                activeStroke.Update(elapsed);
            }
            if (ms.LeftButton == ButtonState.Pressed && msLast.LeftButton == ButtonState.Released) {
                activeStroke = new WindStroke();

                int n = r.Next(0, 3);

                switch (n) {
                    case 0: GameContainer.SoundSystem.playSound(FMOD.CHANNELINDEX.FREE, windGust1, false, ref GameContainer.SoundChannel); break;
                    case 1: GameContainer.SoundSystem.playSound(FMOD.CHANNELINDEX.FREE, windGust2, false, ref GameContainer.SoundChannel); break;
                    case 2: GameContainer.SoundSystem.playSound(FMOD.CHANNELINDEX.FREE, windGust3, false, ref GameContainer.SoundChannel); break;
                }

                GameContainer.SoundChannel.setVolume(1);
            } else if (ms.LeftButton == ButtonState.Pressed) {
                Vector3 now = MouseToWorld(ms, Cameras.Current.View, Cameras.Current.Projection, Matrix.CreateTranslation(0, 0, 0));

                if (Vector3.Distance(now, previously) > distBetweenWind) {
                    activeStroke.Move(now);

                    previously = now;
                }
            }

            msLast = ms;
        }
Beispiel #2
0
        public override void Update(TimeSpan elapsed)
        {
            MouseState ms = Mouse.GetState();

            if (activeStroke != null)
            {
                activeStroke.Update(elapsed);
            }
            if (ms.LeftButton == ButtonState.Pressed && msLast.LeftButton == ButtonState.Released)
            {
                activeStroke = new WindStroke();

                int n = r.Next(0, 3);

                switch (n)
                {
                case 0: GameContainer.SoundSystem.playSound(FMOD.CHANNELINDEX.FREE, windGust1, false, ref GameContainer.SoundChannel); break;

                case 1: GameContainer.SoundSystem.playSound(FMOD.CHANNELINDEX.FREE, windGust2, false, ref GameContainer.SoundChannel); break;

                case 2: GameContainer.SoundSystem.playSound(FMOD.CHANNELINDEX.FREE, windGust3, false, ref GameContainer.SoundChannel); break;
                }

                GameContainer.SoundChannel.setVolume(1);
            }
            else if (ms.LeftButton == ButtonState.Pressed)
            {
                Vector3 now = MouseToWorld(ms, Cameras.Current.View, Cameras.Current.Projection, Matrix.CreateTranslation(0, 0, 0));

                if (Vector3.Distance(now, previously) > distBetweenWind)
                {
                    activeStroke.Move(now);

                    previously = now;
                }
            }

            msLast = ms;
        }