Beispiel #1
0
        public override void Keyboard(System.Windows.Forms.Keys key)
        {
            switch (key)
            {
            case System.Windows.Forms.Keys.L:
                _joint2.EnableLimit(!_joint2.IsLimitEnabled);
                _joint3.EnableLimit(!_joint3.IsLimitEnabled);
                _joint2.GetBody1().WakeUp();
                _joint3.GetBody2().WakeUp();
                break;

            case System.Windows.Forms.Keys.M:
                _joint1.EnableMotor(!_joint1.IsMotorEnabled);
                _joint2.EnableMotor(!_joint2.IsMotorEnabled);
                _joint3.EnableMotor(!_joint3.IsMotorEnabled);
                _joint2.GetBody1().WakeUp();
                _joint3.GetBody2().WakeUp();
                break;

            case System.Windows.Forms.Keys.P:
                _joint3.GetBody2().WakeUp();
                _joint3.MotorSpeed = (-_joint3.MotorSpeed);
                break;
            }
        }
Beispiel #2
0
        public override void Keyboard(System.Windows.Forms.Keys key)
        {
            switch (key)
            {
            case System.Windows.Forms.Keys.A:
                _chassis.WakeUp();
                _motorJoint.MotorSpeed = -_motorSpeed;
                break;

            case System.Windows.Forms.Keys.S:
                _chassis.WakeUp();
                _motorJoint.MotorSpeed = (0.0f);
                break;

            case System.Windows.Forms.Keys.D:
                _chassis.WakeUp();
                _motorJoint.MotorSpeed = (_motorSpeed);
                break;

            case System.Windows.Forms.Keys.M:
                _chassis.WakeUp();
                _motorJoint.EnableMotor(!_motorJoint.IsMotorEnabled);
                break;
            }
        }
Beispiel #3
0
        /// <inheritdoc />
        protected override void OnStep()
        {
            if (Input.GetKeyDown(KeyCode.L))
            {
                m_joint.EnableLimit(!m_joint.IsLimitEnabled());
            }

            if (Input.GetKeyDown(KeyCode.M))
            {
                m_joint.EnableMotor(!m_joint.IsMotorEnabled());
            }
        }
Beispiel #4
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            if (e.KeyCode == Keys.L)
            {
                _joint.EnableLimit(_joint.IsLimitEnabled());
            }

            if (e.KeyCode == Keys.S)
            {
                _joint.EnableMotor(false);
            }
        }
Beispiel #5
0
        /// <inheritdoc />
        /// <inheritdoc />
        public override void OnKeyDown(KeyInputEventArgs keyInput)
        {
            if (keyInput.Key == KeyCodes.L)
            {
                m_joint.EnableLimit(!m_joint.IsLimitEnabled());
            }

            if (keyInput.Key == KeyCodes.M)
            {
                m_joint.EnableMotor(!m_joint.IsMotorEnabled());
            }
        }
Beispiel #6
0
        /// <inheritdoc />
        /// <inheritdoc />
        public override void OnKeyDown(KeyboardKeyEventArgs key)
        {
            if (key.Key == Key.L)
            {
                m_joint.EnableLimit(!m_joint.IsLimitEnabled());
            }

            if (key.Key == Key.M)
            {
                m_joint.EnableMotor(!m_joint.IsMotorEnabled());
            }
        }
Beispiel #7
0
 protected override void OnKeyDown(KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F)
     {
         _joint2.EnableMotor(!_joint2.IsMotorEnabled());
         _joint2.GetBodyB().SetAwake(true);
     }
     if (e.KeyCode == Keys.M)
     {
         _joint1.EnableMotor(!_joint1.IsMotorEnabled());
         _joint1.GetBodyB().SetAwake(true);
     }
 }
