示例#1
0
        private void ResetOrderPositions()
        {
            this.behaviorSide = this.DetermineGatheringSide();
            SiegeLane  siegeLane  = TeamAISiegeComponent.SiegeLanes.FirstOrDefault <SiegeLane>((Func <SiegeLane, bool>)(sl => sl.LaneSide == this.behaviorSide));
            WorldFrame worldFrame = siegeLane == null ? WorldFrame.Invalid : siegeLane.DefensePoints.FirstOrDefault <ICastleKeyPosition>().DefenseWaitFrame;

            this._gatheringTacticalPos = siegeLane != null?siegeLane.DefensePoints.FirstOrDefault <ICastleKeyPosition>().WaitPosition : (TacticalPosition)null;

            if (this._gatheringTacticalPos != null)
            {
                this._gatherOrder          = MovementOrder.MovementOrderMove(this._gatheringTacticalPos.Position);
                this._gatheringFacingOrder = FacingOrder.FacingOrderLookAtEnemy;
            }
            else if (worldFrame.Origin.IsValid)
            {
                double num = (double)worldFrame.Rotation.f.Normalize();
                this._gatherOrder          = MovementOrder.MovementOrderMove(worldFrame.Origin);
                this._gatheringFacingOrder = FacingOrder.FacingOrderLookAtEnemy;
            }
            else
            {
                this._gatherOrder          = MovementOrder.MovementOrderMove(this.formation.QuerySystem.MedianPosition);
                this._gatheringFacingOrder = FacingOrder.FacingOrderLookAtEnemy;
            }
            this._attackOrder       = MovementOrder.MovementOrderChargeToTarget(this._targetEnemyFormation);
            this._attackFacingOrder = FacingOrder.FacingOrderLookAtEnemy;
            this.CurrentOrder       = this._behaviourState == BehaviorEliminateEnemyInsideCastle.BehaviourState.Attacking ? this._attackOrder : this._gatherOrder;
            this.CurrentFacingOrder = this._behaviourState == BehaviorEliminateEnemyInsideCastle.BehaviourState.Attacking ? this._attackFacingOrder : this._gatheringFacingOrder;
        }
        protected override void CalculateCurrentOrder()
        {
            switch (this._behaviourState)
            {
            case BehaviorAssaultWalls.BehaviorState.Deciding:
                this.CurrentOrder = this._stopOrder;
                break;

            case BehaviorAssaultWalls.BehaviorState.ClimbWall:
                this.CurrentOrder            = this._wallSegmentMoveOrder;
                this.CurrentFacingOrder      = FacingOrder.FacingOrderLookAtDirection(-this._wallSegment.MiddleFrame.Rotation.f.AsVec2.Normalized());
                this.CurrentArrangementOrder = ArrangementOrder.ArrangementOrderLine;
                break;

            case BehaviorAssaultWalls.BehaviorState.AttackEntity:
                if (!this._teamAISiegeComponent.OuterGate.IsGateOpen)
                {
                    this.CurrentOrder = this._attackEntityOrderOuterGate;
                }
                else
                {
                    this.CurrentOrder = this._attackEntityOrderInnerGate;
                }
                this.CurrentFacingOrder      = FacingOrder.FacingOrderLookAtEnemy;
                this.CurrentArrangementOrder = ArrangementOrder.ArrangementOrderLine;
                break;

            case BehaviorAssaultWalls.BehaviorState.TakeControl:
                if (this.formation.QuerySystem.ClosestEnemyFormation != null)
                {
                    this.CurrentOrder = MovementOrder.MovementOrderChargeToTarget(this.formation.QuerySystem.ClosestEnemyFormation.Formation);
                }
                else
                {
                    this.CurrentOrder = MovementOrder.MovementOrderCharge;
                }
                this.CurrentFacingOrder      = FacingOrder.FacingOrderLookAtDirection(-this._wallSegment.MiddleFrame.Rotation.f.AsVec2.Normalized());
                this.CurrentArrangementOrder = ArrangementOrder.ArrangementOrderLine;
                break;

            case BehaviorAssaultWalls.BehaviorState.MoveToGate:
                this.CurrentOrder            = this._castleGateMoveOrder;
                this.CurrentFacingOrder      = FacingOrder.FacingOrderLookAtDirection(-this._innerGate.MiddleFrame.Rotation.f.AsVec2.Normalized());
                this.CurrentArrangementOrder = ArrangementOrder.ArrangementOrderLine;
                break;

            case BehaviorAssaultWalls.BehaviorState.Charging:
                this.CurrentOrder            = this._chargeOrder;
                this.CurrentFacingOrder      = FacingOrder.FacingOrderLookAtEnemy;
                this.CurrentArrangementOrder = ArrangementOrder.ArrangementOrderLoose;
                break;

            case BehaviorAssaultWalls.BehaviorState.Stop:
                this.CurrentOrder = this._stopOrder;
                break;
            }
        }
