Beispiel #1
0
 protected override void InicializeFields(WindVane windVane)
 {
     ShipCrew     = new ShipCrew(10, 24, 16, 8);
     Name         = "Corvette";
     ShipWeight   = 1000;
     Health       = 2000f;
     ShipSupplies = new Supplies(new Cannons(4, 4, 2, 2), new ShipHold(), new Sails(), windVane);
 }
Beispiel #2
0
        protected ShipBase(Player player, WindVane windVane)
        {
            Player = player;
            var rnd = new Random();

            // Init random direction
            _moveVector = new Vector2((float)rnd.NextDouble() - 0.5f, (float)rnd.NextDouble() - 0.5f);
            _moveVector.Normalize();

            // Init random coordinates
            _coordinates      = new Vector2(200, 600);
            _isEnableForShoot = true;

            UpdateCoordinatesTimer = new Timer(UpdateCoordinates, null, 1000, 50);
        }
Beispiel #3
0
        public GameSession(GameDescription gameDescription)
        {
            #region инициализация объектов

            WindVane             = new WindVane(true);
            GameLevel            = new GameLevel(Constants.LevelWidth, Constants.LevelHeigh);
            LocalGameDescription = gameDescription;
            StaticObjects        = InitializeBorders();
            _ships              = InitializeShips();
            _bullets            = new List <IBullet>();
            _updateObjectsTimer = new Timer(UpdateObjects, null, 1000, 25);
            _gameTimer          = new System.Timers.Timer();

            #endregion

            Start();
        }
Beispiel #4
0
        void Initialize()
        {
            Console.WriteLine("Initialize hardware...");

            onboardLed = new RgbPwmLed(device: Device,
                                       redPwmPin: Device.Pins.OnboardLedRed,
                                       greenPwmPin: Device.Pins.OnboardLedGreen,
                                       bluePwmPin: Device.Pins.OnboardLedBlue,
                                       3.3f, 3.3f, 3.3f,
                                       Meadow.Peripherals.Leds.IRgbLed.CommonType.CommonAnode);

            // initialize the wind vane driver
            windVane          = new WindVane(Device, Device.Pins.A00);
            windVane.Updated += WindVane_Updated;
            windVane.Subscribe(new FilterableChangeObserver <WindVane.WindVaneChangeResult, Azimuth>(
                                   handler: result => { Console.WriteLine($"Wind Direction: {result.New.Compass16PointCardinalName}"); },
                                   filter: null
                                   ));

            Console.WriteLine("Initialization complete.");
        }
 public ClientWindVane()
 {
     WindVane      = new WindVane(false);
     StaticTexture = Textures.CompassArrow;
 }
Beispiel #6
0
 public Corvette(Player player, WindVane windVane)
     : base(player, windVane)
 {
     InicializeFields(windVane);
 }
Beispiel #7
0
 protected abstract void InicializeFields(WindVane windVane);