public void Rotate(Player player, bool reverse) { PlaySelectSoundEffect(); if (player.rotationsAreFree || _gameSceneManager.numberOfMoves > 0) { if (!player.rotationsAreFree) { _onPlayer.Movement(player); } var playersCurrentDir = _playerSpriteRenderer.GetDirection(player); if (reverse) { if (playersCurrentDir == Direction.West) { _playerSpriteRenderer.RenderDirection(player, Direction.South); } else if (playersCurrentDir == Direction.North) { _playerSpriteRenderer.RenderDirection(player, Direction.West); } else if (playersCurrentDir == Direction.East) { _playerSpriteRenderer.RenderDirection(player, Direction.North); } else { _playerSpriteRenderer.RenderDirection(player, Direction.East); } } else { if (playersCurrentDir == Direction.West) { _playerSpriteRenderer.RenderDirection(player, Direction.North); } else if (playersCurrentDir == Direction.North) { _playerSpriteRenderer.RenderDirection(player, Direction.East); } else if (playersCurrentDir == Direction.East) { _playerSpriteRenderer.RenderDirection(player, Direction.South); } else { _playerSpriteRenderer.RenderDirection(player, Direction.West); } } } }
public void Move() { if (!_isMoving) { if (Input.GetMouseButtonDown(0)) { var mousePos = _mouse.GetMousePos(this); var validPositions = _gameMap.GetValidMovePositions(this); if (validPositions.Contains(mousePos)) { var currentDir = _playerMovement.GetDirection(this); _spriteRenderer.RenderDirection(this, currentDir); StartCoroutine(_playerMovement.Move(this)); UseMoveTurn(); } } } }