Exemple #1
0
        public void StartTurn(int playerId)
        {
            var fighter = GetFighter(playerId);

            if (fighter == null)
            {
                throw new InvalidOperationException(string.Format("Fighter {0} not found, cannot start turn", playerId));
            }

            TimeLine.SetCurrentPlayer(fighter);

            var evnt = TurnStarted;

            if (evnt != null)
            {
                evnt(this, TimeLine.CurrentPlayer);
            }

            if (TimeLine.CurrentPlayer != null)
            {
                if (Effects.ContainsKey(TimeLine.CurrentPlayer))
                {
                    foreach (var effectT in Effects[TimeLine.CurrentPlayer].ToArray())
                    {
                        effectT.Item1.turnDuration--;
                        if (effectT.Item1.turnDuration == 0) // Effect expired
                        {
                            Effects[TimeLine.CurrentPlayer].Remove(effectT);
                        }
                    }
                }
                TimeLine.CurrentPlayer.NotifyTurnStarted();
            }
        }
Exemple #2
0
        public void StartTurn(int playerId)
        {
            var fighter = GetFighter(playerId);

            if (fighter == null)
            {
                throw new InvalidOperationException(string.Format("Fighter {0} not found, cannot start turn", playerId));
            }

            TimeLine.SetCurrentPlayer(fighter);

            var evnt = TurnStarted;

            if (evnt != null)
            {
                evnt(this, TimeLine.CurrentPlayer);
            }

            TimeLine.CurrentPlayer.NotifyTurnStarted();
        }