示例#1
0
        /// <summary>
        /// Moves the cursor in the direction of the move input
        /// </summary>
        private void MoveCursorTile(Vector2 moveInput)
        {
            if (ReferenceEquals(CursorTile, null))
            {
                return;
            }

            var newTilePosition = new Vector2
            {
                x = CursorTile.PositionInGrid.x + (int)moveInput.x,
                y = CursorTile.PositionInGrid.y + (int)moveInput.y
            };

            if (!_gridManager.TileGrid.CoordinatesWithinGrid(newTilePosition))
            {
                return;
            }
            var newCursorTile = _gridManager.TileGrid[(int)newTilePosition.x, (int)newTilePosition.y];

            CursorTileChanged = ChangeCursorTile(newCursorTile);
            if (CursorTileChanged)
            {
                _gameCursor.MoveCursorOverTile(CursorTile);
            }
        }