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(); }
private static void OnDraw(EventArgs args) { if (SelectedHero.IsValidTarget()) { Drawing.DrawCircle(SelectedHero.Position, SpellW.Range, Color.Red); } if (SpellQ.IsReady() && _drawingMenu["drawQ"].Cast <CheckBox>().CurrentValue) { Drawing.DrawCircle(Player.Position, SpellQ.Range, Color.BlanchedAlmond); } if (SpellE.IsReady() && _drawingMenu["drawE"].Cast <CheckBox>().CurrentValue) { Drawing.DrawCircle(Player.Position, SpellE.Range, Color.Brown); } }
public void RemoveHero(MapHero a_Hero) { if (!m_Heroes.Contains(a_Hero)) { Debug.LogError("Attempted to remove hero that isn't owned"); return; } m_Heroes.Remove(a_Hero); if (SelectedHero == a_Hero) { SelectedHero.OnDeselected(); OnHeroDeselected?.Invoke(a_Hero); SelectedHero = null; } OnHeroRemoved?.Invoke(a_Hero); }
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)); }