private void DrawLife(SpriteBatch spriteBatch) { spriteBatch.DrawString(game.fontManager.GetFont(14), "Life: " + ((int)StatsManager.GetShipLife()).ToString(), new Vector2(game.camera.cameraPos.X - Game1.ScreenSize.X / 2 + 10, game.camera.cameraPos.Y + Game1.ScreenSize.Y / 2 - 31) + game.fontManager.FontOffset, game.fontManager.FontColor, .0f, Vector2.Zero, 1f, SpriteEffects.None, 0.92f); lifeBar.Draw(spriteBatch); }
public void Update(GameTime gameTime, List <GameObjectOverworld> visibleGameObjects) { radar.Update(gameTime, visibleGameObjects, game.camera.Position); lifeBar.Update(gameTime, StatsManager.GetShipLife(), StatsManager.Armor(), new Vector2(game.camera.cameraPos.X - Game1.ScreenSize.X / 2 + 10, game.camera.cameraPos.Y + Game1.ScreenSize.Y / 2 - 15)); int[] fusionCells = StatsManager.FusionCells; for (int i = 0; i < StatsManager.MaxFusionCells; i++) { fusionCellBars[i].Update(gameTime, fusionCells[i], 1, new Vector2(game.camera.cameraPos.X - Game1.ScreenSize.X / 2 + 8, game.camera.cameraPos.Y + Game1.ScreenSize.Y / 2 - 60 - (i * 10))); } emergencyFusionCellBar.Update(gameTime, StatsManager.EmergencyFusionCell, 1, new Vector2(game.camera.cameraPos.X - Game1.ScreenSize.X / 2 + 8, game.camera.cameraPos.Y + Game1.ScreenSize.Y / 2 - 45)); autoSaveHandler.Update(gameTime); }
public override void Update(GameTime gameTime) { damageTimer -= gameTime.ElapsedGameTime.Milliseconds; if (StatsManager.GetShipLife() <= 0 && GameStateManager.currentState == "OverworldState") { Game.stateManager.outroState.SetOutroType(OutroType.GameOver); Game.stateManager.ChangeState("OutroState"); } foreach (Particle par in particles) { par.Update(gameTime, this); } if (IsUsed && !hyperspeedOn) { PlayerMovement(gameTime); base.Update(gameTime); } if (!IsControlsEnabled && !Game.stateManager.overworldState.IsBurnOutEndingActivated) { AddParticle(); } if (isInvincible) { UpdateInvincibility(gameTime); } #region UpdateHyperSpeed if (hyperspeedOn == true) { HyperSpeedMovement(gameTime); AddHyperSpeedParticle(); base.Update(gameTime); angle = (float)(MathFunctions.RadiansFromDir( new Vector2(Direction.GetDirectionAsVector().X, Direction.GetDirectionAsVector().Y)) + (Math.PI * 90) / 180); if (currentHyperspeedDistance <= 20 || speed <= 0) { hyperspeedOn = false; CheckForMoreJumps(); } } #endregion #region UpdateParticles for (int i = 0; i < particles.Count; i++) { if (particles[i].lifeSpawn <= 0) { deadParticles.Add(particles[i]); } } RemoveParticle(); #endregion }
public override void Initialize() { base.Initialize(); acceleration = StatsManager.Acceleration(); deAcceleration = StatsManager.Acceleration(); maxSpeed = ShipInventoryManager.equippedPlating.Speed; playerShotHandler = new PlayerShotHandler(this, Game, spriteSheet); playerShotHandler.Initialize(); Speed = 0.0f; Position = new Vector2(Game1.ScreenSize.X / 2, Game1.ScreenSize.Y - Game.stateManager.shooterState.WindowHeightOffset - 75); IsKilled = false; Direction = Vector2.Zero; HPmax = StatsManager.Armor(); // If hardcore the life is fixed. Else, life is set to the ships armor. if (StatsManager.gameMode != GameMode.Hardcore) { HP = StatsManager.Armor(); } else { HP = StatsManager.GetShipLife(); } ShieldMax = ShipInventoryManager.equippedShield.Capacity; Shield = ShieldMax; conversionFactor = ShipInventoryManager.equippedShield.ConversionFactor; shieldRegeneration = StatsManager.GetShieldRegeneration(); MPmax = ShipInventoryManager.equippedEnergyCell.Capacity; MP = MPmax; MPtimer = 0; MPgainedSec = StatsManager.GetEnergyRegeneration(); ObjectClass = "player"; ObjectName = "Player"; TempInvincibility = 0; Damage = 2000; DrawLayer = 0.6f; lastTimeShotPrimary = 10000; lastTimeShotSecondary = 10000; shootingDelay = 300; //Animation anim.LoopTime = 1000; anim.AddFrame(spriteSheet.GetSubSprite(new Rectangle(216, 1, 23, 27))); shieldSprite = spriteSheet.GetSubSprite(new Rectangle(260, 100, 37, 37)); BoundingSpace = 10; CenterPoint = new Vector2(anim.Width / 2, anim.Height / 2); angle = (float)(Math.PI / 180) * 180; }