public void ResetGame() { CloseGumps(); State = PokerGameState.Inactive; RoundActions = new List <PlayerAction>(); CommunityCards.Clear(); //create and shuffle a new deck Deck = new Deck(); PokerPots.Clear(); ActivePlayers.Clear(); foreach (var player in Players.ToArray()) { player.ClearGame(); } ActivePlayers.AddRange(Players.Where(x => x.Currency > 0)); if (GetActiveElliblePlayersCount() > 1) { BeginGame(); } else { StopIntermission(); ActivePlayers.Clear(); } }
private void ReinitializeDictionaries() { ActivePlayers.Clear(); Teams.Clear(); Teams[ETeamID.TEAM_1] = new List <EPlayerID>(); Teams[ETeamID.TEAM_2] = new List <EPlayerID>(); Teams[ETeamID.TEAM_3] = new List <EPlayerID>(); Teams[ETeamID.TEAM_4] = new List <EPlayerID>(); partyStatusMap.Clear(); PlayersTeam.Clear(); PlayersDeathPositions.Clear(); PlayersDeathRotations.Clear(); // Adding all players (Besides Spectator and None) foreach (EPlayerID playerID in Enum.GetValues(typeof(EPlayerID))) { if ((playerID != EPlayerID.NONE) && (playerID != EPlayerID.SPECTATOR)) { PlayersTeam.Add(playerID, ETeamID.NONE); PlayersDeathPositions.Add(playerID, Vector3.zero); PlayersDeathRotations.Add(playerID, Quaternion.identity); partyStatusMap.Add(playerID, new PlayerJoinStatus(EControllerID.NONE)); } } }
public void InitPlayers() { ActivePlayers.Clear(); BettingPlayers = 0; for (int i = 0; i < Config.MaxPlayers; i++) { if (i < Config.Players) { ActivePlayers.Add(players[i]); //turn on active players game objects players[i].gameObject.SetActive(true); } else { //turn off inactive players gameobjects players[i].gameObject.SetActive(false); //players[i].Role = Role.Defeated; } } for (int i = 0; i < ActivePlayers.Count; i++) { //if player has been initialized, reset player. if (!ActivePlayers[i].Initialized) { ActivePlayers[i].Init(i, turnSequencer, this, Config.placingBetDelay, Config.takeDelay, options.CardBackground); } ActivePlayers[i].ResetPlayer(); if (!Config.specialCards) { ActivePlayers[i].Cards = deck.GetCardsFromLiveDeckTasselated(i); //give activePlayers random cards } else { ActivePlayers[i].Cards = deck.GetSpecialCards(i); } ActivePlayers[i].StartReceivingCards(); } //Recalculate turning order after live players list has been created. turnSequencer.RecalculateTurningOrder(ActivePlayers); PlayDealingSound(); //test //activePlayers[0].MakeAllCardsHighestRank(); //activePlayers[1].MakeAllCardsHighestRank(); //activePlayers[2].MakeAllCardsHighestRank(); }
void SetupTeams() { Host.AssertServer(); ActivePlayers.Clear(); // Setup the Teams. int playerIdx = 0; var game = Game.Current as PlatformWars.Game; var players = game.GetPlayers(); foreach (var p in players) { var ply = p as Player; ply.SetTeam(Team.Red + playerIdx); playerIdx++; ActivePlayers.Add(ply); } }