예제 #1
0
    void startMovement()
    {
        _nextDirection            = _currentlyQueuedDirection;
        _currentlyQueuedDirection = EDirection.NONE;
        changeDirection(_nextDirection);
        Vector2Int nextTilePos = _position + _inputManager.GetVector(_nextDirection);
        Vector3Int nextPos     = _grid.LocalToCell(new Vector3(nextTilePos.x, nextTilePos.y));
        TileBase   tile        = _collisionMap.GetTile(nextPos);

        if (tile != null)
        {
            Debug.Log("Tile should be blocked: " + tile.ToString());
            _targetBlocked = true;
        }
        else
        {
            _position = nextTilePos;
            _currentTrapTileList.Clear();
            if (_trapMap.TileHasTrap(nextPos))
            {
                GameObject trapTile = _trapMap.GetTrapTileList(nextPos)[0];
                Debug.Log("trapTile: " + (trapTile != null));

                if (trapTile != null)
                {
                    _currentTrapTileList = _trapMap.GetTrapTileList(nextPos);
                }
            }
        }
    }