Example #1
0
 private void ReactorsGenTick()
 {
     foreach (var reactor in PowerSupplySystem.Reactors)
     {
         if (LiquidSupplySystem.PipeLuquidFromTanks(LiquidType.Oil, reactor.OilRec))
         {
             PowerSupplySystem.ChargeBatteries(reactor.PowerOut);
         }
     }
 }
Example #2
0
        public void Move(int Ticks)
        {
            uint thrustPower = 0;

            foreach (var engine in RocketEngines)
            {
                if (PowerSupplySystem.CheckBatteries(engine.VToThrust) && LiquidSupplySystem.CheckTanks(engine.FuelType, engine.HToThrust))
                {
                    if (PowerSupplySystem.UnchargeBatteries(engine.ThrustPower) && LiquidSupplySystem.PipeLuquidFromTanks(engine.FuelType, engine.HToThrust))
                    {
                        thrustPower += engine.ThrustPower;
                    }
                }
            }

            X += thrustPower;
        }
Example #3
0
        //private static SimpleSpaceShip _ship;

        // #region Singleton
        //
        // public static SimpleSpaceShip Instance()
        // {
        //     if (_ship != null) return _ship;
        //
        //     _ship = new SimpleSpaceShip();
        //     return _ship;
        // }
        //
        // #endregion


        public SimpleSpaceShip()
        {
            PowerSupplySystem = new PowerSupplySystem()
            {
                Reactors = new List <ReactorBase> {
                    new SmallReactor()
                },
                Batteries = new List <BatteryBase> {
                    new SmallBattery(250), new SmallBattery(250)
                }
            };
            LiquidSupplySystem = new LiquidSupplySystem
            {
                Tanks = new List <TankBase <LiquidType> >
                {
                    new SmallTank(LiquidType.Hydrogenium, 500),
                    new SmallTank(LiquidType.Oil, 500)
                }
            };

            RocketEngines = new List <RocketEngineBase> {
                new SmallRocketEngine(), new SmallRocketEngine()
            };
        }