//Метод взаимодействия пользователя и героя public void Move(ConsoleKey key) { IMove moveObj = this.mainHeroy as IMove; if (moveObj != null) { switch (key) { case ConsoleKey.W: moveObj.MoveUp(this.terrain); break; case ConsoleKey.S: moveObj.MoveDown(this.terrain); break; case ConsoleKey.A: moveObj.MoveLeft(this.terrain); break; case ConsoleKey.D: moveObj.MoveRigth(this.terrain); break; default: return; } } }
public void Execute() { if (Input.GetKeyDown(_moveLeft)) { _iMove.MoveLeft(); } if (Input.GetKeyDown(_moveRight)) { _iMove.MoveRight(); } if (Input.GetKeyDown(_moveFast)) { _iMove.MoveFast(); } if (Input.GetKeyDown(_moveSlow)) { _iMove.MoveSlow(); } if (Input.GetKeyUp(_moveLeft) || Input.GetKeyUp(_moveRight)) { _iMove.MoveStraight(); } if (Input.GetKeyUp(_moveFast) || Input.GetKeyUp(_moveSlow)) { _iMove.MoveNormal(); } if (Input.GetMouseButton(_fire)) { _iFire.Shoot(); uiInterface.UiEnergy.ShootingAnim(); } }
public void MoveLeft() { _moveImplementation.MoveLeft(); }