public KeyInput(MyObject _player, KeyManager.CommandType _command, KeyManager.KeyPressType _keyPressType) : base() { player = _player; command = _command; keyPressType = _keyPressType; }
public virtual void ReceiveCommand(KeyManager.CommandType command, KeyManager.KeyPressType pressType) { if (IsActivated() == false) { return; } Action.Activate(owner, new Action.KeyInput(owner, command, pressType)); }
private void UpdateKeyInput(KeyManager.CommandType command, KeyManager.KeyPressType type) { for (int d = 0; d < 4; ++d) { WorldGeneral.Direction dir = (WorldGeneral.Direction)d; if (command == dirKeyDic[dir]) { if (type == KeyManager.KeyPressType.DOWN) { movementInput[(int)dir] = true; movementInput[(int)dirRevdirDic[dir]] = false; } else if (type == KeyManager.KeyPressType.PRESS) { if (movementInput[(int)dirRevdirDic[dir]] == false) { movementInput[(int)dir] = true; } } else if (type == KeyManager.KeyPressType.UP) { movementInput[(int)dir] = false; } return; } } attackInput = false; if (command == KeyManager.CommandType.COMMAND_ATTACK && (type == KeyManager.KeyPressType.DOWN || type == KeyManager.KeyPressType.PRESS)) { attackInput = true; } if (command == KeyManager.CommandType.COMMAND_ATTACK && type == KeyManager.KeyPressType.UP) { attackInput = false; } }