Example #1
0
        public void Update(GameFightRefreshFighterMessage msg)
        {
            if (msg == null)
            {
                throw new ArgumentNullException("msg");
            }
            var fighter = GetFighter(msg.informations.contextualId);

            if (fighter == null)
            {
                logger.Error("(GameFightRefreshFighterMessage) Fighter {0} not found", msg.informations.contextualId);
                return;
            }

            fighter.Update(msg.informations);

            if (Phase == FightPhase.Placement)
            {
                TimeLine.RefreshTimeLine();
            }
        }
Example #2
0
        public override bool AddActor(Fighter actor)
        {
            if (actor == null)
            {
                throw new ArgumentNullException("actor");
            }

            // do it before because an existing fighter can be removed
            bool added = base.AddActor(actor);

            actor.Team.AddFighter(actor);

            if (Phase == FightPhase.Placement)
            {
                TimeLine.RefreshTimeLine();
            }

            OnActorAdded(actor);

            return(added);
        }
Example #3
0
        public void Update(GameFightTurnListMessage msg)
        {
            if (msg == null)
            {
                throw new ArgumentNullException("msg");
            }

            foreach (var id in msg.ids.Except(msg.deadsIds))
            {
                var fighter = GetFighter(id);

                if (fighter == null)
                {
                    logger.Error("(GameFightTurnListMessage) Fighter {0} not found", id);
                }
                else
                {
                    fighter.IsAlive = true;
                }
            }

            foreach (var deadsId in msg.deadsIds)
            {
                var fighter = GetFighter(deadsId);

                if (fighter == null)
                {
                    logger.Error("(GameFightTurnListMessage) Fighter {0} not found", deadsId);
                }
                else
                {
                    fighter.IsAlive = false;
                }
            }

            TimeLine.RefreshTimeLine(msg.ids.Except(msg.deadsIds));
        }