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); } }
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(); } } } }