コード例 #1
0
    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);
                }
            }
        }
    }
コード例 #2
0
 private void OnPlayerMovement()
 {
     _onPlayer.Movement(CurrentPlayer());
 }