public GameLevel1(SpaceGame game) : base(game) { /*Neutral Objects*/ asteroids = new Asteroids(game); backgroundAsteroids = new Asteroids(game); backgroundPlanets = new Planets(game); //aircrafts = new Aircrafts(game); bullets = new Bullets(game); /*Players*/ player1 = new Player1(game); player2 = new Player2(game); pilots = new Pilots(game); // questStage = Level1Quests.START; questStage = Level1Quests.ENEMYFOCUS; startQuest = false; StartQuestTime = 0; destroyedAsteroids = 0; destroyedEnemyAircraft = 0; }
public override void Update(GameTime gameTime) { switch (questStage) { case Level1Quests.START: if (!startQuest) { game.uICombat.controlInformation.AddText("Welcome to the 3D XNA demo!", Color.White); startQuest = true; } if (startQuest && game.uICombat.controlInformation.totalTime > 3) { questStage = Level1Quests.WEAPON; startQuest = false; } break; case Level1Quests.WEAPON: if (!startQuest) { game.uICombat.controlInformation.AddText("Laser Test: Use your left mouse to shoot a laser.", Color.White); startQuest = true; player1.mouseController.firedWeapon = false; } if (startQuest && player1.mouseController.firedWeapon) { game.uICombat.controlInformation.AddText("Good! Our weapon looks in good condition!", Color.White); questStage = Level1Quests.MAXTHRUST; startQuest = false; } break; case Level1Quests.MAXTHRUST: if (!startQuest) { game.uICombat.controlInformation.AddText("Engine Test: Press left ctrl multiple times to increase thrust to maximum.", Color.White); startQuest = true; } if (startQuest && player1.aircraft.UserThrust == player1.aircraft.CurrentThrust) { game.uICombat.controlInformation.AddText("Exellent! Our ship is running in maximum thrust!", Color.White); questStage = Level1Quests.MINTHRUST; startQuest = false; } break; case Level1Quests.MINTHRUST: if (!startQuest) { game.uICombat.controlInformation.AddText("Engine Test: Use left alt to completely shutdown the engine.", Color.White); startQuest = true; } if (startQuest && player1.aircraft.UserThrust == -player1.aircraft.CurrentThrust) { game.uICombat.controlInformation.AddText("Great! We successfully docked our ship.", Color.White); questStage = Level1Quests.ZOOMIN; startQuest = false; } break; case Level1Quests.ZOOMIN: if (!startQuest) { game.uICombat.controlInformation.AddText("Use the mouse scroll wheel to zoom in.", Color.White); startQuest = true; } if (startQuest && game.uICombat.GlobalCamera.cameraLevel == game.uICombat.GlobalCamera.MinCameraLevel) { game.uICombat.controlInformation.AddText("Good!", Color.White); questStage = Level1Quests.ZOOMOUT; startQuest = false; } break; case Level1Quests.ZOOMOUT: if (!startQuest) { game.uICombat.controlInformation.AddText("Use the mouse scroll wheel to zoom out.", Color.White); startQuest = true; } if (startQuest && game.uICombat.GlobalCamera.cameraLevel == game.uICombat.GlobalCamera.MaxCameraLevel) { game.uICombat.controlInformation.AddText("Great!", Color.White); questStage = Level1Quests.ASTEROID; startQuest = false; } break; case Level1Quests.ASTEROID: if (!startQuest) { startQuest = true; game.uICombat.controlInformation.AddText("Commander, we have detected many asteroids around us. Destroy them so we can move to a safe zone.", Color.White); int x = (int)player1.aircraft.Position.X; int y = (int)player1.aircraft.Position.Y; commandLine = "ADD ASTEROID 400 " + x.ToString() + "," + y.ToString() + " 100,5000"; updateCommand(); } if (startQuest && destroyedAsteroids >= 10) { game.uICombat.controlInformation.AddText("We have destroyed enough asteroids so we can escape!", Color.White); questStage = Level1Quests.ENEMYFOCUS; startQuest = false; } break; case Level1Quests.ENEMYFOCUS: if (!startQuest) { StartQuestTime = game.uICombat.controlInformation.totalTime; game.uICombat.controlInformation.AddText("Warning! We detected an enemy spacecraft coming for us. Prepare for battle!", Color.White); startQuest = true; int x = (int)player1.aircraft.Position.X - 2000; int y = (int)player1.aircraft.Position.Y; commandLine = "ADD ENEMYXWING 1 " + x.ToString() + "," + y.ToString(); int enemyPilotIndex = updateCommand(); game.uICombat.GlobalCamera.Focus = enemyPilotIndex; game.uICombat.GlobalCamera.UpdateCameralLevel(3); } if (startQuest && game.uICombat.controlInformation.totalTime > StartQuestTime + 10) { questStage = Level1Quests.ENEMY; startQuest = false; } break; case Level1Quests.ENEMY: if (!startQuest) { startQuest = true; game.uICombat.GlobalCamera.Focus = 0; } if (startQuest && destroyedEnemyAircraft >= 1) { game.uICombat.controlInformation.AddText("We destroyed the enemy spacecraft!", Color.White); questStage = Level1Quests.ENEMYTEAMFOCUS; startQuest = false; } break; case Level1Quests.ENEMYTEAMFOCUS: if (!startQuest) { StartQuestTime = game.uICombat.controlInformation.totalTime; game.uICombat.controlInformation.AddText("Warning! We detected an enemy squad nearby. We should evade them and wait for reinforcement.", Color.White); startQuest = true; int x = (int)player1.aircraft.Position.X - 2000; int y = (int)player1.aircraft.Position.Y; commandLine = "ADD ENEMYXWINGTEAM 10 " + x.ToString() + "," + y.ToString(); int enemyPilotIndex = updateCommand(); game.uICombat.GlobalCamera.Focus = enemyPilotIndex; game.uICombat.GlobalCamera.UpdateCameralLevel(4); } if (startQuest && game.uICombat.controlInformation.totalTime > StartQuestTime + 60) { questStage = Level1Quests.ENEMYTEAM; startQuest = false; } break; case Level1Quests.ENEMYTEAM: if (!startQuest) { startQuest = true; game.uICombat.GlobalCamera.Focus = 0; } break; case Level1Quests.COMPLETE: break; default: break; } if (!isPaused && !isInEquip) { asteroids.Update(gameTime); bullets.Update(gameTime); } pilots.Update(gameTime, isPaused, isInEquip); //if (!isPaused && !isInEquip) //{ // aircrafts.Update(gameTime); //} }