/// <summary> /// /// </summary> /// <param name="e"></param> public void InjectKeyUp(SharpInputSystem.KeyEventArgs e) { // keep track of the player's intended direction if (e.Key == SharpInputSystem.KeyCode.Key_W && this.keyDirection.z == -1) { this.keyDirection.z = 0; } else if (e.Key == SharpInputSystem.KeyCode.Key_A && this.keyDirection.x == -1) { this.keyDirection.x = 0; } else if (e.Key == SharpInputSystem.KeyCode.Key_S && this.keyDirection.z == 1) { this.keyDirection.z = 0; } else if (e.Key == SharpInputSystem.KeyCode.Key_D && this.keyDirection.x == 1) { this.keyDirection.x = 0; } if (this.keyDirection.IsZeroLength && this.baseAnimID == AnimationID.RunBase) { // start running if not already moving and the player wants to move SetBaseAnimation(AnimationID.IdleBase, true); if (this.topAnimID == AnimationID.RunTop) { SetTopAnimation(AnimationID.IdleTop, true); } } }
/// <summary> /// key pressed selection event to have the ability to keep the current selection, sets the MouseSelector.KeepPreviousSelection /// if the right or left control key is pressed /// </summary> /// <param name="evt">KeyEventArgs</param> /// <returns>bool</returns> public override bool KeyReleased(SharpInputSystem.KeyEventArgs evt) { if (this.initialized) { this._MouseSelector.KeepPreviousSelection = false; } return base.KeyReleased(evt); }
/// <summary> /// /// </summary> /// <param name="evt"></param> /// <returns></returns> public override bool KeyReleased(SharpInputSystem.KeyEventArgs evt) { if (!TrayManager.IsDialogVisible) { this.chara.InjectKeyUp(evt); } return(base.KeyReleased(evt)); }
public bool KeyReleased(SharpInputSystem.KeyEventArgs e) { log.Info(String.Format("KeyReleased : {0} {1}", e.Key, e.Text)); if (e.Key == KeyCode.Key_ESCAPE || e.Key == KeyCode.Key_Q) { this.appRunning = false; } return(true); }
/// <summary> /// /// </summary> /// <param name="evt"></param> /// <returns></returns> public override bool KeyPressed(SharpInputSystem.KeyEventArgs evt) { // relay input events to character controller if (!TrayManager.IsDialogVisible) { this.chara.InjectKeyDown(evt); } return(base.KeyPressed(evt)); }
/// <summary> /// key pressed selection event to have the ability to keep the current selection, sets the MouseSelector.KeepPreviousSelection /// if the right or left control key is pressed /// </summary> /// <param name="evt">KeyEventArgs</param> /// <returns>bool</returns> public override bool KeyPressed(SharpInputSystem.KeyEventArgs evt) { if (this.initialized) { if (evt.Key == SharpInputSystem.KeyCode.Key_LCONTROL || evt.Key == SharpInputSystem.KeyCode.Key_RCONTROL) { this._MouseSelector.KeepPreviousSelection = true; } } return base.KeyPressed(evt); }
/// <summary> /// /// </summary> /// <param name="e"></param> public void InjectKeyDown(SharpInputSystem.KeyEventArgs e) { if (e.Key == SharpInputSystem.KeyCode.Key_Q && (this.topAnimID == AnimationID.IdleTop || this.topAnimID == AnimationID.RunTop)) { // take swords out (or put them back, since it's the same animation but reversed) SetTopAnimation(AnimationID.DrawSword, true); this.timer = 0; } else if (e.Key == SharpInputSystem.KeyCode.Key_E && !this.swordsDrawn) { if (this.topAnimID == AnimationID.IdleTop || this.topAnimID == AnimationID.RunTop) { // start dancing SetBaseAnimation(AnimationID.Dance, true); SetTopAnimation(AnimationID.None); // disable hand animation because the dance controls hands this.anims[(int)AnimationID.HandsRelaxed].IsEnabled = false; } else if (this.baseAnimID == AnimationID.Dance) { // stop dancing SetBaseAnimation(AnimationID.IdleBase, true); SetTopAnimation(AnimationID.IdleTop); // re-enable hand animation this.anims[(int)AnimationID.HandsRelaxed].IsEnabled = true; } } // keep track of the player's intended direction else if (e.Key == SharpInputSystem.KeyCode.Key_W) { this.keyDirection.z = -1; } else if (e.Key == SharpInputSystem.KeyCode.Key_A) { this.keyDirection.x = -1; } else if (e.Key == SharpInputSystem.KeyCode.Key_S) { this.keyDirection.z = 1; } else if (e.Key == SharpInputSystem.KeyCode.Key_D) { this.keyDirection.x = 1; } else if (e.Key == SharpInputSystem.KeyCode.Key_SPACE && (this.topAnimID == AnimationID.IdleTop || this.topAnimID == AnimationID.RunTop)) { // jump if on ground SetBaseAnimation(AnimationID.JumpStart, true); SetTopAnimation(AnimationID.None); this.timer = 0; } if (!this.keyDirection.IsZeroLength && this.baseAnimID == AnimationID.IdleBase) { // start running if not already moving and the player wants to move SetBaseAnimation(AnimationID.RunBase, true); if (this.topAnimID == AnimationID.IdleTop) { SetTopAnimation(AnimationID.RunTop, true); } } }
public bool KeyPressed(SharpInputSystem.KeyEventArgs e) { log.Info(String.Format("KeyPressed : {0} {1}", e.Key, e.Text)); return(true); }