Ejemplo n.º 1
0
        public void UpdateUnitDisplay()
        {
            if (UnitDisplayCounter < TimeToDisplay)
            {
                ++UnitDisplayCounter;

                if (UnitDisplayCounter == TimeToDisplay)
                {
                    UnitDisplayCounter = 0;
                    int SquadIndex = -1;

                    for (int P = 0; P < Map.ListPlayer.Count && SquadIndex == -1; P++)
                    {
                        SquadIndex = Map.CheckForSquadAtPosition(P, Map.CursorPosition, Vector3.Zero);
                        if (SquadIndex >= 0)
                        {
                            if (P == Map.ActivePlayerIndex)
                            {
                                BoxColor = Color.Green;
                            }
                            else
                            {
                                BoxColor = Color.Red;
                            }

                            Squad DefendingSquad = Map.ListPlayer[P].ListSquad[SquadIndex];
                            Map.TargetPlayerIndex = P;
                            Map.TargetSquadIndex  = SquadIndex;

                            if (ActiveAttack != null)
                            {
                                SupportSquadHolder ActiveSquadSupport = new SupportSquadHolder();
                                SupportSquadHolder TargetSquadSupport = new SupportSquadHolder();

                                ActiveSquadSupport.PrepareAttackSupport(Map, PlayerIndex, ActiveSquad, P, SquadIndex);
                                TargetSquadSupport.PrepareDefenceSupport(Map, P, DefendingSquad);

                                BattleResult = Map.CalculateFinalHP(ActiveSquad, ActiveSquadSupport.ActiveSquadSupport, Map.ActivePlayerIndex,
                                                                    FormationChoices.Focused,
                                                                    DefendingSquad, TargetSquadSupport.ActiveSquadSupport,
                                                                    P, SquadIndex, true, false);
                            }
                            else
                            {
                                BattleResult.ArrayResult = new BattleResult[DefendingSquad.UnitsAliveInSquad];
                                for (int U = 0; U < DefendingSquad.UnitsAliveInSquad; ++U)
                                {
                                    BattleResult.ArrayResult[U] = new BattleResult();
                                    BattleResult.ArrayResult[U].SetTarget(P, SquadIndex, U, DefendingSquad[U]);
                                }
                            }
                        }
                    }
                }
            }
        }