void Awake() { GetComponent <InputManager>().ControlState = this; currentSelectionState = MapActionState.NoSelection; selectionStateObservers = new List <MapActionStateObserver>(); arrowKeyHandler = new ArrowKeyHandler(cursor); }
private void SetActionState(MapActionState actionState) { currentSelectionState = actionState; foreach (MapActionStateObserver observer in selectionStateObservers) { observer.ChangeSelectionState(currentSelectionState); } }
private void SetTileColour(MapActionState state) { Tilemap tilemap = GetComponent <Tilemap>(); switch (state) { case MapActionState.NoSelection: tilemap.color = Color.clear; break; } }
public void ChangeSelectionState(MapActionState newState) { // Generate new navmap appropriate for given state // then inform OverlayManager if (newState == MapActionState.NoSelection) { // Change unit animation state if necessary selectedTile = null; GenerateBasicNav(); } overlayManager.PaintOverlay(this, newState); }
public void ChangeSelectionState(MapActionState newActionState) { if (newActionState == MapActionState.NoSelection) { SelectedTile = null; } else if (newActionState == MapActionState.Movement) { SelectedTile = HoveredTile; // Change graphic } else if (newActionState == MapActionState.Attack) { // etc... } }
/** * Paint a NavMap as an overlay of the terrain map, with the tile colour * determined by the MapActionState. */ public void PaintOverlay(NavMap navMap, MapActionState state) { SetTileColour(state); PaintTiles(navMap); }