private void SendAction(WorldTile tile, WorldTile.TileDirections direction) { UnitAction action; if (tile.type == DisasterTypes.Count) { action = new UnitAction(UnitAction.ActionType.MOVE, TileManager.Instance.GetWorldCoordsFromCellPosition(tile.cellLocation), WorldTileDirectionToActionDirection(direction)); TileManager.Instance.ToggleAdjacentHighlight(selectedTile, false); selectedTile = TileManager.Instance.GetWorldCoordsFromCellPosition(tile.cellLocation); TileManager.Instance.ToggleAdjacentHighlight(selectedTile); UnitManager.instance.AddAction(selectedUnit, action); } else { action = new UnitAction(UnitAction.ActionType.FIX, TileManager.Instance.GetWorldCoordsFromCellPosition(tile.cellLocation), UnitAction.ActionDirection.NONE); UnitManager.instance.AddAction(selectedUnit, action); selectedUnit = -1; } }
private UnitAction.ActionDirection WorldTileDirectionToActionDirection(WorldTile.TileDirections directions) { switch (directions) { case WorldTile.TileDirections.Above: return(UnitAction.ActionDirection.UP); case WorldTile.TileDirections.Below: return(UnitAction.ActionDirection.DOWN); case WorldTile.TileDirections.Left: return(UnitAction.ActionDirection.LEFT); case WorldTile.TileDirections.Right: return(UnitAction.ActionDirection.RIGHT); default: return(UnitAction.ActionDirection.NONE); } }