//Constructor ----------------------------------------------------------------
 public MissleManager(Rectangle newViewPort, ContentManager content, SoundEffect sound, SpriteBatch spriteBatch, PlayerShip playerShip)
 {
     this.z_playerShip = playerShip;
     this.z_enemyManager = EnemyManager.getInstance(content, spriteBatch, newViewPort);
     this.z_FriendlyMissles = new List<MissleObject>();
     this.z_EnemyMissles = new List<MissleObject>();
     this.z_viewPort = newViewPort;
     this.z_friendlyMissleSprite1 = content.Load<Texture2D>("Content\\Images\\Missles\\Ball1");
     this.z_fireSound1 = sound;
     this.z_EnemyShipList = new List<IEnemyShip>();
     this.z_bulletPool = new BulletPool1(content, this.z_viewPort, this.z_playerShip, spriteBatch);
     this.z_enemyBulletPool1 = new EnemyBulletPool1(content, this.z_viewPort, spriteBatch);
     instanceOf = this;
 }
Пример #2
0
        //Constructor
        private EnemyManager(ContentManager content, SpriteBatch spriteBatch, Rectangle viewPort)
        {
            if (z_instance == null)
                z_instance = this;

            z_enemyShips = new List<IEnemyShip>();
            this.z_content = content;
            this.z_spriteBatch = spriteBatch;
            this.z_viewPort = viewPort;
            this.z_counter = 0;
            this.z_interval = 0;
            this.z_EnemiesSpawn = 0;

            // Initialize the enemy1 pool
            Enemy1.Initialize(this.z_content);
            EnemySimpleBullet.Initialize(this.z_content, this.z_viewPort);
            Asteroid.Initialize(this.z_content, Asteroid.AsteroidDensity.None);
            Explosion.Initialize();
        }
