コード例 #1
0
        public static Military Create(GameScenario scenario, Architecture architecture, MilitaryKind kind)
        {
            Military military = new Military();

            military.Scenario = scenario;
            military.KindID   = kind.ID;
            military.ID       = scenario.Militaries.GetFreeGameObjectID();
            if (kind.Unique)
            {
                military.Name = kind.Name;
            }
            else
            {
                military.Name = kind.Name + "队";
            }
            architecture.AddMilitary(military);
            architecture.BelongedFaction.AddMilitary(military);
            scenario.Militaries.AddMilitary(military);
            architecture.DecreaseFund((int)(kind.CreateCost * kind.GetRateOfNewMilitary(architecture)));
            if (kind.IsTransport)
            {
                military.Quantity    = kind.MaxScale;
                military.Morale      = military.MoraleCeiling;
                military.Combativity = military.CombativityCeiling;
            }
            return(military);
        }