Beispiel #8
0
        /// <inheritdoc />
        protected override void PreStep()
        {
            DrawString("Keys: (l) limits, (m) motor");
            if (Input.GetKeyDown(KeyCode.L))
            {
                m_joint.EnableLimit(!m_joint.IsLimitEnabled());
            }

            if (Input.GetKeyDown(KeyCode.M))
            {
                m_joint.EnableMotor(!m_joint.IsMotorEnabled());
            }
        }
Beispiel #9
0
        /// <inheritdoc />
        protected override void OnStep()
        {
            if (Input.GetKeyDown(KeyCode.F))
            {
                _joint2.EnableMotor(!_joint2.IsMotorEnabled());
                _joint2.BodyB.IsAwake = true;
            }

            if (Input.GetKeyDown(KeyCode.M))
            {
                _joint1.EnableMotor(!_joint1.IsMotorEnabled());
                _joint1.BodyB.IsAwake = true;
            }
        }
Beispiel #10
0
        /// <inheritdoc />
        /// <inheritdoc />
        public override void OnKeyDown(KeyInputEventArgs keyInput)
        {
            if (keyInput.Key == KeyCodes.F)
            {
                _joint2.EnableMotor(!_joint2.IsMotorEnabled());
                _joint2.BodyB.IsAwake = true;
            }

            if (keyInput.Key == KeyCodes.M)
            {
                _joint1.EnableMotor(!_joint1.IsMotorEnabled());
                _joint1.BodyB.IsAwake = true;
            }
        }
Beispiel #11
0
        /// <inheritdoc />
        /// <inheritdoc />
        public override void OnKeyDown(KeyboardKeyEventArgs key)
        {
            if (key.Key == Key.F)
            {
                _joint2.EnableMotor(!_joint2.IsMotorEnabled());
                _joint2.BodyB.IsAwake = true;
            }

            if (key.Key == Key.M)
            {
                _joint1.EnableMotor(!_joint1.IsMotorEnabled());
                _joint1.BodyB.IsAwake = true;
            }
        }
Beispiel #12
0
        public override void Keyboard(System.Windows.Forms.Keys key)
        {
            switch (key)
            {
            case System.Windows.Forms.Keys.L:
                _joint.EnableLimit(!_joint.IsLimitEnabled);
                break;

            case System.Windows.Forms.Keys.S:
                _joint.EnableMotor(!_joint.IsMotorEnabled);
                break;

            default:
                return;
            }
        }
Beispiel #13
0
 protected override void OnKeyDown(KeyEventArgs e)
 {
     if (e.KeyCode == Keys.A)
     {
         _motorJoint.SetMotorSpeed(-_motorSpeed);
     }
     if (e.KeyCode == Keys.S)
     {
         _motorJoint.SetMotorSpeed(0.0f);
     }
     if (e.KeyCode == Keys.D)
     {
         _motorJoint.SetMotorSpeed(_motorSpeed);
     }
     if (e.KeyCode == Keys.M)
     {
         _motorJoint.EnableMotor(!_motorJoint.IsMotorEnabled());
     }
 }
Beispiel #14
0
        /// <inheritdoc />
        /// <inheritdoc />
        public override void OnKeyDown(KeyInputEventArgs keyInput)
        {
            if (keyInput.Key == KeyCodes.A)
            {
                _motorJoint.SetMotorSpeed(-_motorSpeed);
            }

            if (keyInput.Key == KeyCodes.S)
            {
                _motorJoint.SetMotorSpeed(0.0f);
            }

            if (keyInput.Key == KeyCodes.D)
            {
                _motorJoint.SetMotorSpeed(_motorSpeed);
            }

            if (keyInput.Key == KeyCodes.M)
            {
                _motorJoint.EnableMotor(!_motorJoint.IsMotorEnabled());
            }
        }
