/// <summary>
    /// Ties to add a player a given new team. However the player might not join it
    /// </summary>
    /// <param name="p">The ntwork player who wants to join/change a team</param>
    /// <param name="newTeam">The team the players want to join/change to</param>
    /// <returns>The team the player is now part of, might be the same as before if we could not switch</returns>
    public ETeams TryToAddPlayerToTeam(NetworkPlayer p, ETeams newTeam)
    {
        //Can we even sitch (aks is team we are trying to join full)
        if (CanSwitchToTeam(newTeam))
        {
            //Remove the player form the team, we are doing it in both list just in case its in two at the same time
            m_crazyPeopleTeam.Remove(p);
            m_fireFigthersTeam.Remove(p);
            //Join the apropiate team
            switch (newTeam)
            {
            case ETeams.CrazyPeople:
                m_crazyPeopleTeam.Add(p);
                break;

            case ETeams.FireFighters:
                m_fireFigthersTeam.Add(p);
                break;
            }
            //Invoke that a team changed
            if (TeamsChanged != null)
            {
                TeamsChanged.Invoke();
            }
            //Return the team it joined
            return(newTeam);
        }
        else
        {
            //Just return the team it already is part of
            return(p.Player_Team);
        }
    }
 /// <summary>
 /// Removes a player from all teams, usefull to handle disconnections
 /// </summary>
 /// <param name="p">The player to remove</param>
 public void RemovePlayer(NetworkPlayer p)
 {
     //Remove the player form all team as he needs to be in one of them
     m_crazyPeopleTeam.Remove(p);
     m_fireFigthersTeam.Remove(p);
     //Invoke that a team changed
     if (TeamsChanged != null)
     {
         TeamsChanged.Invoke();
     }
 }
    /// <summary>
    /// Sets the team list of players to the given list of players. It will ovewrite the current team list
    /// </summary>
    /// <param name="playersIDs">The list of players is</param>
    /// <param name="team">The team this players are part of</param>
    public void SetTeamFromIds(int[] playersIDs, ETeams team)
    {
        //Based on the team we do different things
        switch (team)
        {
        case ETeams.CrazyPeople:
        {
            //Clear the player list
            m_crazyPeopleTeam.Clear();
            //Convert the array to list, this is to use functions like contains instead of nesting for loops myself
            List <int> playersIDsList = new List <int>();
            playersIDsList.AddRange(playersIDs);
            //Find the NetworkPlayer object with the given ids and add them to the team list
            foreach (NetworkPlayer p in MainNetworkManager._instance.PlayersConnected)
            {
                if (playersIDsList.Contains(p.Player_ID))
                {
                    m_crazyPeopleTeam.Add(p);
                }
            }
        }
        break;

        case ETeams.FireFighters:
        {
            //Clear the player list
            m_fireFigthersTeam.Clear();
            //Convert the array to list, this is to use functions like contains instead of nesting for loops myself
            List <int> playersIDsList = new List <int>();
            playersIDsList.AddRange(playersIDs);
            //Find the NetworkPlayer object with the given ids and add them to the team list
            foreach (NetworkPlayer p in MainNetworkManager._instance.PlayersConnected)
            {
                if (playersIDsList.Contains(p.Player_ID))
                {
                    m_fireFigthersTeam.Add(p);
                }
            }
        }
        break;
        }
        //Invoke that a team changed
        if (TeamsChanged != null)
        {
            TeamsChanged.Invoke();
        }
    }