private void DetermineCurrentRegion() { if (CollisionDetection.IsRectInRect(Game.player.Bounds, highFenceOrbit.SpaceRegionArea)) { if (currentSpaceRegion != highFenceOrbit) { previousSpaceRegion = currentSpaceRegion; currentSpaceRegion = highFenceOrbit; currentSpaceRegion.OnEnter(); } } else if (CollisionDetection.IsRectInRect(Game.player.Bounds, fortrunOrbit.SpaceRegionArea)) { if (currentSpaceRegion != fortrunOrbit) { previousSpaceRegion = currentSpaceRegion; currentSpaceRegion = fortrunOrbit; currentSpaceRegion.OnEnter(); } } else if (CollisionDetection.IsRectInRect(Game.player.Bounds, newNorrlandOrbit.SpaceRegionArea)) { if (currentSpaceRegion != newNorrlandOrbit) { previousSpaceRegion = currentSpaceRegion; currentSpaceRegion = newNorrlandOrbit; currentSpaceRegion.OnEnter(); } } else if (CollisionDetection.IsRectInRect(Game.player.Bounds, soelaraOrbit.SpaceRegionArea)) { if (currentSpaceRegion != soelaraOrbit) { previousSpaceRegion = currentSpaceRegion; currentSpaceRegion = soelaraOrbit; currentSpaceRegion.OnEnter(); } } else if (CollisionDetection.IsRectInRect(Game.player.Bounds, lavisOrbit.SpaceRegionArea)) { if (currentSpaceRegion != lavisOrbit) { previousSpaceRegion = currentSpaceRegion; currentSpaceRegion = lavisOrbit; currentSpaceRegion.OnEnter(); } } else if (CollisionDetection.IsRectInRect(Game.player.Bounds, peyeOrbit.SpaceRegionArea)) { if (currentSpaceRegion != peyeOrbit) { previousSpaceRegion = currentSpaceRegion; currentSpaceRegion = peyeOrbit; currentSpaceRegion.OnEnter(); } } else if (CollisionDetection.IsRectInRect(Game.player.Bounds, sectorX.SpaceRegionArea)) { if (currentSpaceRegion != sectorX) { previousSpaceRegion = currentSpaceRegion; currentSpaceRegion = sectorX; currentSpaceRegion.OnEnter(); } } else if (CollisionDetection.IsRectInRect(Game.player.Bounds, outpostX.SpaceRegionArea)) { if (currentSpaceRegion != outpostX) { previousSpaceRegion = currentSpaceRegion; currentSpaceRegion = outpostX; currentSpaceRegion.OnEnter(); } } else if (CollisionDetection.IsRectInRect(Game.player.Bounds, borderXOutpost.SpaceRegionArea)) { if (currentSpaceRegion != borderXOutpost) { previousSpaceRegion = currentSpaceRegion; currentSpaceRegion = borderXOutpost; currentSpaceRegion.OnEnter(); } } else if (CollisionDetection.IsRectInRect(Game.player.Bounds, miningOutpost.SpaceRegionArea)) { if (currentSpaceRegion != miningOutpost) { previousSpaceRegion = currentSpaceRegion; currentSpaceRegion = miningOutpost; currentSpaceRegion.OnEnter(); } } else if (CollisionDetection.IsRectInRect(Game.player.Bounds, rebelOutpost.SpaceRegionArea)) { if (currentSpaceRegion != rebelOutpost) { previousSpaceRegion = currentSpaceRegion; currentSpaceRegion = rebelOutpost; currentSpaceRegion.OnEnter(); } } else { if (currentSpaceRegion != null) { previousSpaceRegion = currentSpaceRegion; previousSpaceRegion.OnLeave(); currentSpaceRegion = null; } } }
public override void Initialize() { planetarySystemSpriteSheet = new Sprite(Game.Content.Load <Texture2D>("Overworld-Sprites/planetarySystemSpritesheet")); shooterSheet = new Sprite(Game.Content.Load <Texture2D>("Vertical-Sprites/shooterSheet")); outpostSpriteSheet = new Sprite(Game.Content.Load <Texture2D>("Overworld-Sprites/OutpostSpriteSheet")); deepSpaceGameObjects = new List <GameObjectOverworld>(); garbageDeepSpaceGameObjects = new List <GameObjectOverworld>(); effectsObjects = new List <GameObjectOverworld>(); garbageEffectsObjects = new List <GameObjectOverworld>(); camera = new Camera(0, 0, 1, Game); camera.WorldWidth = OVERWORLD_WIDTH; camera.WorldHeight = OVERWORLD_HEIGHT; Game.camera = this.camera; // HUD HUD = new HeadsUpDisplay(this.Game); HUD.Initialize(planetarySystemSpriteSheet, new Vector2(OVERWORLD_WIDTH / 2, OVERWORLD_HEIGHT / 2), new Vector2(OVERWORLD_WIDTH, OVERWORLD_HEIGHT)); bGManagerOverworld = new BackgroundManagerOverworld(Game); bGManagerOverworld.Initialize(); beacons = new List <Beacon>(); // Sectors sectorX = new SectorX(Game); sectorX.Initialize(); outpostX = new OutpostX(Game, outpostSpriteSheet); outpostX.Initialize(); borderXOutpost = new BorderXOutpost(Game, outpostSpriteSheet); borderXOutpost.Initialize(); miningOutpost = new MiningOutpost(Game, outpostSpriteSheet); miningOutpost.Initialize(); rebelOutpost = new RebelOutpost(Game, outpostSpriteSheet); rebelOutpost.Initialize(); highFenceOrbit = new HighFenceOrbit(Game, outpostSpriteSheet); highFenceOrbit.Initialize(); fortrunOrbit = new FortrunOrbit(Game, outpostSpriteSheet); fortrunOrbit.Initialize(); newNorrlandOrbit = new NewNorrlandOrbit(Game, outpostSpriteSheet); newNorrlandOrbit.Initialize(); soelaraOrbit = new SoelaraOrbit(Game, outpostSpriteSheet); soelaraOrbit.Initialize(); lavisOrbit = new LavisOrbit(Game, outpostSpriteSheet); lavisOrbit.Initialize(); peyeOrbit = new PeyeOrbit(Game, outpostSpriteSheet); peyeOrbit.Initialize(); currentSpaceRegion = sectorX; // Misc objects peyeScienceStation = new PeyeScienceStation(Game, outpostSpriteSheet, GetPlanet("Peye").position); deepSpaceGameObjects.Add(peyeScienceStation); deepSpaceGameObjects.Add(new MediumAsteroid(Game, shooterSheet, new Vector2(82550, 117980))); deepSpaceGameObjects.Add(new MediumAsteroid(Game, shooterSheet, new Vector2(82520, 118000))); deepSpaceGameObjects.Add(new MediumAsteroid(Game, shooterSheet, new Vector2(82490, 118021))); deepSpaceGameObjects.Add(new MediumAsteroid(Game, shooterSheet, new Vector2(82552, 118050))); deepSpaceGameObjects.Add(new MediumAsteroid(Game, shooterSheet, new Vector2(82575, 118075))); ActiveSong = Music.SpaceAmbience; foreach (GameObjectOverworld obj in deepSpaceGameObjects) { obj.Initialize(); } foreach (Beacon beacon in beacons) { beacon.AddKnownBeacons(Game.stateManager.overworldState.GetAllOverworldGameObjects); } bGManagerOverworld.AddStar(planetarySystemSpriteSheet); burnOutEnding = new BurnOutEnding(Game, planetarySystemSpriteSheet); burnOutEnding.Initialize(); base.Initialize(); }