private void MarkIndicatorTiles() { indicators.ClearAllTiles(); for (int i = 0; i < Enum.GetNames(typeof(TileIndicatorTypes)).Length; i++) { TileIndicatorTypes indicatorType = (TileIndicatorTypes)i; if (indicatorTiles.ContainsKey(indicatorType)) { List <Vector3Int> tilesToMark = indicatorTiles[indicatorType]; TileBase tileBase = GetTileFromIndicator(indicatorType); foreach (Vector3Int tile in tilesToMark) { Vector3Int placement = new Vector3Int(tile.x + 1, tile.y + 1, tile.z - 1); if (geography.HasTile(placement)) { indicators.SetTile(placement, tileBase); } } } else { continue; } } }
private TileBase GetTileFromIndicator(TileIndicatorTypes indicatorType) { switch (indicatorType) { case TileIndicatorTypes.Movement: return(ScriptableObject.CreateInstance <MovementIndicator>()); case TileIndicatorTypes.LoadingZone: return(ScriptableObject.CreateInstance <LoadingZoneIndicator>()); case TileIndicatorTypes.Aggro: return(ScriptableObject.CreateInstance <AggroIndicator>()); case TileIndicatorTypes.Encounter: return(ScriptableObject.CreateInstance <EncounterIndicator>()); case TileIndicatorTypes.AllyTargetingSkill: return(ScriptableObject.CreateInstance <AllyTargetingSkillIndicator>()); case TileIndicatorTypes.EnemyTargetingSkill: return(ScriptableObject.CreateInstance <EnemyTargetingSkillIndicator>()); default: return(ScriptableObject.CreateInstance <MovementIndicator>()); } }
public void RemoveIndicatorTiles(TileIndicatorTypes indicatorType) { if (indicatorTiles.ContainsKey(indicatorType)) { indicatorTiles.Remove(indicatorType); } MarkIndicatorTiles(); }
/// <summary> /// Marks instance tiles with a specified tile indicator type. /// </summary> /// <param name="tilesToMark">The tiles to be marked with indicators.</param> /// <param name="indicatorType">The type of indicator to mark the tiles with.</param> public void AddIndicatorTiles(List <Vector3Int> tilesToMark, TileIndicatorTypes indicatorType) { if (indicatorTiles.ContainsKey(indicatorType)) { indicatorTiles[indicatorType] = tilesToMark; } else { indicatorTiles.Add(indicatorType, tilesToMark); } MarkIndicatorTiles(); }