protected override void Update(GameTime gameTime) { cursor.Update(gameTime); UpdateButtonsColor(); UpdateMouseClick(); UpdateSelectedButton(); }
public void Update(GameTime gameTime) { sight.Update(gameTime); var heroRect = GetGlobalBounds(); Sprite bonus = null; foreach (var s in level.Map.Shotguns) { if (heroRect.Intersects(s.GetGlobalBounds())) { bonus = s; weapon = Weapons.Shotgun; elapsedBonusTime = 0f; break; } } if (bonus != null) { level.Map.Shotguns.Remove(bonus); bonus = null; } Move(gameTime); RotateToCursor(); timeSinceLastShot += gameTime.DeltaTime; Shoot(); if (weapon == Weapons.Shotgun) { elapsedBonusTime += gameTime.DeltaTime; } if (elapsedBonusTime >= bonusTime) { elapsedBonusTime = 0f; weapon = Weapons.Pistol; } }