示例#3
0
 protected override void CalculateCurrentOrder()
 {
     if (this.formation.QuerySystem.ClosestEnemyFormation == null)
     {
         this.CurrentOrder = MovementOrder.MovementOrderCharge;
     }
     else
     {
         this.CurrentOrder = MovementOrder.MovementOrderChargeToTarget(this.formation.QuerySystem.ClosestEnemyFormation.Formation);
     }
 }
 static bool PrefixCalculateCurrentOrder(ref Formation ___formation, ref MovementOrder ____currentOrder)
 {
     if (___formation != null && ___formation.QuerySystem.IsInfantryFormation && ___formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation != null)
     {
         Formation significantEnemy = Utilities.FindSignificantEnemy(___formation, true, true, false, false, false);
         if (significantEnemy != null)
         {
             ____currentOrder = MovementOrder.MovementOrderChargeToTarget(significantEnemy);
             return(false);
         }
     }
     ____currentOrder = MovementOrder.MovementOrderCharge;
     return(false);
 }
 protected override void CalculateCurrentOrder()
 {
     if (this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation == null || (double)this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation.MedianPosition.AsVec2.DistanceSquared(this.formation.QuerySystem.AveragePosition) > 2500.0)
     {
         this.CurrentOrder       = this.UncapturedFlagMoveOrder();
         this.CurrentFacingOrder = FacingOrder.FacingOrderLookAtEnemy;
     }
     else
     {
         FlagCapturePoint flagCapturePoint = (FlagCapturePoint)null;
         if (this._flagpositions.Any <FlagCapturePoint>((Func <FlagCapturePoint, bool>)(fp => this._flagDominationGameMode.GetFlagOwnerTeam(fp) != this.formation.Team && !fp.IsContested)))
         {
             flagCapturePoint = this._flagpositions.Where <FlagCapturePoint>((Func <FlagCapturePoint, bool>)(fp => this._flagDominationGameMode.GetFlagOwnerTeam(fp) != this.formation.Team && !fp.IsContested)).MinBy <FlagCapturePoint, float>((Func <FlagCapturePoint, float>)(fp => this.formation.QuerySystem.AveragePosition.DistanceSquared(fp.Position.AsVec2)));
         }
         if (!this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation.IsInfantryFormation && flagCapturePoint != null)
         {
             this.CurrentOrder       = MovementOrder.MovementOrderMove(new WorldPosition(Mission.Current.Scene, UIntPtr.Zero, flagCapturePoint.Position, false));
             this.CurrentFacingOrder = FacingOrder.FacingOrderLookAtEnemy;
         }
         else if (this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation.IsRangedFormation)
         {
             this.CurrentOrder       = MovementOrder.MovementOrderChargeToTarget(this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation.Formation);
             this.CurrentFacingOrder = FacingOrder.FacingOrderLookAtEnemy;
         }
         else
         {
             Vec2          direction      = this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation.MedianPosition.AsVec2 - this.formation.QuerySystem.AveragePosition;
             float         num            = direction.Normalize();
             WorldPosition medianPosition = this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation.MedianPosition;
             if ((double)num > (double)this.formation.QuerySystem.MissileRange)
             {
                 medianPosition.SetVec2(medianPosition.AsVec2 - direction * (this.formation.QuerySystem.MissileRange - this.formation.Depth * 0.5f));
             }
             else if ((double)num < (double)this.formation.QuerySystem.MissileRange * 0.400000005960464)
             {
                 medianPosition.SetVec2(medianPosition.AsVec2 - direction * (this.formation.QuerySystem.MissileRange * 0.7f));
             }
             else
             {
                 direction = direction.RightVec();
                 medianPosition.SetVec2(this.formation.QuerySystem.AveragePosition + direction * 20f);
             }
             this.CurrentOrder       = MovementOrder.MovementOrderMove(medianPosition);
             this.CurrentFacingOrder = FacingOrder.FacingOrderLookAtDirection(direction);
         }
     }
 }
        private void CheckAndChangeState()
        {
            WorldPosition position = this._movementOrder.GetPosition(this.formation);

            switch (this._protectFlankState)
            {
            case BehaviorProtectFlank.BehaviourState.HoldingFlank:
                if (this.formation.QuerySystem.ClosestEnemyFormation == null)
                {
                    break;
                }
                float num1 = (float)(50.0 + ((double)this.formation.Depth + (double)this.formation.QuerySystem.ClosestEnemyFormation.Formation.Depth) / 2.0);
                if ((double)this.formation.QuerySystem.ClosestEnemyFormation.MedianPosition.AsVec2.DistanceSquared(position.AsVec2) >= (double)num1 * (double)num1)
                {
                    break;
                }
                this._chargeToTargetOrder = MovementOrder.MovementOrderChargeToTarget(this.formation.QuerySystem.ClosestEnemyFormation.Formation);
                this.CurrentOrder         = this._chargeToTargetOrder;
                this._protectFlankState   = BehaviorProtectFlank.BehaviourState.Charging;
                break;

            case BehaviorProtectFlank.BehaviourState.Charging:
                if (this.formation.QuerySystem.ClosestEnemyFormation == null)
                {
                    this.CurrentOrder       = this._movementOrder;
                    this._protectFlankState = BehaviorProtectFlank.BehaviourState.Returning;
                    break;
                }
                float num2 = (float)(60.0 + ((double)this.formation.Depth + (double)this.formation.QuerySystem.ClosestEnemyFormation.Formation.Depth) / 2.0);
                if ((double)this.formation.QuerySystem.AveragePosition.DistanceSquared(position.AsVec2) <= (double)num2 * (double)num2)
                {
                    break;
                }
                this.CurrentOrder       = this._movementOrder;
                this._protectFlankState = BehaviorProtectFlank.BehaviourState.Returning;
                break;

            case BehaviorProtectFlank.BehaviourState.Returning:
                if ((double)this.formation.QuerySystem.AveragePosition.DistanceSquared(position.AsVec2) >= 400.0)
                {
                    break;
                }
                this._protectFlankState = BehaviorProtectFlank.BehaviourState.HoldingFlank;
                break;
            }
        }
