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); }
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; } }
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); }
protected virtual void ClearTile(Vector3Int position) { MouseTileMap.SetTile(position, NullTile); }
public override void HandleMouseMovement(Vector3Int position) { ClearTile(LastHoverPosition); MouseTileMap.SetTile(position, HighlightTile); LastHoverPosition = position; }