Пример #3
0
        public StageManager(SpriteBatch spriteBatch, Rectangle viewPort, ContentManager content)
        {
            this.z_isGameOver = false;
            this.z_spriteBatch = spriteBatch;
            z_viewportRec = viewPort;
            this.z_contentManager = content;

            z_objects = new List<GameObject>();

            z_objects.Add(new ScrollingBackground(this.z_contentManager.Load<Texture2D>("Content\\Textures\\Starscape4")));

            //Set the starting position for player's ship
            this.z_startingPosition = new Vector2(z_viewportRec.Center.X,
                                                    z_viewportRec.Height - 80);

            //Create the player ship
            this.z_playerShip = PlayerShip.getInstance(this.z_contentManager.Load<Texture2D>("Content\\Images\\ship1"),
                                               this.z_startingPosition);

            // create the mission manager
            this.z_missionManager = new MissionManager(z_contentManager);

            //Set the player alive
            this.z_playerShip.IsAlive = true;

            //Load the Music
            this.z_MarksSong = this.z_contentManager.Load<Song>("Content\\Audio\\Music\\ATreeFalls");
            MediaPlayer.IsRepeating = true;

            //Load Fonts
            this.z_timerFont = this.z_contentManager.Load<SpriteFont>("Content\\Fonts\\TimerFont");
            this.z_livesFont = this.z_contentManager.Load<SpriteFont>("Content\\Fonts\\LivesFont");

            FloatingText.Initialize(z_contentManager, "Content\\Fonts\\TimerFont");

            //Load Achivement Stuff
            this.z_achivementFail = new GameObject(this.z_contentManager.Load<Texture2D>("Content\\Images\\AchievementFailed"));
            this.z_achivementFail.IsAlive = false;
            this.z_achivementFail.Position = new Vector2((z_viewportRec.Width / 2) - (this.z_achivementFail.Sprite.Width / 2),
                                                            z_viewportRec.Height - 100);
            this.z_achievementSound = this.z_contentManager.Load<SoundEffect>("Content\\Audio\\SoundFX\\AchievementSound");

            //Load the Settings for the MissleManager
            this.z_missleManager = new MissleManager(this.z_contentManager, this.z_spriteBatch);

            //Load the Settings for the EnemyManager
            this.z_enemyManager = EnemyManager.getInstance(this.z_contentManager, this.z_spriteBatch, z_viewportRec);
        }
        public StageManager(SpriteBatch spriteBatch, Rectangle viewPort, ContentManager content)
        {
            this.z_isGameOver = false;
            this.z_spriteBatch = spriteBatch;
            this.z_viewportRec = viewPort;
            this.z_contentManager = content;

            this.z_backgroundManager = new ScrollingBackgroundManager(this.z_viewportRec);

            this.z_backgroundManager.loadImage1(this.z_contentManager.Load<Texture2D>("Content\\Textures\\spaceBackground"));
            this.z_backgroundManager.loadImage2(this.z_contentManager.Load<Texture2D>("Content\\Textures\\spaceBackground"));

            //Set the starting position for player's ship
            this.z_startingPosition = new Vector2(this.z_viewportRec.Center.X,
                                                    this.z_viewportRec.Height - 80);

            //Create the player ship
            this.z_playerShip = PlayerShip.getInstance(this.z_contentManager.Load<Texture2D>("Content\\Images\\ship1"),
                                               this.z_startingPosition);

            //Set the player alive
            this.z_playerShip.setIsAlive(true);

            //Load the Music
            this.z_MarksSong = this.z_contentManager.Load<Song>("Content\\Audio\\Music\\ATreeFalls");
            MediaPlayer.IsRepeating = true;

            //Load Fonts
            this.z_timerFont = this.z_contentManager.Load<SpriteFont>("Content\\Fonts\\TimerFont");
            this.z_livesFont = this.z_contentManager.Load<SpriteFont>("Content\\Fonts\\LivesFont");

            //Load Achivement Stuff
            this.z_achivementFail = new GameObject(this.z_contentManager.Load<Texture2D>("Content\\Images\\AchievementFailed"));
            this.z_achivementFail.setPosition(new Vector2((this.z_viewportRec.Width / 2) - (this.z_achivementFail.getSprite().Width / 2),
                                                            this.z_viewportRec.Height - 100));
            this.z_achievementSound = this.z_contentManager.Load<SoundEffect>("Content\\Audio\\SoundFX\\AchievementSound");

            //Load the Settings for the asteroidManager
            this.z_asteroidManager = new AsteroidManager(AsteroidManager.AsteroidManagerState.Lite, this.z_viewportRec,
                                                         this.z_contentManager, this.z_spriteBatch);

            //Load the Settings for the MissleManager
            this.z_missleManager = new MissleManager(this.z_viewportRec, this.z_contentManager,
                                                     this.z_contentManager.Load<SoundEffect>("Content\\Audio\\SoundFX\\LaserPellet"), this.z_spriteBatch, this.z_playerShip);

            //Load the Settings for the EnemyManager
            this.z_enemyManager = EnemyManager.getInstance(this.z_contentManager, this.z_spriteBatch, this.z_viewportRec);
        }
Пример #5
0
 public static EnemyManager getInstance(ContentManager content, SpriteBatch spriteBatch, Rectangle viewPort)
 {
     if (z_instance == null)
         z_instance = new EnemyManager(content, spriteBatch, viewPort);
     return z_instance;
 }
Пример #6
0
 //Accessors
 //Mutators
 // This function initializes the internal pool and loads in the image to use to create all the
 // 'Enemy1' type ships. It also creates a few enemies in the pool for fast retrieval.
 public static void Initialize(ContentManager content)
 {
     zs_pool = new List<Enemy1>();
     zs_enemyManager = EnemyManager.getInstance();
     zs_image = content.Load<Texture2D>("Content\\Images\\EnemyShips\\EnemyShip1");
     for (int i = 0; i < 5; i++)
     {
         zs_pool.Add(new Enemy1(zs_image, null));
     }
 }