示例#7
0
 protected override void CalculateCurrentOrder()
 {
     if (this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation == null || (double)this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation.MedianPosition.AsVec2.DistanceSquared(this.formation.QuerySystem.AveragePosition) > 2500.0)
     {
         this.CurrentOrder = this.UncapturedFlagMoveOrder();
     }
     else
     {
         FlagCapturePoint flagCapturePoint = (FlagCapturePoint)null;
         if (this._flagpositions.Any <FlagCapturePoint>((Func <FlagCapturePoint, bool>)(fp => this._flagDominationGameMode.GetFlagOwnerTeam(fp) != this.formation.Team && !fp.IsContested)))
         {
             flagCapturePoint = this._flagpositions.Where <FlagCapturePoint>((Func <FlagCapturePoint, bool>)(fp => this._flagDominationGameMode.GetFlagOwnerTeam(fp) != this.formation.Team && !fp.IsContested)).MinBy <FlagCapturePoint, float>((Func <FlagCapturePoint, float>)(fp => this.formation.QuerySystem.AveragePosition.DistanceSquared(fp.Position.AsVec2)));
         }
         if ((!this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation.IsRangedFormation ? 0 : ((double)this.formation.QuerySystem.FormationPower / (double)this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation.FormationPower / (double)this.formation.Team.QuerySystem.OverallPowerRatio > 0.699999988079071 ? 1 : 0)) == 0 && flagCapturePoint != null)
         {
             this.CurrentOrder = MovementOrder.MovementOrderMove(new WorldPosition(Mission.Current.Scene, UIntPtr.Zero, flagCapturePoint.Position, false));
         }
         else
         {
             this.CurrentOrder = MovementOrder.MovementOrderChargeToTarget(this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation.Formation);
         }
     }
 }
        protected override void CalculateCurrentOrder()
        {
            BehaviorSergeantMPInfantry.BehaviorState behaviorState = this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation == null || (!this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation.IsRangedFormation || (double)this.formation.QuerySystem.AveragePosition.DistanceSquared(this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation.MedianPosition.AsVec2) > (this._behaviorState == BehaviorSergeantMPInfantry.BehaviorState.Attacking ? 3600.0 : 2500.0)) && (!this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation.IsInfantryFormation || (double)this.formation.QuerySystem.AveragePosition.DistanceSquared(this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation.MedianPosition.AsVec2) > (this._behaviorState == BehaviorSergeantMPInfantry.BehaviorState.Attacking ? 900.0 : 400.0)) ? BehaviorSergeantMPInfantry.BehaviorState.GoingToFlag : BehaviorSergeantMPInfantry.BehaviorState.Attacking;
            if (behaviorState == BehaviorSergeantMPInfantry.BehaviorState.Attacking && (this._behaviorState != BehaviorSergeantMPInfantry.BehaviorState.Attacking || this.CurrentOrder.OrderEnum != MovementOrder.MovementOrderEnum.ChargeToTarget || this.CurrentOrder.TargetFormation.QuerySystem != this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation))
            {
                this._behaviorState = BehaviorSergeantMPInfantry.BehaviorState.Attacking;
                this.CurrentOrder   = MovementOrder.MovementOrderChargeToTarget(this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation.Formation);
            }
            if (behaviorState != BehaviorSergeantMPInfantry.BehaviorState.GoingToFlag)
            {
                return;
            }
            this._behaviorState = behaviorState;
            WorldPosition position;

            if (this._flagpositions.Any <FlagCapturePoint>((Func <FlagCapturePoint, bool>)(fp => this._flagDominationGameMode.GetFlagOwnerTeam(fp) != this.formation.Team)))
            {
                position = new WorldPosition(Mission.Current.Scene, UIntPtr.Zero, this._flagpositions.Where <FlagCapturePoint>((Func <FlagCapturePoint, bool>)(fp => this._flagDominationGameMode.GetFlagOwnerTeam(fp) != this.formation.Team)).MinBy <FlagCapturePoint, float>((Func <FlagCapturePoint, float>)(fp => fp.Position.AsVec2.DistanceSquared(this.formation.QuerySystem.AveragePosition))).Position, false);
            }
            else if (this._flagpositions.Any <FlagCapturePoint>((Func <FlagCapturePoint, bool>)(fp => this._flagDominationGameMode.GetFlagOwnerTeam(fp) == this.formation.Team)))
            {
                position = new WorldPosition(Mission.Current.Scene, UIntPtr.Zero, this._flagpositions.Where <FlagCapturePoint>((Func <FlagCapturePoint, bool>)(fp => this._flagDominationGameMode.GetFlagOwnerTeam(fp) == this.formation.Team)).MinBy <FlagCapturePoint, float>((Func <FlagCapturePoint, float>)(fp => fp.Position.AsVec2.DistanceSquared(this.formation.QuerySystem.AveragePosition))).Position, false);
            }
            else
            {
                position = this.formation.QuerySystem.MedianPosition;
                position.SetVec2(this.formation.QuerySystem.AveragePosition);
            }
            if (this.CurrentOrder.OrderEnum != MovementOrder.MovementOrderEnum.Invalid && !(this.CurrentOrder.GetPosition(this.formation).AsVec2 != position.AsVec2))
            {
                return;
            }
            Vec2 direction = this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation != null ? (this.formation.QuerySystem.ClosestSignificantlyLargeEnemyFormation.MedianPosition.AsVec2 - this.formation.QuerySystem.AveragePosition).Normalized() : this.formation.Direction;

            this.CurrentOrder       = MovementOrder.MovementOrderMove(position);
            this.CurrentFacingOrder = FacingOrder.FacingOrderLookAtDirection(direction);
        }
