コード例 #1
0
 public static void Remove(MinimapIcon minimapIcon)
 {
     if (s_Instance != null)
     {
         s_Instance.RemoveInternal(minimapIcon);
     }
 }
コード例 #2
0
 public static void Add(MinimapIcon minimapIcon)
 {
     if (s_Instance != null)
     {
         s_Instance.AddInternal(minimapIcon);
     }
 }
コード例 #3
0
        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();
        }
コード例 #4
0
        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);
        }