예제 #1
0
        private void TryAddPlayer(Collider2D collider)
        {
            IAPlayer player = collider.GetComponent <IAPlayer>();

            if (player != null && m_playerList.IndexOf(player) == -1)
            {
                if (m_playerList.Count == 0)
                {
                    ToggleToOn();
                }
                m_playerList.Add(player);
            }
        }
예제 #2
0
        private void TryRemovePlayer(Collider2D collider)
        {
            IAPlayer player = collider.GetComponent <IAPlayer>();

            if (player != null)
            {
                int holdIndex = m_playerList.IndexOf(player);
                if (holdIndex >= 0)
                {
                    m_playerList.RemoveAt(holdIndex);
                    if (m_playerList.Count == 0)
                    {
                        ToggleToOff();
                    }
                }
            }
        }