示例#9
0
        private void Check()
        {
            float time = this.Mission.Time;

            if (this._battlePhase == CPUBenchmarkMissionLogic.BattlePhase.Start && (double)time >= 5.0)
            {
                this.Mission.IsTeleportingAgents = false;
                this._battlePhase = CPUBenchmarkMissionLogic.BattlePhase.ArrowShower;
            }
            else
            {
                if (this._battlePhase == CPUBenchmarkMissionLogic.BattlePhase.Start)
                {
                    return;
                }
                if (!this._isCurPhaseInPlay)
                {
                    Debug.Print("State: " + (object)this._battlePhase, color: Debug.DebugColor.Cyan, debugFilter: 64UL);
                    switch (this._battlePhase)
                    {
                    case CPUBenchmarkMissionLogic.BattlePhase.ArrowShower:
                        this._attLeftRanged.FiringOrder    = FiringOrder.FiringOrderFireAtWill;
                        this._attRightRanged.FiringOrder   = FiringOrder.FiringOrderFireAtWill;
                        this._defLeftBInf.FiringOrder      = FiringOrder.FiringOrderFireAtWill;
                        this._defRightBInf.FiringOrder     = FiringOrder.FiringOrderFireAtWill;
                        this._defMidBInf.FiringOrder       = FiringOrder.FiringOrderFireAtWill;
                        this._defLeftInf.ArrangementOrder  = ArrangementOrder.ArrangementOrderShieldWall;
                        this._defRightInf.ArrangementOrder = ArrangementOrder.ArrangementOrderShieldWall;
                        this._defLeftInf.FormOrder         = FormOrder.FormOrderCustom(35f);
                        this._defRightInf.FormOrder        = FormOrder.FormOrderCustom(35f);
                        this._attLeftInf.ArrangementOrder  = ArrangementOrder.ArrangementOrderShieldWall;
                        this._attRightInf.ArrangementOrder = ArrangementOrder.ArrangementOrderShieldWall;
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.MeleePosition:
                        Vec3 vec3_1 = -(this._attLeftInf.OrderPosition.Position - this._defRightInf.OrderPosition.Position);
                        Vec3 vec3_2 = -(this._attRightInf.OrderPosition.Position - this._defLeftInf.OrderPosition.Position);
                        vec3_1.RotateAboutZ((float)Math.PI / 36f);
                        vec3_2.RotateAboutZ(-1f * (float)Math.PI / 36f);
                        this._attLeftInf.MovementOrder  = MovementOrder.MovementOrderMove(new WorldPosition(this.Mission.Scene, this._attLeftInf.OrderPosition.Position + vec3_1));
                        this._attRightInf.MovementOrder = MovementOrder.MovementOrderMove(new WorldPosition(this.Mission.Scene, this._attRightInf.OrderPosition.Position + vec3_2));
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.Cav1Pos:
                        Vec3 position1  = this._attLeftRanged.OrderPosition.Position;
                        Vec2 direction1 = this._attLeftRanged.Direction;
                        Vec3 vec3_3     = position1 - 15f * direction1.ToVec3();
                        direction1.RotateCCW(1.570796f);
                        this._attLeftCav.MovementOrder = MovementOrder.MovementOrderMove(new WorldPosition(this.Mission.Scene, vec3_3 + 60f * direction1.ToVec3()));
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.Cav1PosDef:
                        MatrixFrame globalFrame1 = this.Mission.Scene.FindEntityWithTag("defend_right").GetGlobalFrame();
                        this._defMidCav.MovementOrder = MovementOrder.MovementOrderMove(new WorldPosition(this.Mission.Scene, globalFrame1.origin + 40f * globalFrame1.rotation.s));
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.CavalryPosition:
                        Vec3 position2  = this._attRightRanged.OrderPosition.Position;
                        Vec2 direction2 = this._attRightRanged.Direction;
                        Vec3 vec3_4     = position2 + 20f * direction2.ToVec3();
                        direction2.RotateCCW(-1.570796f);
                        this._attRightCav.MovementOrder = MovementOrder.MovementOrderMove(new WorldPosition(this.Mission.Scene, vec3_4 + 80f * direction2.ToVec3()));
                        this._attLeftInf.MovementOrder  = MovementOrder.MovementOrderCharge;
                        this._attRightInf.MovementOrder = MovementOrder.MovementOrderCharge;
                        this._defLeftBInf.FiringOrder   = FiringOrder.FiringOrderFireAtWill;
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.MeleeAttack:
                        this._defLeftInf.FiringOrder       = FiringOrder.FiringOrderFireAtWill;
                        this._defMidBInf.FiringOrder       = FiringOrder.FiringOrderFireAtWill;
                        this._defRightBInf.FiringOrder     = FiringOrder.FiringOrderFireAtWill;
                        this._attLeftInf.ArrangementOrder  = ArrangementOrder.ArrangementOrderLine;
                        this._attRightInf.ArrangementOrder = ArrangementOrder.ArrangementOrderLine;
                        this._attLeftInf.MovementOrder     = MovementOrder.MovementOrderMove(new WorldPosition(this.Mission.Scene, this._defRightInf.GetAveragePositionOfUnits(true, false).ToVec3()));
                        this._attRightInf.MovementOrder    = MovementOrder.MovementOrderMove(new WorldPosition(this.Mission.Scene, this._defLeftInf.GetAveragePositionOfUnits(true, false).ToVec3()));
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.RangedAdvance:
                        Vec2 averagePositionOfUnits1 = this._attLeftRanged.GetAveragePositionOfUnits(true, false);
                        Vec3 vec3_5 = averagePositionOfUnits1.ToVec3();
                        averagePositionOfUnits1 = this._attLeftRanged.GetAveragePositionOfUnits(true, false);
                        Vec3 vec3_6 = averagePositionOfUnits1.ToVec3();
                        averagePositionOfUnits1 = this._defRightInf.GetAveragePositionOfUnits(true, false);
                        Vec3 vec3_7    = averagePositionOfUnits1.ToVec3();
                        Vec3 vec3_8    = 0.15f * (vec3_6 - vec3_7);
                        Vec3 position3 = vec3_5 - vec3_8;
                        averagePositionOfUnits1 = this._attRightRanged.GetAveragePositionOfUnits(true, false);
                        Vec3 vec3_9 = averagePositionOfUnits1.ToVec3();
                        averagePositionOfUnits1 = this._attRightRanged.GetAveragePositionOfUnits(true, false);
                        Vec3 vec3_10 = averagePositionOfUnits1.ToVec3();
                        averagePositionOfUnits1 = this._defLeftInf.GetAveragePositionOfUnits(true, false);
                        Vec3 vec3_11   = averagePositionOfUnits1.ToVec3();
                        Vec3 vec3_12   = 0.15f * (vec3_10 - vec3_11);
                        Vec3 position4 = vec3_9 - vec3_12;
                        this._attLeftRanged.MovementOrder  = MovementOrder.MovementOrderMove(new WorldPosition(this.Mission.Scene, position3));
                        this._attRightRanged.MovementOrder = MovementOrder.MovementOrderMove(new WorldPosition(this.Mission.Scene, position4));
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.CavalryAdvance:
                        this.Mission.Scene.FindEntityWithTag("attacker_mid").GetGlobalFrame();
                        MatrixFrame globalFrame2 = this.Mission.Scene.FindEntityWithTag("defend_right").GetGlobalFrame();
                        this.Mission.Scene.FindEntityWithTag("defend_left").GetGlobalFrame();
                        Vec3 position5 = globalFrame2.origin + globalFrame2.rotation.s * 68f + 10f * this._attLeftRanged.Direction.ToVec3();
                        this._attLeftCav.MovementOrder = MovementOrder.MovementOrderMove(new WorldPosition(this.Mission.Scene, position5));
                        this._defMidCav.MovementOrder  = MovementOrder.MovementOrderMove(new WorldPosition(this.Mission.Scene, position5));
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.CavalryCharge:
                        MatrixFrame globalFrame3 = this.Mission.Scene.FindEntityWithTag("defend_left").GetGlobalFrame();
                        this._defLeftBInf.FacingOrder   = FacingOrder.FacingOrderLookAtDirection((this._attRightCav.CurrentPosition - this._defLeftBInf.CurrentPosition).Normalized());
                        this._defLeftBInf.MovementOrder = MovementOrder.MovementOrderMove(new WorldPosition(this.Mission.Scene, globalFrame3.origin - globalFrame3.rotation.s * 10f));
                        this._attRightCav.MovementOrder = MovementOrder.MovementOrderChargeToTarget(this._defLeftBInf);
                        this._attLeftCav.MovementOrder  = MovementOrder.MovementOrderChargeToTarget(this._attLeftInf);
                        this._defMidCav.MovementOrder   = MovementOrder.MovementOrderChargeToTarget(this._attRightInf);
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.CavalryCharge2:
                        this._attRightCav.MovementOrder    = MovementOrder.MovementOrderMove(new WorldPosition(this.Mission.Scene, this._defLeftBInf.OrderPosition.Position));
                        this._attLeftRanged.FiringOrder    = FiringOrder.FiringOrderFireAtWill;
                        this._attLeftRanged.MovementOrder  = MovementOrder.MovementOrderAdvance;
                        this._attRightRanged.FiringOrder   = FiringOrder.FiringOrderFireAtWill;
                        this._attRightRanged.MovementOrder = MovementOrder.MovementOrderAdvance;
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.RangedAdvance2:
                        Vec2 averagePositionOfUnits2 = this._attLeftRanged.GetAveragePositionOfUnits(true, false);
                        Vec3 vec3_13 = averagePositionOfUnits2.ToVec3();
                        averagePositionOfUnits2 = this._attLeftRanged.GetAveragePositionOfUnits(true, false);
                        Vec3 vec3_14 = averagePositionOfUnits2.ToVec3();
                        averagePositionOfUnits2 = this._defRightInf.GetAveragePositionOfUnits(true, false);
                        Vec3 vec3_15   = averagePositionOfUnits2.ToVec3();
                        Vec3 vec3_16   = 0.15f * (vec3_14 - vec3_15);
                        Vec3 position6 = vec3_13 - vec3_16;
                        averagePositionOfUnits2 = this._attRightRanged.GetAveragePositionOfUnits(true, false);
                        Vec3 vec3_17 = averagePositionOfUnits2.ToVec3();
                        averagePositionOfUnits2 = this._attRightRanged.GetAveragePositionOfUnits(true, false);
                        Vec3 vec3_18 = averagePositionOfUnits2.ToVec3();
                        averagePositionOfUnits2 = this._defLeftInf.GetAveragePositionOfUnits(true, false);
                        Vec3 vec3_19   = averagePositionOfUnits2.ToVec3();
                        Vec3 vec3_20   = 0.15f * (vec3_18 - vec3_19);
                        Vec3 position7 = vec3_17 - vec3_20;
                        this._attLeftRanged.MovementOrder  = MovementOrder.MovementOrderMove(new WorldPosition(this.Mission.Scene, position6));
                        this._attRightRanged.MovementOrder = MovementOrder.MovementOrderMove(new WorldPosition(this.Mission.Scene, position7));
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.FullCharge:
                        using (IEnumerator <Formation> enumerator = this.Mission.AttackerTeam.Formations.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                Formation current = enumerator.Current;
                                if (current != this._attLeftRanged && current != this._attRightRanged && current != this._attRightCav)
                                {
                                    current.MovementOrder = MovementOrder.MovementOrderCharge;
                                }
                            }
                            break;
                        }
                    }
                    this._isCurPhaseInPlay = true;
                }
                else
                {
                    switch (this._battlePhase)
                    {
                    case CPUBenchmarkMissionLogic.BattlePhase.ArrowShower:
                        if ((double)time <= 14.0)
                        {
                            break;
                        }
                        this._isCurPhaseInPlay = false;
                        this._battlePhase      = CPUBenchmarkMissionLogic.BattlePhase.MeleePosition;
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.MeleePosition:
                        if ((double)time <= 19.0)
                        {
                            break;
                        }
                        this._isCurPhaseInPlay = false;
                        this._battlePhase      = CPUBenchmarkMissionLogic.BattlePhase.MeleeAttack;
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.Cav1Pos:
                        if ((double)time <= 19.0)
                        {
                            break;
                        }
                        this._isCurPhaseInPlay = false;
                        this._battlePhase      = CPUBenchmarkMissionLogic.BattlePhase.Cav1PosDef;
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.Cav1PosDef:
                        if ((double)time <= 24.0)
                        {
                            break;
                        }
                        this._isCurPhaseInPlay = false;
                        this._battlePhase      = CPUBenchmarkMissionLogic.BattlePhase.CavalryAdvance;
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.CavalryPosition:
                        if ((double)time <= 74.5)
                        {
                            break;
                        }
                        this._isCurPhaseInPlay = false;
                        this._battlePhase      = CPUBenchmarkMissionLogic.BattlePhase.CavalryCharge;
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.MeleeAttack:
                        if ((double)time <= 19.0)
                        {
                            break;
                        }
                        this._isCurPhaseInPlay = false;
                        this._battlePhase      = CPUBenchmarkMissionLogic.BattlePhase.Cav1Pos;
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.RangedAdvance:
                        if ((double)time <= 60.0)
                        {
                            break;
                        }
                        this._isCurPhaseInPlay = false;
                        this._battlePhase      = CPUBenchmarkMissionLogic.BattlePhase.CavalryPosition;
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.CavalryAdvance:
                        if ((double)time <= 30.0)
                        {
                            break;
                        }
                        this._isCurPhaseInPlay = false;
                        this._battlePhase      = CPUBenchmarkMissionLogic.BattlePhase.RangedAdvance;
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.CavalryCharge:
                        if ((double)time <= 92.0)
                        {
                            break;
                        }
                        this._isCurPhaseInPlay = false;
                        this._battlePhase      = CPUBenchmarkMissionLogic.BattlePhase.CavalryCharge2;
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.CavalryCharge2:
                        if ((double)time <= 93.0)
                        {
                            break;
                        }
                        this._isCurPhaseInPlay = false;
                        this._battlePhase      = CPUBenchmarkMissionLogic.BattlePhase.RangedAdvance2;
                        break;

                    case CPUBenchmarkMissionLogic.BattlePhase.RangedAdvance2:
                        if ((double)time <= 94.0)
                        {
                            break;
                        }
                        this._isCurPhaseInPlay = false;
                        this._battlePhase      = CPUBenchmarkMissionLogic.BattlePhase.FullCharge;
                        break;
                    }
                }
            }
        }