public override void Update(GameTime gameTime) { numberSpitter.Update(currentEXPPool, xpNeededToLevel, matches, EndSeason, CurrentLvl); var elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds; timer += elapsed; if (timer >= 0.04f && !gaugeDone) { if (currentEXPPool > 0) { var taker = 0; var diff = xpNeededToLevel - tempDrainPool; if (diff < 2000) { taker = 125; } else if (diff >= 2001 && diff < 5000) { taker = 200; } else if (diff >= 5001 && diff < 10000) { taker = 300; } else if (diff >= 10001 && diff < 15000) { taker = 900; } else { taker = 2000; } var buffer = currentEXPPool - taker; if (buffer < 0) { taker = currentEXPPool; } buffer = (int)tempDrainPool + taker; if (buffer > xpNeededToLevel) { taker = (int)xpNeededToLevel - (int)tempDrainPool; } currentEXPPool -= taker; tempDrainPool += taker; FullXPPool += taker; if (tempDrainPool != 0) { _currentWidth = (int)(GaugeWidth * ((double)tempDrainPool / xpNeededToLevel)); } else { _currentWidth = 0; } if (tempDrainPool >= xpNeededToLevel) { tempDrainPool = 0; CurrentLvl++; if (CurrentLvl == 5) { ScreenManager.GameReference.EvaluateAchievements("Lvl5"); } else if (CurrentLvl == 10) { ScreenManager.GameReference.EvaluateAchievements("Lvl10"); } else if (CurrentLvl == 15) { ScreenManager.GameReference.EvaluateAchievements("Lvl15"); } Evalute(); } timer = 0; } else { gaugeDone = true; XPForThisLevel = (int)tempDrainPool; } } if (ScreenManager.GameReference.PlacardState != TempleMain.PlacardSlideStates.Closed) { ScreenManager.GameReference.ManagePlacardState(gameTime); } ControlManager.Update(gameTime); offsetX = (centerScreen.X - InputHandler.TouchVectorScaled.ToPoint().X) / 32; offsetY = (centerScreen.Y - InputHandler.TouchVectorScaled.ToPoint().Y) / 32; }
public override void Update(GameTime gameTime) { var elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds; if (ready) { newFlowerTimer += elapsed; textInitTimer += elapsed; if (!shiftMode) { if (newFlowerTimer >= newFlowerTimerDuration) { newFlowerTimer = 0; if (flowerPool.Any(r => !r.Active)) { var pos = Vector2.Zero; do { pos = new Vector2(MasterRandom.FRandom.Next(32, 1248), MasterRandom.FRandom.Next(32, 688)); }while (flowerPool.Any(t => t.Position.X >= (pos.X - 64) && t.Position.X < (pos.X + 64) && t.Position.Y >= (pos.Y - 64) && t.Position.Y < (pos.Y + 64))); flowerPool.First(t => !t.Active).ActivateFlower(pos); } } if (textInitTimer >= textInitTimerDuration) { timer += elapsed; if (timer >= timerDuration && !titleMoveDone) { timer = 0; if (!bounceUp) { titleTextPosition = new Vector2(titleTextPosition.X, titleTextPosition.Y + 7); if (titleTextPosition.Y >= 248) { bounceUp = true; } } else { titleTextPosition = new Vector2(titleTextPosition.X, titleTextPosition.Y - 3); if (titleTextPosition.Y <= 200) { titleMoveDone = true; } } } } foreach (var flower in flowerPool) { if (flower.Active) { flower.Update(gameTime); } } foreach (var bee in bees) { bee.Update(gameTime); } if (InputHandler.FingerRaised() && titleMoveDone) { shiftMode = true; for (var i = 0; i < flowerPool.Count; i++) { flowerPool[i].AllStop = true; } for (var i = 0; i < bees.Count; i++) { bees[i].AllStop = true; } ScreenManager.GameReference.ScreenControl(ScreenName, "NewUser"); } if (InputHandler.FingerRaised() && titleMoveDone) { shiftMode = true; for (var i = 0; i < flowerPool.Count; i++) { flowerPool[i].AllStop = true; } for (var i = 0; i < bees.Count; i++) { bees[i].AllStop = true; } if (isNewUser) { ScreenManager.GameReference.ScreenControl(ScreenName, "NewUser"); } } } else { if (timer >= timerDuration) { timerDuration = 0; foreach (var flower in flowerPool) { if (flower.Active) { flower.Update(gameTime); } } foreach (var bee in bees) { bee.Update(gameTime); } helperNode = new Vector2(helperNode.X, helperNode.Y + 55 * 5 * elapsed); titleTextPosition = new Vector2(titleTextPosition.X, titleTextPosition.Y + 65 * 5 * elapsed); } if (helperNode.Y >= 256 && !startingNextScreen) { ScreenManager.GameReference.ScreenControl(ScreenName, "Begin"); Tiling = null; startingNextScreen = true; } if (helperNode.Y >= 768) { ScreenManager.GameReference.ScreenControl(ScreenName, "Next"); } } } else { initTimer += elapsed; if (initTimer > 5) { ready = true; } } ControlManager.Update(gameTime); }