Пример #1
0
        public Level(Input input, TextureManager textureManager, PersistantGameData gameData)
        {
            _input          = input;
            _gameData       = gameData;
            _textureManager = textureManager;

            _background = new ScrollingBackground(textureManager.Get("background"));
            _background.SetScale(2, 2);
            _background.Speed = 0.15f;

            _backgroundLayer       = new ScrollingBackground(textureManager.Get("background_layer_1"));
            _backgroundLayer.Speed = 0.1f;
            _backgroundLayer.SetScale(2.0, 2.0);

            _playerCharacter = new PlayerCharacter(_textureManager, _bulletManager);

            _effectsManager = new EffectsManager(_textureManager);
            //  _enemyList.Add(new Enemy(_textureManager, _effectsManager)); <- Removed

            // -1300 is bad for two reasons
            // 1. It's a magic number in the middle of the code
            // 2. It's based on the size of the form but doesn't directly reference the size of the form
            // this means duplication and two places to edit the code if the form size changes.
            // The form size and the enemy manager play area size should both get their value
            // from one central place.
            _enemyManager = new EnemyManager(_textureManager, _effectsManager, -1300);
        }
Пример #2
0
        public Level(Input input, TextureManager textureManager, PersistantGameData gameData)
        {
            _input = input;
            _gameData = gameData;
            _textureManager = textureManager;

            _background = new ScrollingBackground(textureManager.Get("background"));
            _background.SetScale(2, 2);
            _background.Speed = 0.15f;

            _backgroundLayer = new ScrollingBackground(textureManager.Get("background_layer_1"));
            _backgroundLayer.Speed = 0.1f;
            _backgroundLayer.SetScale(2.0, 2.0);

            _playerCharacter = new PlayerCharacter(_textureManager, _bulletManager);

            _effectsManager = new EffectsManager(_textureManager);
            //  _enemyList.Add(new Enemy(_textureManager, _effectsManager)); <- Removed

            // -1300 is bad for two reasons
            // 1. It's a magic number in the middle of the code
            // 2. It's based on the size of the form but doesn't directly reference the size of the form
            // this means duplication and two places to edit the code if the form size changes.
            // The form size and the enemy manager play area size should both get their value
            // from one central place.
            _enemyManager = new EnemyManager(_textureManager, _effectsManager, -1300);
        }
        public Enemy(TextureManager textureManager, EffectsManager effectsManager)
        {
            _effectsManager = effectsManager;
            Health          = 50; // default health value.

            _sprite.Texture = textureManager.Get("enemy_ship");
            _sprite.SetScale(_scale, _scale);
            _sprite.SetRotation(Math.PI); // make it face the player
            _sprite.SetPosition(200, 0);  // put it somewhere easy to see
        }
Пример #4
0
        public Enemy(TextureManager textureManager, EffectsManager effectsManager)
        {
            _effectsManager = effectsManager;
            Health = 50; // default health value.

            _sprite.Texture = textureManager.Get("enemy_ship");
            _sprite.SetScale(_scale, _scale);
            _sprite.SetRotation(Math.PI); // make it face the player
            _sprite.SetPosition(200, 0); // put it somewhere easy to see
        }
Пример #5
0
        public EnemyManager(TextureManager textureManager, EffectsManager effectsManager, int leftBound)
        {
            _textureManager = textureManager;
            _effectsManager = effectsManager;
            _leftBound = leftBound;

            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 30));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 29.5));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 29));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 28.5));

            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 30));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 29.5));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 29));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 28.5));

            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 25));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 24.5));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 24));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 23.5));

            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 20));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 19.5));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 19));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 18.5));

            _upComingEnemies.Add(new EnemyDef("cannon_fodder_straight", 16));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_straight", 15.8));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_straight", 15.6));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_straight", 15.4));


            _upComingEnemies.Add(new EnemyDef("up_l", 10));
            _upComingEnemies.Add(new EnemyDef("down_l", 9));
            _upComingEnemies.Add(new EnemyDef("up_l", 8));
            _upComingEnemies.Add(new EnemyDef("down_l", 7));
            _upComingEnemies.Add(new EnemyDef("up_l", 6));



            // Sort enemies so the greater launch time appears first.
            _upComingEnemies.Sort(delegate(EnemyDef firstEnemy, EnemyDef secondEnemy)
            {
                return firstEnemy.LaunchTime.CompareTo(secondEnemy.LaunchTime);

            });

        }
        public EnemyManager(TextureManager textureManager, EffectsManager effectsManager, int leftBound)
        {
            _textureManager = textureManager;
            _effectsManager = effectsManager;
            _leftBound      = leftBound;

            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 30));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 29.5));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 29));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 28.5));

            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 30));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 29.5));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 29));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 28.5));

            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 25));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 24.5));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 24));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 23.5));

            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 20));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 19.5));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 19));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 18.5));

            _upComingEnemies.Add(new EnemyDef("cannon_fodder_straight", 16));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_straight", 15.8));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_straight", 15.6));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_straight", 15.4));


            _upComingEnemies.Add(new EnemyDef("up_l", 10));
            _upComingEnemies.Add(new EnemyDef("down_l", 9));
            _upComingEnemies.Add(new EnemyDef("up_l", 8));
            _upComingEnemies.Add(new EnemyDef("down_l", 7));
            _upComingEnemies.Add(new EnemyDef("up_l", 6));



            // Sort enemies so the greater launch time appears first.
            _upComingEnemies.Sort(delegate(EnemyDef firstEnemy, EnemyDef secondEnemy)
            {
                return(firstEnemy.LaunchTime.CompareTo(secondEnemy.LaunchTime));
            });
        }