Пример #1
0
 /// <summary>
 /// Adds player to the segment
 /// </summary>
 /// <param name="player"></param>
 /// <returns>true if it is added to segment, false otherwise</returns>
 public bool addPlayer(Player player)
 {
     if (_players.Contains(player))
     {
         return false;
     }
     else
     {
         _players.Add(player);
         return true;
     }
 }
Пример #2
0
 /// <summary>
 /// Simply joins the player to the group
 /// <param name="name">Represents the groups name to which the player is going to be joined</param>
 /// </summary>
 public void joinGame(string name)
 {
     String id = Context.ConnectionId;
     Player p = new Player("","");
     _players.ForEach(player=> {
         if(player.id.Equals(id))
         {
             p = player;
         }
     });
     _playerGroups.ForEach(group=>
     {
         if(group._name.Equals(name))
         {
             group.addPlayer(p);
         }
     });
 }
Пример #3
0
 /// <summary>
 /// Deletes the player who failed to chooose correct string / ran out time
 /// </summary>
 public void PlayerFailed(bool didRanOutOfTime, Player current)
 {
     current.playerState = PlayerState.LOST;
     if (didRanOutOfTime)
     {
         TimeFail();
     }
     else
     {
         IncorrectStringFail();
     }
 }