internal void RegisterMMObject(MinimapObject obj) { var icon = ConstructIcon(obj); m_iconsPool.Add(icon); m_objs_iconsDict.Add(obj, icon); }
internal void UnRegisterMMObject(MinimapObject obj) { MinimapIcon icon; m_objs_iconsDict.TryGetValue(obj, out icon); if (!icon) { Debug.LogError("Trying to unregister icon that is not registered, how did this happen?"); return; } m_iconsPool.Remove(icon); }
protected virtual MinimapIcon ConstructIcon(MinimapObject mmobj) { if (!m_iconPrefab) { Debug.Log("Icon prefab is null, aborting icon construction."); return(null); } m_iconPrefab.SetActive(false); var go = Instantiate(m_iconPrefab, m_iconsRoot, false); var icon = go.GetComponent <MinimapIcon>(); icon.target = mmobj; icon.gameObject.SetActive(true); m_iconPrefab.SetActive(true); return(icon); }