Beispiel #1
0
        private FormationDeploymentOrder(FormationClass formationClass, int offset = 0)
        {
            int formationClassPriority = FormationDeploymentOrder.GetFormationClassPriority(formationClass);

            this.Offset = Math.Max(0, offset);
            this.Key    = formationClassPriority + this.Offset * 11;
        }
Beispiel #2
0
        public void PlanFieldBattleDeploymentAtPosition(
            Vec2 deployPosition,
            Vec2 deployDirection,
            bool isReinforcement = false)
        {
            for (int index = 0; index < this._formationDeploymentPlans.Length; ++index)
            {
                int formationTroopCount = this._formationTroopCounts[index];
                FormationDeploymentPlan  formationDeploymentPlan = this._formationDeploymentPlans[index];
                FormationDeploymentFlank defaultFlank            = formationDeploymentPlan.GetDefaultFlank(this.SpawnWithHorses);
                (float width2, float depth2) = MissionDeploymentPlan.GetFormationSpawnWidthAndDepth(formationDeploymentPlan.Class, formationTroopCount, !this.SpawnWithHorses);
                formationDeploymentPlan.SetPlannedDimensions(width2, depth2);
                formationDeploymentPlan.SetPlannedTroopCount(formationTroopCount);
                int offset = formationTroopCount > 0 ? 0 : 1;
                FormationDeploymentOrder deploymentOrder = formationDeploymentPlan.GetDeploymentOrder(offset);
                this._deploymentFlanks[(int)defaultFlank].Add(deploymentOrder, formationDeploymentPlan);
            }
            (float flankWidth, float flankDepth)tuple = this.PlanFlankDeployment(FormationDeploymentFlank.Front, deployPosition, deployDirection, isReinforcement: isReinforcement);
            float flankWidth1       = tuple.flankWidth;
            float verticalOffset1   = tuple.flankDepth + 3f;
            float flankWidth2       = this.PlanFlankDeployment(FormationDeploymentFlank.Rear, deployPosition, deployDirection, verticalOffset1, isReinforcement: isReinforcement).flankWidth;
            float num               = Math.Max(flankWidth1, flankWidth2);
            float verticalOffset2   = this.ComputeFlankDepth(FormationDeploymentFlank.Front, true) + 3f;
            float flankWidth3       = this.ComputeFlankWidth(FormationDeploymentFlank.Left);
            float horizontalOffset1 = (float)(2.0 + 0.5 * ((double)num + (double)flankWidth3));

            this.PlanFlankDeployment(FormationDeploymentFlank.Left, deployPosition, deployDirection, verticalOffset2, horizontalOffset1, isReinforcement);
            float flankWidth4       = this.ComputeFlankWidth(FormationDeploymentFlank.Right);
            float horizontalOffset2 = (float)(-1.0 * (2.0 + 0.5 * ((double)num + (double)flankWidth4)));

            this.PlanFlankDeployment(FormationDeploymentFlank.Right, deployPosition, deployDirection, verticalOffset2, horizontalOffset2, isReinforcement);
            for (int index = 0; index < this._deploymentFlanks.Length; ++index)
            {
                this._deploymentFlanks[index].Clear();
            }
        }
Beispiel #3
0
 public FormationDeploymentOrder GetDeploymentOrder(int offset = 0) => FormationDeploymentOrder.GetDeploymentOrder(this.Class, offset);
Beispiel #4
0
 public BattleSideDeploymentPlan(BattleSideEnum side)
 {
     this.Side            = side;
     this.SpawnWithHorses = false;
     for (int index = 0; index < this._formationDeploymentPlans.Length; ++index)
     {
         FormationClass fClass = (FormationClass)index;
         this._formationDeploymentPlans[index] = new FormationDeploymentPlan(fClass);
     }
     for (int index = 0; index < 4; ++index)
     {
         this._deploymentFlanks[index] = new SortedList <FormationDeploymentOrder, FormationDeploymentPlan>((IComparer <FormationDeploymentOrder>)FormationDeploymentOrder.GetComparer());
     }
     this.ClearTroops();
     this.ClearPlan();
 }