public void SelectHero(MapHero a_Hero) { if (!m_Heroes.Contains(a_Hero)) { Debug.LogError("Selected hero that isn't owned by local player"); return; } if (SelectedHero != null) { SelectedHero.OnDeselected(); OnHeroDeselected?.Invoke(SelectedHero); } else if (SelectedTown != null) { OnTownDeselected?.Invoke(SelectedTown); } SelectedHero = a_Hero; SelectedTown = null; OnHeroSelected?.Invoke(a_Hero, m_Heroes.IndexOf(a_Hero)); a_Hero.OnSelected(); }
public void RemoveTown(MapTown a_Town) { if (!m_Towns.Contains(a_Town)) { Debug.LogError("Attempted to remove town that isn't owned"); return; } m_Towns.Remove(a_Town); if (SelectedTown == a_Town) { OnTownDeselected?.Invoke(a_Town); SelectedTown = null; } OnTownRemoved?.Invoke(a_Town); }
public void SelectTown(MapTown a_Town) { if (!m_Towns.Contains(a_Town)) { Debug.LogError("Selected town that isn't owned by local player"); return; } if (SelectedHero != null) { SelectedHero.OnDeselected(); OnHeroDeselected?.Invoke(SelectedHero); } else if (SelectedTown != null) { OnTownDeselected?.Invoke(SelectedTown); } SelectedTown = a_Town; SelectedHero = null; OnTownSelected?.Invoke(a_Town, m_Towns.IndexOf(a_Town)); }