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; } }
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; } }
/// <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()); } }
protected override void OnKeyDown(KeyEventArgs e) { if (e.KeyCode == Keys.L) { _joint.EnableLimit(_joint.IsLimitEnabled()); } if (e.KeyCode == Keys.S) { _joint.EnableMotor(false); } }
/// <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()); } }
/// <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()); } }
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); } }
/// <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()); } }
/// <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; } }
/// <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; } }
/// <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; } }
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; } }
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()); } }
/// <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()); } }
/// <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()); } }
/// <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()); } }
/// <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"); }
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)); } } }