public void RegisterPlayer(IPlayer player) { if (teamBlack == null) { player.SetTeam(TeamName.BlackTeam); teamBlack = player; player.OnMoveComplete += OnPlayerMoveCompleted; teamBlackId = GetNewGUID(); player.SignUp(teamBlackId); print("Team Black is being played by " + player.GetName() + " with the security id of " + teamBlackId.ToString()); } else if (teamRed == null) { player.SetTeam(TeamName.RedTeam); teamRed = player; teamRedId = GetNewGUID(); player.SignUp(teamRedId); print("Team Red is being played by " + player.GetName() + " with the security id of " + teamRedId.ToString()); player.OnMoveComplete += OnPlayerMoveCompleted; ScoreKeeper.SetPlayers(teamRed, teamBlack); OnTeamsRegisteredEvent?.Invoke(this, true); } else { print("No more players allowed at this time!"); } }
public void RegisterPlayer(IPlayer player) { if (teamBlack == null) { player.SetTeam(TeamName.BlackTeam); teamBlack = player; player.OnMoveComplete += OnPlayerMoveCompleted; teamBlackId = GetNewGUID(); player.SignUp(teamBlackId); try { tester.teamBlack = (AI_Base)player; }catch (InvalidCastException) { Debug.Log("Team Black cannont be tested properly as it does not inherit from AI_Base."); } print("Team Black is being played by " + player.GetName() + " with the security id of " + teamBlackId.ToString()); } else if (teamRed == null) { player.SetTeam(TeamName.RedTeam); teamRed = player; teamRedId = GetNewGUID(); player.SignUp(teamRedId); try { tester.teamRed = (AI_Base)player; } catch (InvalidCastException) { Debug.Log("Team Red cannont be tested properly as it does not inherit from AI_Base."); } print("Team Red is being played by " + player.GetName() + " with the security id of " + teamRedId.ToString()); player.OnMoveComplete += OnPlayerMoveCompleted; OnTeamsRegisteredEvent?.Invoke(this, true); } else { print("No more players allowed at this time!"); } }