Exemple #1
0
        public static void ClassInit()
        {
            // initialize galaxy
            new Galaxy();
            Mod.Load(null);
            sys = new StarSystem(0);
            Galaxy.Current.StarSystemLocations.Add(new ObjectLocation <StarSystem>(sys, new Point()));

            // initialize empires
            empire      = new Empire();
            empire.Name = "Engi";

            // initialize components
            storageComp   = Mod.Current.ComponentTemplates.FindByName("Supply Storage I");
            supplyPerComp = storageComp.GetAbilityValue("Supply Storage").ToInt();

            // initialize ships
            Assert.IsNotNull(Mod.Current);
            var dsn1 = new Design <Ship>();

            dsn1.BaseName = "Shippy McShipface";
            dsn1.CreateHull();
            dsn1.Components.Add(new MountedComponentTemplate(dsn1, storageComp));
            dsn1.Owner  = empire;
            ship1       = dsn1.Instantiate();
            ship1.Owner = empire;
            var dsn2 = new Design <Ship>();

            dsn2.BaseName = "Shippy McShipface Mk2";
            dsn2.CreateHull();
            dsn2.Components.Add(new MountedComponentTemplate(dsn1, storageComp));
            dsn2.Components.Add(new MountedComponentTemplate(dsn1, storageComp));
            dsn2.Components.Add(new MountedComponentTemplate(dsn1, storageComp));
            dsn2.Owner  = empire;
            ship2       = dsn2.Instantiate();
            ship2.Owner = empire;

            // initialize fleet
            fleet       = new Fleet();
            fleet.Owner = empire;
            fleet.Vehicles.Add(ship1);
            fleet.Vehicles.Add(ship2);

            // place ships
            sys.Place(fleet, new Point());
        }