public void UpdateBoss(GameTime gameTime) { Player p = entities[0] as Player; if (!endingMove1) { if (p.Rotation.Y > MathHelper.ToRadians(140)) { p.rotate(new Vector3(0, -MathHelper.ToRadians(1), 0)); } else { endingMove1 = true; } } if (endingMove1 && !endingMove2) { endingMove2 = movePlayerToPos(p, new Vector3(p.Position.X, -850, p.Position.Z)); } if (endingMove1 && endingMove2 && !lastCharge) { timeToChargeShot = timeToChargeShot.Subtract(gameTime.ElapsedGameTime); if (timeToChargeShot.TotalSeconds <= 0) { cb = new ChargeBall(content, new Vector3(p.Position.X + 5, p.Position.Y, p.Position.Z - 5)); Add(cb); lastCharge = true; } } if (endingMove1 && endingMove2 && lastCharge && !lastShot) { if (cb.isDead) { Vector3 dir = new Vector3(285, p.Position.Y, -400) - p.Position; dir.Normalize(); dir /= 2; laser = new Laser(content, new Vector3(p.position.X, p.position.Y, p.position.Z), dir); Add(laser); p.CameraEnabled = false; Camera.Instance.rotateCameraPos(new Vector3(MathHelper.ToRadians(60), 0, 0)); lastShot = true; } } if (lastShot) { p.CameraEnabled = false; Camera.Instance.UpdateCamera(laser.Position, laser.Rotation); if (Vector3.Distance(new Vector3(285, p.Position.Y, -400), laser.Position) < 200) { levelEnded = true; } } //p.Position = new Vector3(285, -850, -200); CheckCollision(); levelWorldMat = Matrix.CreateScale(10) * Matrix.CreateRotationY(0) * Matrix.CreateTranslation(position); base.Update(gameTime); }
public Level1(ContentManager content, SpriteBatch sb) { levelEnded = false; lastShot = false; lastCharge = false; this.content = content; spriteBatch = sb; geometry = this.content.Load <Model>(@"levels/level1"); levelTexture = this.content.Load <Texture2D>(@"textures/levelTexture"); position = new Vector3(-45, -755, 8200); timeToResume = TimeSpan.FromSeconds(timeToResumeSeconds); switchedToBoss = false; switchedToMiniBoss = false; switchedToStart = false; switchedToClot = false; startGameZ = 7645; infectorZ = 2800; clotZ = 2200; thirdPersonZ = 650; preBossZ = 1300; reachedClotZ = false; infectorAdded = false; reachedPreBossZ = false; infectorDestroyed = false; movePreInfector = false; endingMove1 = endingMove2 = endingMove3 = false; velocity = Vector3.Zero; firstMove = false; secondMove = false; thirdMove = false; fourthMove = false; rotatedBehind = false; fifthMove = false; beginDescentZ = -430; reachedBoss = false; enemySpawner = new EnemySpawner(1, content); bossAdded = false; clotsAdded = false; firstStart = false; introRot1 = false; introRot2 = false; introRot3 = false; introRot4 = false; thirdPersonRot = false; thirdPersonTrans = false; setRot = false; setTrans = false; returnedToTopDown = false; enemiesReenabled = false; miniBoss = new Infector(content, new Vector3(0, 0, 250)); rightClot = new ClotSide(content, new Vector3(-60, 0, 20), Side.Right); leftClot = new ClotSide(content, new Vector3(60, 0, 20), Side.Left); preloadedStraightCell = new StraightCell(content, new Vector3(0, 500, 0)); preloadedLatchingCell = new LatchingCell(content, new Vector3(0, 500, 0), Vector3.Zero); preloadedChargingCell = new ChargingCell(content, new Vector3(0, 500, 0), Vector3.Zero); preloadedMeleeBot = new MeleeBot(content, new Vector3(0, 500, 0), Vector3.Zero); preloadedMissileBot = new MissileBot(content, new Vector3(0, 500, 0), Vector3.Zero); preloadedTokenPickup = new TokenPickup(content, new Vector3(0, 500, 0)); preloadedMissile = new Missle(content, Vector3.Zero, Vector3.Zero); preloadedBotMissile = new BotMissile(content, Vector3.Zero, Vector3.Zero); preloadedNeedle = new Needle(content, Vector3.Zero, Vector3.Zero); preloadedLaser = new Laser(content, Vector3.Zero, Vector3.Zero); preloadedExplosion = new Explosion(0, 0, 0, Vector3.Zero, content, false); preloadedChargeBall = new ChargeBall(content, Vector3.Zero); clotsDestroyed = false; Camera.Instance.setPosition(new Vector3(-7, 7, 7)); }
public Level1(ContentManager content, SpriteBatch sb) { levelEnded = false; lastShot = false; lastCharge = false; this.content = content; spriteBatch = sb; geometry = this.content.Load<Model>(@"levels/level1"); levelTexture = this.content.Load<Texture2D>(@"textures/levelTexture"); position = new Vector3(-45, -755, 8200); timeToResume = TimeSpan.FromSeconds(timeToResumeSeconds); switchedToBoss = false; switchedToMiniBoss = false; switchedToStart = false; switchedToClot = false; startGameZ = 7645; infectorZ = 2800; clotZ = 2200; thirdPersonZ = 650; preBossZ = 1300; reachedClotZ = false; infectorAdded = false; reachedPreBossZ = false; infectorDestroyed = false; movePreInfector = false; endingMove1 = endingMove2 = endingMove3 = false; velocity = Vector3.Zero; firstMove = false; secondMove = false; thirdMove = false; fourthMove = false; rotatedBehind = false; fifthMove = false; beginDescentZ = -430; reachedBoss = false; enemySpawner = new EnemySpawner(1, content); bossAdded = false; clotsAdded = false; firstStart = false; introRot1 = false; introRot2 = false; introRot3 = false; introRot4 = false; thirdPersonRot = false; thirdPersonTrans = false; setRot = false; setTrans = false; returnedToTopDown = false; enemiesReenabled = false; miniBoss = new Infector(content, new Vector3(0, 0, 250)); rightClot = new ClotSide(content, new Vector3(-60, 0, 20), Side.Right); leftClot = new ClotSide(content, new Vector3(60, 0, 20), Side.Left); preloadedStraightCell = new StraightCell(content, new Vector3(0, 500, 0)); preloadedLatchingCell = new LatchingCell(content, new Vector3(0, 500, 0), Vector3.Zero); preloadedChargingCell = new ChargingCell(content, new Vector3(0, 500, 0), Vector3.Zero); preloadedMeleeBot = new MeleeBot(content, new Vector3(0, 500, 0), Vector3.Zero); preloadedMissileBot = new MissileBot(content, new Vector3(0, 500, 0), Vector3.Zero); preloadedTokenPickup = new TokenPickup(content, new Vector3(0, 500, 0)); preloadedMissile = new Missle(content, Vector3.Zero, Vector3.Zero); preloadedBotMissile = new BotMissile(content, Vector3.Zero, Vector3.Zero); preloadedNeedle = new Needle(content, Vector3.Zero, Vector3.Zero); preloadedLaser = new Laser(content, Vector3.Zero, Vector3.Zero); preloadedExplosion = new Explosion(0, 0, 0, Vector3.Zero, content, false); preloadedChargeBall = new ChargeBall(content, Vector3.Zero); clotsDestroyed = false; Camera.Instance.setPosition(new Vector3(-7, 7, 7)); }
public virtual void Update(GameTime gameTime) { Player p = entities[0] as Player; if (p.SwitchedFromShield) { for (int j = 0; j < entities.Count; j++) { if (entities[j] is Shield) { entities.Remove(entities[j]); j = 0; } } p.SwitchedFromShield = false; } for (int i = 0; i < entities.Count; i++) { if (!entities[i].isDead) { if (entities[i] is ChargeBall) { ChargeBall cb = entities[i] as ChargeBall; cb.Update(gameTime, p.Position, p.Rotation); } if (entities[i] is Laser) { Laser l = entities[i] as Laser; l.Update(gameTime, p.Position, p.Rotation); } if (entities[i] is Boss) { Boss b = entities[i] as Boss; b.Update(gameTime, p.Position); } if (entities[i] is ClotSide) { ClotSide cs = entities[i] as ClotSide; cs.Update(gameTime, velocity); } if (entities[i] is Infector) { Infector inf = entities[i] as Infector; inf.Update(gameTime, p.Position); } if (entities[i] is TokenPickup) { TokenPickup tp = entities[i] as TokenPickup; tp.Update(gameTime); } if (entities[i] is PlayerWeapon) { PlayerWeapon w = entities[i] as PlayerWeapon; w.Update(gameTime, p.Position, p.Rotation); } if (entities[i] is BotWeapon) { BotWeapon bw = entities[i] as BotWeapon; bw.Update(gameTime, p.Position, p.Rotation); } if (entities[i] is Shield) { Shield s = entities[i] as Shield; s.Update(gameTime, p.Velocity, p.controls.isPlayerFiring()); } if (entities[i] is LatchingCell || entities[i] is MeleeBot || entities[i] is MissileBot) { if (entities[i] is LatchingCell) { LatchingCell lc = entities[i] as LatchingCell; lc.Update(gameTime, p.Position); } else if (entities[i] is MeleeBot) { MeleeBot mb = entities[i] as MeleeBot; mb.Update(gameTime, p.Position); } else { MissileBot missBot = entities[i] as MissileBot; missBot.Update(gameTime, p.Position); } } entities[i].Update(gameTime); } else { if (entities[i] is EnemiesAndPlayer) { EnemiesAndPlayer ep = entities[i] as EnemiesAndPlayer; if (ep.killedBy()) { p.addScore(ep.Score); p.AddPowerup(15); if (ep is MeleeBot || ep is MissileBot) { if (random.Next(2) == 0) { Add(new TokenPickup(content, ep.Position)); } } } } entities.Remove(entities[i]); } } }
public void UpdateBoss(GameTime gameTime) { Player p = entities[0] as Player; if (!endingMove1) { if (p.Rotation.Y > MathHelper.ToRadians(140)) { p.rotate(new Vector3(0, -MathHelper.ToRadians(1), 0)); } else endingMove1 = true; } if (endingMove1 && !endingMove2) { endingMove2 = movePlayerToPos(p, new Vector3(p.Position.X, -850, p.Position.Z)); } if (endingMove1 && endingMove2 && !lastCharge) { timeToChargeShot = timeToChargeShot.Subtract(gameTime.ElapsedGameTime); if (timeToChargeShot.TotalSeconds <= 0) { cb = new ChargeBall(content, new Vector3(p.Position.X + 5, p.Position.Y, p.Position.Z - 5)); Add(cb); lastCharge = true; } } if (endingMove1 && endingMove2 && lastCharge && !lastShot) { if (cb.isDead) { Vector3 dir = new Vector3(285, p.Position.Y, -400) - p.Position; dir.Normalize(); dir /= 2; laser = new Laser(content, new Vector3(p.position.X, p.position.Y, p.position.Z), dir); Add(laser); p.CameraEnabled = false; Camera.Instance.rotateCameraPos(new Vector3(MathHelper.ToRadians(60), 0, 0)); lastShot = true; } } if (lastShot) { p.CameraEnabled = false; Camera.Instance.UpdateCamera(laser.Position, laser.Rotation); if (Vector3.Distance(new Vector3(285, p.Position.Y, -400), laser.Position) < 200) { levelEnded = true; } } //p.Position = new Vector3(285, -850, -200); CheckCollision(); levelWorldMat = Matrix.CreateScale(10) * Matrix.CreateRotationY(0) * Matrix.CreateTranslation(position); base.Update(gameTime); }