/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { this.Exit(); } if (Keyboard.GetState().IsKeyDown(Keys.Q)) { Exit(); } // TODO: Add your update logic here p.update(gameTime); for (int i = 0; i < n.Count(); i++) { if (n[i].update(gameTime, p.area)) { // Write Cop Captured Code Here. Console.WriteLine("It works!!! "); score += 100; } } /**/ // how often hacks are providing results if (gameTime.TotalGameTime - previousUpdateTime > updateTime) { previousUpdateTime = gameTime.TotalGameTime; if (random.Next(100) < 50) { //score += 100; } // } /**/ scoretext.Update("Score: " + score); bottomtext.Update(); sidetext.Update(); scoretext.Update(); base.Update(gameTime); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { this.Exit(); } if (Keyboard.GetState().IsKeyDown(Keys.Q)) { Exit(); } // TODO: Add your update logic here if (pause == true) { if (Keyboard.GetState().IsKeyDown(Keys.Enter)) { pause = false; } } else { p.update(gameTime); for (int i = 0; i < n.Count(); i++) { n[i].update(gameTime); } /**/ int userOne = 0; int passOne = 0; if (gameTime.TotalGameTime - previousUpdateTime > updateTime) { previousUpdateTime = gameTime.TotalGameTime; if (device.income >= 2) { if (random.Next(100) < 80) { score += 100 + device.income * 20; userOne = random.Next(usernames.Count()) - 1; passOne = random.Next(passwords.Count()) - 1; changed = true; scoretext.Update("score: " + score + ((changed) ? "\n\nUsername: "******"\nPassword: "******" ")); } } } KeyboardState keyboard = Keyboard.GetState(); if (keyboard.IsKeyDown(Keys.Space) && last.IsKeyUp(Keys.Space)) { if (bottomtext.counter < Game1.story[currentStory].Count()) { bottomtext.Update(Game1.story[Game1.currentStory][bottomtext.counter]); bottomtext.counter++; } } /**/ //if (bottomtext.keyboard.IsKeyDown(Keys.Space) && bottomtext.last.IsKeyUp(Keys.Space)) //{ // if (bottomtext.counter < Game1.all[Game1.currentStory].Count) // { // bottomtext.counter++; // bottomtext.Update(Game1.story[Game1.currentStory][bottomtext.counter]); // } //} //sidetext.Update(); //scoretext.Update(); bottomtext.Update(); if (device.income >= 0) { sidetext.Update("Tools:\n -Keylogger"); } if (device.income > 2) { sidetext.Update("Tools:\n -Keylogger\n -Skimmer"); } if (device.income > 5) { sidetext.Update("Tools:\n -Keylogger\n -Skimmer\n -Sniffer"); } if (device.income > 9) { sidetext.Update("Tools:\n -Keylogger\n -Skimmer\n -Sniffer\n\n -Trojan Horse"); } if (device.income > 11) { sidetext.Update("Tools:\n -Keylogger\n -Skimmer\n -Sniffer\n\n -Trojan Horse\n -$1,000,000"); } changed = false; last = keyboard; } if (pause == null) { keyboard = Keyboard.GetState(); if (keyboard.IsKeyDown(Keys.Enter)) { z = 1; } } base.Update(gameTime); }