/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // graphics.ToggleFullScreen(); IsMouseVisible = true; // TODO: Add your initialization logic here //sets the game up to start in the menu gameState = GameState.Menu; menu = new Menu(); gameOver = new GameOver(); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); //initializes the barrier barrier = new Barrier(2); //secure that enemyPool has been started EnemyPool ep = EnemyPool.Instance; //adds objects to the map map = new Map(); //Creates the new spawner that spawns the waves spawner = new Spawn(Constant.width, Constant.hight); //creates a score to keep track of scores and stats score = new Score(); base.Initialize(); }
// initialise an enemy pool /// <summary> /// Initialise an enemy pool /// </summary> /// <param name="mediator"></param> /// <param name="level"></param> /// <returns></returns> public static EnemyPool GetInstance(int level, IAmMediator mediator) { if (_firstInstance == null) { _firstInstance = new EnemyPool(level, mediator); } return(_firstInstance); }