Beispiel #15
0
        /// <inheritdoc />
        protected override void OnStep()
        {
            if (Input.GetKeyDown(KeyCode.A))
            {
                _motorJoint.SetMotorSpeed(-_motorSpeed);
            }

            if (Input.GetKeyDown(KeyCode.S))
            {
                _motorJoint.SetMotorSpeed(0.0f);
            }

            if (Input.GetKeyDown(KeyCode.D))
            {
                _motorJoint.SetMotorSpeed(_motorSpeed);
            }

            if (Input.GetKeyDown(KeyCode.M))
            {
                _motorJoint.EnableMotor(!_motorJoint.IsMotorEnabled());
            }
        }
Beispiel #16
0
        /// <inheritdoc />
        /// <inheritdoc />
        public override void OnKeyDown(KeyboardKeyEventArgs key)
        {
            if (key.Key == Key.A)
            {
                _motorJoint.SetMotorSpeed(-_motorSpeed);
            }

            if (key.Key == Key.S)
            {
                _motorJoint.SetMotorSpeed(0.0f);
            }

            if (key.Key == Key.D)
            {
                _motorJoint.SetMotorSpeed(_motorSpeed);
            }

            if (key.Key == Key.M)
            {
                _motorJoint.EnableMotor(!_motorJoint.IsMotorEnabled());
            }
        }
Beispiel #17
0
        /// <inheritdoc />
        protected override void PreUpdate()
        {
            if (Input.GetKeyDown(KeyCode.A))
            {
                _motorJoint.SetMotorSpeed(-_motorSpeed);
            }

            if (Input.GetKeyDown(KeyCode.S))
            {
                _motorJoint.SetMotorSpeed(0.0f);
            }

            if (Input.GetKeyDown(KeyCode.D))
            {
                _motorJoint.SetMotorSpeed(_motorSpeed);
            }

            if (Input.GetKeyDown(KeyCode.M))
            {
                _motorJoint.EnableMotor(!_motorJoint.IsMotorEnabled());
            }

            DrawString("Keys: left = a, brake = s, right = d, toggle motor = m");
        }
Beispiel #18
0
        private void handleInput(int input, int clientId)
        {
            var inputs = (Input)input;

            if (inputs.HasFlag(Input.right))
            {
                if (inputs.HasFlag(Input.enemy))
                {
                    enemyPlayer.body.ApplyForceToCenter(new Vector2(5, 0));
                }
                else
                {
                    player.body.ApplyForceToCenter(new Vector2(5, 0));
                }
            }
            if (inputs.HasFlag(Input.left))
            {
                if (inputs.HasFlag(Input.enemy))
                {
                    enemyPlayer.body.ApplyForceToCenter(new Vector2(-5, 0));
                }
                else
                {
                    player.body.ApplyForceToCenter(new Vector2(-5, 0));
                }
            }
            if (inputs.HasFlag(Input.enemy))
            {
                if (inputs.HasFlag(Input.kick))
                {
                    if (!enemyLegJoint.IsMotorEnabled)
                    {
                        enemyLegJoint.EnableMotor(true);
                    }
                    else
                    {
                        enemyLegJoint.MotorSpeed = enemyFootSpeed;
                    }
                }
                if (inputs.HasFlag(Input.kickUp))
                {
                    enemyLegJoint.MotorSpeed = -enemyFootSpeed;
                }
            }
            else
            {
                if (inputs.HasFlag(Input.kick))
                {
                    if (!legJoint.IsMotorEnabled)
                    {
                        legJoint.EnableMotor(true);
                    }
                    else
                    {
                        legJoint.MotorSpeed = playerFootSpeed;
                    }
                }
                if (inputs.HasFlag(Input.kickUp))
                {
                    legJoint.MotorSpeed = -playerFootSpeed;
                }
            }
            if (inputs.HasFlag(Input.up) && MyContactListener.CANJUMP > 0)
            {
                if (inputs.HasFlag(Input.enemy))
                {
                    enemyPlayer.body.ApplyLinearImpulseToCenter(new Vector2(0, -0.4f));
                }
                else
                {
                    player.body.ApplyLinearImpulseToCenter(new Vector2(0, -0.4f));
                }
            }
        }