/// <summary> /// Causes the nextp player in the PlayerTurnOrder to get a turn /// </summary> public void NextPlayersTurn() { m_TurnOrderIndex = GetNextTurnOrderIndex(); if (m_TurnOrderIndex == -1) { // Next round EndCurrentRound(); return; } // assign new current player ICharacterInfo player = null; if (!Players.TryGetValue(PlayerTurnOrder[m_TurnOrderIndex], out player)) { // player got removed since the last few lines of code NextPlayersTurn(); } CurrentPlayer = player as ServerCharacterInfo; // set up the player's turn phases GamePhaseSequencer.ClearSequence(); Phase itm = OnCreateInitialPlayerTurnPhase(); GamePhaseSequencer.AddItem(itm, GetTurnPhaseDelay(itm)); GamePhaseSequencer.ActivateNextItem(); }
/// <summary> /// Ends the current player's turn. /// </summary> public void EndPlayersTurn() { GamePhaseSequencer.ClearSequence(); EndOfTurnPhase itm = new EndOfTurnPhase(0); GamePhaseSequencer.AddItem(itm, GetTurnPhaseDelay(itm)); GamePhaseSequencer.ActivateNextItem(); }
/// <summary> /// Immediately ends the current phase, as stored in GamePhaseSequencer. /// </summary> public void EndCurrentTurnPhase(IPhase nextPhase) { if (nextPhase == null) { Log.LogMsg("[" + GameID.ToString() + "] couldn't determine which phase should come after [" + nextPhase.PhaseName + "|" + nextPhase.PhaseID.ToString() + "]. Game is likely stuck now."); return; } GamePhaseSequencer.ClearSequence(); GamePhaseSequencer.AddItem(nextPhase as Phase, GetTurnPhaseDelay(nextPhase as Phase)); GamePhaseSequencer.ActivateNextItem(); }