Ejemplo n.º 1
0
        /// <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();
        }
Ejemplo n.º 2
0
        /// <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();
        }
Ejemplo n.º 3
0
        /// <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();
        }
Ejemplo n.º 4
0
        protected virtual void Dispose(bool disposing)
        {
            if (!m_Disposed)
            {
                if (disposing)
                {
                    if (GamePhaseSequencer != null)
                    {
                        GamePhaseSequencer.Dispose();
                        GamePhaseSequencer = null;
                    }
                }

                // There are no unmanaged resources to release, but
                // if we add them, they need to be released here.
            }
            m_Disposed = true;

            // If it is available, make the call to the
            // base class's Dispose(Boolean) method
            //base.Disposed(disposing);
        }