public void LoadGame() { _enemy_managers.Clear(); _gameoverscreen = null; _hp50_root = null; _hp250_root = null; _bullet_manager = null; _player = null; _bullet_hits_enemy = null; _energy_storage_manager = null; _portal_manager = null; _wave_manager = null; _background_manager = null; _powerup_manager = null; #region HealthBar LoadContent _hp50_root = new HealthBar( _tstorage["hp_50"], 50, 4 ); _hp250_root = new HealthBar( _tstorage["hp_250"], 250, 6 ); #endregion #region BackgroundManager LoadContent _background_manager = new BackgroundManager ( _fstorage["hs_wave"], new Vector2(1680, 72), new Vector2(1770, 23) ); _background_manager.AddTexture ( _tstorage["map"], new Vector2(0, 0) ); _background_manager.AddTexture ( _tstorage["highscore_wave"], new Vector2(WIDTH - 360, 0) ); _background_manager.AddTexture ( _tstorage["left_energy_hp"], new Vector2(WIDTH / 4, 0) ); _background_manager.AddTexture ( _tstorage["right_energy_hp"], new Vector2(WIDTH / 4 * 2, 0) ); #endregion #region MainScreen PortalManager List <Vector2> portal_location = new List <Vector2>() { new Vector2(700, 60), new Vector2(1750, 300), new Vector2(80, 850), new Vector2(750, 850) }; _portal_manager = new PortalManager( _tstorage["portal_vecji"], 133, 150 ); foreach (var a in portal_location) { _portal_manager.AddPortal(a); } #endregion #region EnergyStorageManager LoadContent _energy_storage_manager = new EnergyStorageManager( _tstorage["energy_point"], 214, 200, _hp250_root ); _energy_storage_manager.Add ( new Vector2(250, 300), new Vector2((WIDTH / 4) + 35, 40), 2000 ); _energy_storage_manager.Add ( new Vector2(1000, 500), new Vector2((WIDTH / 4 * 2) + 35, 40), 2000 ); #endregion #region EnemyManager LoadContent _enemy_managers.Add("enemy1", new EnemyManager( ref _portal_manager, ref _energy_storage_manager, _tstorage["enemy_1"], _hp50_root, 48, 50, 30, 150, 7, 4 )); _enemy_managers.Add("enemy2", new EnemyManager( ref _portal_manager, ref _energy_storage_manager, _tstorage["enemy_2"], _hp50_root, 50, 50, 30, 200, 8, 5 )); _enemy_managers.Add("enemy3", new EnemyManager( ref _portal_manager, ref _energy_storage_manager, _tstorage["enemy_3"], _hp50_root, 104, 110, 30, 500, 2, 2 )); _enemy_managers.Add("enemy4", new EnemyManager( ref _portal_manager, ref _energy_storage_manager, _tstorage["enemy_4"], _hp50_root, 55, 100, 30, 300, 8, 5 )); #endregion #region BulletManager LoadContent _bullet_manager = new BulletManager( _tstorage["okrogel_metek6"], win_size ); #endregion #region Player LoadContent _player = new Player( _tstorage["player"], win_size, new Vector2(700, 500), 60, 50, 40 ); #endregion #region BulletHitsEnemy LoadContent _bullet_hits_enemy = new BulletHitsEnemy( ref _enemy_managers, ref _bullet_manager, ref _player, _fstorage["DamageFont"], _tstorage["mini_explosion"] ); #endregion #region WaveManager LoadContent _wave_manager = new WaveManager(ref _enemy_managers, 5000, 1000); #endregion #region PowerupManager LoadContent List <Rectangle> spawn_locs = new List <Rectangle>() { new Rectangle(100, 100, 250, 150), new Rectangle(100, 600, 800, 200), new Rectangle(900, 200, 600, 250), new Rectangle(1300, 700, 400, 200) }; _powerup_manager = new PowerupManager(10000, spawn_locs); _powerup_manager.AddPowerup ( _tstorage["damage_pu"], 34, 50, 10, PowerupManager.PowerUpType.PUT_PWR ); _powerup_manager.AddPowerup ( _tstorage["health_pu"], 35, 50, 8, PowerupManager.PowerUpType.PUT_HP ); #endregion _state = CGameState.Playing; }
protected void Start() { _portalManager.AddPortal(this); }