public static void Remove(MinimapIcon minimapIcon) { if (s_Instance != null) { s_Instance.RemoveInternal(minimapIcon); } }
public static void Add(MinimapIcon minimapIcon) { if (s_Instance != null) { s_Instance.AddInternal(minimapIcon); } }
private void RemoveInternal(MinimapIcon minimapIcon) { if (!isActiveAndEnabled) { return; } if (m_Icons == null) { return; } GameObject icon; if (!m_Icons.TryGetValue(minimapIcon, out icon)) { return; } m_Icons.Remove(minimapIcon); icon.Free(); }
private void AddInternal(MinimapIcon minimapIcon) { if (!isActiveAndEnabled) { return; } if (m_Icons == null) { m_Icons = new Dictionary <MinimapIcon, GameObject>(); } if (m_Icons.ContainsKey(minimapIcon)) { return; } GameObject icon = ObjectPool.Get(m_Prefab, WorldToMinimapPosition(minimapIcon.transform.position), Quaternion.identity, transform); Image image = icon.GetComponent <Image>(); image.overrideSprite = minimapIcon.Sprite; image.color = Layers.IsEnemy(minimapIcon.gameObject.layer) ? m_EnemyColor : m_PlayerColor; m_Icons.Add(minimapIcon, icon); }