Exemplo n.º 1
0
 public override void HandleMouseClick(Vector3Int position)
 {
     Debug.Log(string.Format("Click on {0},{1}", position.x, position.y));
     ClearTile(LastHoverPosition);
     MouseTileMap.SetTile(position, SelectedTile);
     StateMachine.SetStateToUserSelected(position);
 }
Exemplo n.º 2
0
 public override void HandleMouseClick(Vector3Int position)
 {
     //if clicks on same spot as current selected tile, de-select and change
     //back to no user selection state
     ClearTile(SelectedTilePosition);
     ClearLastPath();
     if (SelectedTilePosition == position)
     {
         ResetSelectedTile();
         StateMachine.SetStateToNoUserSelectedTile();
     }
     else
     {
         //otherwise, readjust focused object
         MouseTileMap.SetTile(position, SelectedTile);
         SelectedTilePosition = position;
     }
 }
Exemplo n.º 3
0
    public override void HandleMouseMovement(Vector3Int position)
    {
        base.HandleMouseMovement(position);
        if (SelectedTilePosition != position)
        {
            var path  = PathFinder.DiscoverPath(TerrainMap, SelectedTilePosition, position);
            var tiles = path.GetPath();

            //clear out old path
            ClearLastPath();

            //draw in new path
            for (int i = 1; i < tiles.Count; i++)
            {
                MouseTileMap.SetTile(tiles[i].Position, HighlightTile);
            }

            //remember path for next time
            _lastPath = tiles;
        }
        MouseTileMap.SetTile(SelectedTilePosition, SelectedTile);
    }
Exemplo n.º 4
0
 protected virtual void ClearTile(Vector3Int position)
 {
     MouseTileMap.SetTile(position, NullTile);
 }
Exemplo n.º 5
0
 public override void HandleMouseMovement(Vector3Int position)
 {
     ClearTile(LastHoverPosition);
     MouseTileMap.SetTile(position, HighlightTile);
     LastHoverPosition = position;
 }