protected virtual void OnShootCommand(PlayerKeyEventArgs args) { if (ShootCommand != null) { ShootCommand(this, args); } }
protected virtual void OnLeftCommand(PlayerKeyEventArgs args) { if (LeftCommand != null) { LeftCommand(this, args); } }
protected virtual void OnRightCommand(PlayerKeyEventArgs args) { if (RightCommand != null) { RightCommand(this, args); } }
protected virtual void OnUpCommand(PlayerKeyEventArgs args) { if (UpCommand != null) { UpCommand(this, args); } }
protected virtual void OnDownCommand(PlayerKeyEventArgs args) { if (DownCommand != null) { DownCommand(this, args); } }
/// <summary> /// Method, which processes keyboards events (key up and key down). /// </summary> /// <param name="source">Source of event. Not used.</param> /// <param name="args">Arguments of event. Uses to determine, is key up or down</param> public void KeyEventHandler(Object source, KeyboardKeyEventArgs args) { PlayerKeyEventArgs p_args = new PlayerKeyEventArgs(Keyboard.GetState().IsKeyUp(args.Key)); if (args.Key == keys.UpKey) { OnUpCommand(p_args); } if (args.Key == keys.DownKey) { OnDownCommand(p_args); } if (args.Key == keys.LeftKey) { OnLeftCommand(p_args); } if (args.Key == keys.RightKey) { OnRightCommand(p_args); } if (args.Key == keys.ShootKey) { OnShootCommand(p_args); } }
public void KeyUpEventHandler(Object source, KeyboardKeyEventArgs args) { PlayerKeyEventArgs p_args = new PlayerKeyEventArgs(Keyboard.GetState().IsKeyDown(args.Key)); if (args.Key == keys.UpKey) OnUpCommand(p_args); if (args.Key == keys.DownKey) OnDownCommand(p_args); if (args.Key == keys.LeftKey) OnLeftCommand(p_args); if (args.Key == keys.RightKey) OnRightCommand(p_args); if (args.Key == keys.ShootKey) OnShootCommand(p_args); }
protected virtual void OnUpCommand(PlayerKeyEventArgs args) { if (UpCommand != null) UpCommand(this, args); }
protected virtual void OnShootCommand(PlayerKeyEventArgs args) { if (ShootCommand != null) ShootCommand(this, args); }
protected virtual void OnRightCommand(PlayerKeyEventArgs args) { if (RightCommand != null) RightCommand(this, args); }
protected virtual void OnLeftCommand(PlayerKeyEventArgs args) { if (LeftCommand != null) LeftCommand(this, args); }
protected virtual void OnDownCommand(PlayerKeyEventArgs args) { if (DownCommand != null) DownCommand(this, args); }
private void LeftCommandHandler(Object source, PlayerKeyEventArgs args) { IsLeftState = args.KeyReleased; }
private void DownCommandHandler(Object source, PlayerKeyEventArgs args) { IsDownState = args.KeyReleased; }