public RealGame(int numberOfSections, int numPlayers, BlockBasedSceneGraph sceneGraph) { // setup Globals.gameInstance = this; this.sceneGraph = sceneGraph; // object to store collisions (the size of the world) cellCollider = new CellCollider(32, numberOfSections * 32); // holds links between current spawn populations, doors and lights campaignManager = new CampaignManager(numberOfSections); // now build all the shit WorldBuilder.Build(numberOfSections, Vector3.Zero); // now spawn all player players = new PlayerObject[numPlayers]; for (int i = 0; i < numPlayers; i++) { players[i] = new PlayerObject((i==0) ? PlayerIndex.One : PlayerIndex.Two, playerColours[i], spawns[i], MathHelper.ToRadians(-90)); } Globals.audioManager.SwitchToGame(); //Globals.audioManager.PlayGameSound("start_game"); Globals.audioManager.PlayGameSound("music"); }
public IProjectile CheckHit(PlayerObject player) { int i = alienProjectilePool.GetFirst(); while (i != -1) { AlienBullet b = alienProjectilePool.GetByIndex(i); if (Collider.Collide(player.collisionRectangle, b.GetCenter())) return b; i = alienProjectilePool.NextIndex(b); } return null; }
public bool CollideCurrentEntities(PlayerObject playerObject) { return sections[currentSection].CollideAliens(playerObject); }
public bool CollideAliens(PlayerObject playerObject) { for (int i = 0; i < _population.Count; i++) { BaseAlien ba = _population[i]; if (Collider.Collide(playerObject.collisionRectangle, ba._collisionRectangle)) { return true; } } return false; }