Exemplo n.º 1
0
        protected override void Initialize()
        {
            _graphics.IsFullScreen = Config.IsFullScreen;
            _graphics.ApplyChanges();

            InitializeInputManager();

            _ship = Game.Objects.CreateShip(new Vector2(WorldWidth / 2, WorldHeight / 2), _world);
            _enemyShip = Game.Objects.CreateEnemyShip(new Vector2(Chaos.GetFloat(0, WorldWidth), Chaos.GetFloat(0, WorldHeight)), _world, _ship);
            _ship.HP = 100;
            _ship.MaxHP = 100;
            _enemyShip.HP = 100;
            _enemyShip.MaxHP = 100;
            _camera = new Camera(_ship);

            for (int i = 0; i < 100; ++i)
            {
                Asteroid asteroid = Game.Objects.CreateAsteroid();
                asteroid.Size = Chaos.GetFloat(20f, 80f);
                asteroid.Mass = asteroid.Size;
                asteroid.HP = (int)asteroid.Size / 8;
                asteroid.MaxHP = (int)asteroid.Size / 8;
                asteroid.Position = Chaos.GetVector2InRectangle(WorldWidth, WorldHeight);
                asteroid.Speed = Chaos.GetVector2InCenterRectangle(2f, 2f);
                asteroid.Rotation = Chaos.GetFloat(MathHelper.TwoPi);
                asteroid.RotationSpeed = Chaos.GetFloat(-.05f, .05f);
                _world.Add(asteroid);
            }

            for (int i = 0; i < 150; ++i)
            {
                SpeedBonus bonus = Game.Objects.CreateSpeedBonus(Chaos.GetVector2InRectangle(WorldWidth, WorldHeight));
                _world.Add(bonus);
            }

            for (int i = 0; i < 150; ++i)
            {
                Medkit medkit = Game.Objects.CreateMedkit(Chaos.GetVector2InRectangle(WorldWidth, WorldHeight));
                _world.Add(medkit);
            }

            _world.Add(_enemyShip);
            _world.Add(_ship);

            Components.Add(new FPS(this, Vector2.Zero));

            _worldLoopParticles.Clusterize(_particles.ParticlesList);
            _worldLoop.Clusterize(_world.GameObjects);

            base.Initialize();
        }
Exemplo n.º 2
0
 public void ReleaseEnemyShip(EnemyShip enemyShip)
 {
     _enemyShips.PutObject(enemyShip);
 }