コード例 #1
0
        /// <summary>
        /// Processes an Emitter.
        /// </summary>
        /// <param name="time">Game timing data.</param>
        /// <param name="controlled">MercuryParticleEngine.Emitters.Emitter object to process.</param>
        public override void ProcessEmitter(GameTime time, Emitter controlled)
        {
            MouseState state = Mouse.GetState();

            controlled.Position.X = (float)state.X;
            controlled.Position.Y = (float)state.Y;

            switch (_button)
            {
                case MouseButtons.Left:
                    {
                        if (state.LeftButton == ButtonState.Pressed)
                            controlled.Trigger();
                        break;
                    }
                case MouseButtons.Middle:
                    {
                        if (state.MiddleButton == ButtonState.Pressed)
                            controlled.Trigger();
                        break;
                    }
                case MouseButtons.Right:
                    {
                        if (state.RightButton == ButtonState.Pressed)
                            controlled.Trigger();
                        break;
                    }
            }
        }
コード例 #2
0
        /// <summary>
        /// Processes the Emitter.
        /// </summary>
        /// <param name="time">Game timing data.</param>
        /// <param name="controlled">MercuryParticleEngine.Emitters.Emitter object to process.</param>
        public override void ProcessEmitter(GameTime time, Emitter controlled)
        {
            GamePadState state = GamePad.GetState(PlayerIndex.One, GamePadDeadZone.Circular);

            if (_stick == ThumbSticks.Left)
            {
                controlled.Position.X += (state.ThumbSticks.Left.X * 32f);
                controlled.Position.Y -= (state.ThumbSticks.Left.Y * 32f);
            }
            else
            {
                controlled.Position.X += (state.ThumbSticks.Right.X * 32f);
                controlled.Position.Y -= (state.ThumbSticks.Right.Y * 32f);
            }

            switch (_button)
            {
                case Buttons.A:
                    {
                        if (state.Buttons.A == ButtonState.Pressed) { controlled.Trigger(); }
                        break;
                    }
                case Buttons.B:
                    {
                        if (state.Buttons.B == ButtonState.Pressed) { controlled.Trigger(); }
                        break;
                    }
                case Buttons.X:
                    {
                        if (state.Buttons.X == ButtonState.Pressed) { controlled.Trigger(); }
                        break;
                    }
                case Buttons.Y:
                    {
                        if (state.Buttons.Y == ButtonState.Pressed) { controlled.Trigger(); }
                        break;
                    }
                case Buttons.LB:
                    {
                        if (state.Buttons.LeftShoulder == ButtonState.Pressed) { controlled.Trigger(); }
                        break;
                    }
                case Buttons.RB:
                    {
                        if (state.Buttons.RightShoulder == ButtonState.Pressed) { controlled.Trigger(); }
                        break;
                    }
            }
        }
コード例 #3
0
 public override void UpdateEmitter(GameTime time, Emitter emitter)
 {
     if (_primed)
     {
         emitter.Trigger();
         _primed = false;
     }
 }
コード例 #4
0
        public override void UpdateEmitter(GameTime time, Emitter emitter)
        {
            MouseState state = Mouse.GetState();

            emitter.Position.X = (float)state.X;
            emitter.Position.Y = (float)state.Y;

            if (_click)
            {
                if (state.LeftButton == ButtonState.Pressed)
                {
                    emitter.Trigger();
                }
            }
        }