Beispiel #1
0
        /// <summary>
        /// use this constructor for creating an 'Start' combat Object.
        /// </summary>
        /// <param name="start_v"></param>
        /// <param name="working_v"></param>
        /// <param name="battleseed"></param>
        /// <param name="OrigionalID">this should be the FrEee ID for the origional Vehicle</param>
        /// <param name="IDPrefix"></param>
        public CombatVehicle(Vehicle start_v, Vehicle working_v, int battleseed, long OrigionalID, string IDPrefix = "SHP")
            : base(start_v, working_v, new PointXd(0, 0, 0), new PointXd(0, 0, 0), battleseed, IDPrefix)
        {
            this.ID = OrigionalID;
            // TODO - don't some mods have vehicles >32MT?
            cmbt_mass         = (Fix16)working_v.Size;
            maxfowardThrust   = (Fix16)working_v.Speed * this.cmbt_mass * (Fix16)0.5;
            maxStrafeThrust   = ((Fix16)working_v.Speed * this.cmbt_mass * (Fix16)0.5) / ((Fix16)4 - (Fix16)working_v.Evasion * (Fix16)0.01);
            maxRotate.Degrees = ((Fix16)working_v.Speed * this.cmbt_mass * (Fix16)0.1) / ((Fix16)2.5 - (Fix16)working_v.Evasion * (Fix16)0.01);
            if (start_v.Design.Strategy == null)
            {
                strategy = new StragegyObject_Default();
            }
            else
            {
                strategy = start_v.Design.Strategy.Copy();
            }
            SpaceVehicle sv = (SpaceVehicle)start_v;

            //combatfleet = sv.Container.Name;
#if DEBUG
            Console.WriteLine("Created new CombatVehicle with ID " + ID);
            Console.WriteLine("MaxAccel = " + maxfowardThrust / cmbt_mass);
            //Console.WriteLine("Strategy: " + strategy
#endif
        }
Beispiel #2
0
        public override void renewtoStart()
        {
#if DEBUG
            Console.WriteLine("renewtoStart for CombatVehcile");
            Console.WriteLine(this.strID);
            Console.WriteLine(StartVehicle.Name);
#endif
            Vehicle ship = StartVehicle.Copy();
            ship.IsMemory = true;
            if (ship.Owner != StartVehicle.Owner && ship.Owner != null)
            {
                ship.Owner.Dispose();                 // don't need extra empires!
            }
            ship.Owner = StartVehicle.Owner;
#if DEBUG
            Console.WriteLine(ship.Name);
#endif
            // copy over the components individually so they can take damage without affecting the starting state
            ship.Components.Clear();
#if DEBUG
            Console.WriteLine("copying components");
#endif
            foreach (var comp in (StartVehicle.Components))
            {
                var ccopy = comp.Copy();
                ship.Components.Add(ccopy);
                ccopy.Container = ship;
#if DEBUG
                Console.WriteLine(ccopy.Name);
                Console.WriteLine("Container is " + ccopy.Container);
#endif
            }
#if DEBUG
            Console.WriteLine("Done");
#endif

            WorkingVehicle = ship;
            RefreshWeapons();

            foreach (var w in Weapons)
            {
                w.nextReload = 1;
            }

            base.renewtoStart();

            SpaceVehicle start_v = (SpaceVehicle)this.StartCombatant;
            if (start_v.Design.Strategy == null)
            {
                strategy = new StragegyObject_Default();
            }
            else
            {
                strategy = start_v.Design.Strategy.Copy();
            }
#if DEBUG
            Console.WriteLine("Done");
#endif
        }
Beispiel #3
0
        public static SpaceVehicle testShip(SimulatedEmpire emp, Design <Ship> design, int ID)
        {
            SimulatedSpaceObject simveh = new SimulatedSpaceObject((SpaceVehicle)design.Instantiate());

            simveh.SpaceObject.ID = ID;
            SpaceVehicle spaceveh = (SpaceVehicle)simveh.SpaceObject;

            spaceveh.Owner = emp.Empire;
            emp.SpaceObjects.Add(simveh);
            return(spaceveh);
        }
Beispiel #4
0
        public void setupEnvironment0()
        {
            location = new Sector(sys, new System.Drawing.Point());

            SimulatedEmpire simemp = new SimulatedEmpire(testships2.empire("TestEmpOne", new Culture(), new Race()));
            Design <Ship>   design = testships2.EscortDUC(gal, simemp.Empire, testships2.Components(gal));
            SpaceVehicle    sv     = testships2.testShip(simemp, design, 100);

            location.Place(sv);

            battle = new Battle_Space(location);
        }
        public void SetupEnvironment(double timeFrame, InitialConditionsDTO initConditions, VehicleType vehicleType)
        {
            TimeInterval = timeFrame;
            switch (vehicleType)
            {
            case VehicleType.SpaceShuttle:
                SpaceVehicle = new Shuttle(initConditions);
                break;

            case VehicleType.SpaceCapsule:
                SpaceVehicle = new Capsule(initConditions);
                break;
            }
            _timeLine = new List <TimeFrame>();
        }
Beispiel #6
0
        public void setupEnvironment1()
        {
            location = new Sector(sys, new System.Drawing.Point());

            SimulatedEmpire simemp0 = new SimulatedEmpire(testships2.empire("TestEmpOne", new Culture(), new Race()));
            SimulatedEmpire simemp1 = new SimulatedEmpire(testships2.empire("TestEmpTwo", new Culture(), new Race()));
            Design <Ship>   design0 = testships2.EscortCSM(gal, simemp0.Empire, testships2.Components(gal));
            Design <Ship>   design1 = testships2.EscortDUC(gal, simemp1.Empire, testships2.Components(gal));

            SpaceVehicle sv0 = testships2.testShip(simemp0, design0, 100);
            SpaceVehicle sv1 = testships2.testShip(simemp1, design1, 200);

            location.Place(sv0);
            location.Place(sv1);

            battle = new Battle_Space(location);
        }