Example #1
0
 void Awake()
 {
     GetComponent <InputManager>().ControlState = this;
     currentSelectionState   = MapActionState.NoSelection;
     selectionStateObservers = new List <MapActionStateObserver>();
     arrowKeyHandler         = new ArrowKeyHandler(cursor);
 }
Example #2
0
 private void SetActionState(MapActionState actionState)
 {
     currentSelectionState = actionState;
     foreach (MapActionStateObserver observer in selectionStateObservers)
     {
         observer.ChangeSelectionState(currentSelectionState);
     }
 }
Example #3
0
    private void SetTileColour(MapActionState state)
    {
        Tilemap tilemap = GetComponent <Tilemap>();

        switch (state)
        {
        case MapActionState.NoSelection: tilemap.color = Color.clear; break;
        }
    }
Example #4
0
    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);
    }
Example #5
0
 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...
     }
 }
Example #6
0
 /**
  * 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);
 }