public virtual void DrawFront(SpriteBatch spriteBatch, Camera cam) { if (!Enabled) { return; } if (GameMain.DebugDraw) { AnimController.DebugDraw(spriteBatch); if (aiTarget != null) { aiTarget.Draw(spriteBatch); } } /*if (memPos != null && memPos.Count > 0 && controlled == this) * { * PosInfo serverPos = memPos.Last(); * Vector2 remoteVec = ConvertUnits.ToDisplayUnits(serverPos.Position); * if (Submarine != null) * { * remoteVec += Submarine.DrawPosition; * } * remoteVec.Y = -remoteVec.Y; * * PosInfo localPos = memLocalPos.Find(m => m.ID == serverPos.ID); * int mpind = memLocalPos.FindIndex(lp => lp.ID == localPos.ID); * PosInfo localPos1 = mpind > 0 ? memLocalPos[mpind - 1] : null; * PosInfo localPos2 = mpind < memLocalPos.Count-1 ? memLocalPos[mpind + 1] : null; * * Vector2 localVec = ConvertUnits.ToDisplayUnits(localPos.Position); * Vector2 localVec1 = localPos1 != null ? ConvertUnits.ToDisplayUnits(((PosInfo)localPos1).Position) : Vector2.Zero; * Vector2 localVec2 = localPos2 != null ? ConvertUnits.ToDisplayUnits(((PosInfo)localPos2).Position) : Vector2.Zero; * if (Submarine != null) * { * localVec += Submarine.DrawPosition; * localVec1 += Submarine.DrawPosition; * localVec2 += Submarine.DrawPosition; * } * localVec.Y = -localVec.Y; * localVec1.Y = -localVec1.Y; * localVec2.Y = -localVec2.Y; * * //GUI.DrawLine(spriteBatch, remoteVec, localVec, Color.Yellow, 0, 10); * if (localPos1 != null) GUI.DrawLine(spriteBatch, remoteVec, localVec1, Color.Lime, 0, 2); * if (localPos2 != null) GUI.DrawLine(spriteBatch, remoteVec + Vector2.One, localVec2 + Vector2.One, Color.Red, 0, 2); * } * * Vector2 mouseDrawPos = CursorWorldPosition; * mouseDrawPos.Y = -mouseDrawPos.Y; * GUI.DrawLine(spriteBatch, mouseDrawPos - new Vector2(0, 5), mouseDrawPos + new Vector2(0, 5), Color.Red, 0, 10); * * Vector2 closestItemPos = closestItem != null ? closestItem.DrawPosition : Vector2.Zero; * closestItemPos.Y = -closestItemPos.Y; * GUI.DrawLine(spriteBatch, closestItemPos - new Vector2(0, 5), closestItemPos + new Vector2(0, 5), Color.Lime, 0, 10);*/ if (this == controlled || GUI.DisableHUD) { return; } Vector2 pos = DrawPosition; pos.Y = -pos.Y; if (speechBubbleTimer > 0.0f) { GUI.SpeechBubbleIcon.Draw(spriteBatch, pos - Vector2.UnitY * 100.0f, speechBubbleColor * Math.Min(speechBubbleTimer, 1.0f), 0.0f, Math.Min((float)speechBubbleTimer, 1.0f)); } if (this == controlled) { return; } if (info != null) { Vector2 namePos = new Vector2(pos.X, pos.Y - 110.0f - (5.0f / cam.Zoom)) - GUI.Font.MeasureString(Info.Name) * 0.5f / cam.Zoom; Color nameColor = Color.White; if (Character.Controlled != null && TeamID != Character.Controlled.TeamID) { nameColor = Color.Red; } GUI.Font.DrawString(spriteBatch, Info.Name, namePos + new Vector2(1.0f / cam.Zoom, 1.0f / cam.Zoom), Color.Black, 0.0f, Vector2.Zero, 1.0f / cam.Zoom, SpriteEffects.None, 0.001f); GUI.Font.DrawString(spriteBatch, Info.Name, namePos, nameColor, 0.0f, Vector2.Zero, 1.0f / cam.Zoom, SpriteEffects.None, 0.0f); if (GameMain.DebugDraw) { GUI.Font.DrawString(spriteBatch, ID.ToString(), namePos - new Vector2(0.0f, 20.0f), Color.White); } } if (isDead) { return; } if (health < maxHealth * 0.98f) { Vector2 healthBarPos = new Vector2(pos.X - 50, DrawPosition.Y + 100.0f); GUI.DrawProgressBar(spriteBatch, healthBarPos, new Vector2(100.0f, 15.0f), health / maxHealth, Color.Lerp(Color.Red, Color.Green, health / maxHealth) * 0.8f); } }
public virtual void DrawFront(SpriteBatch spriteBatch, Camera cam) { if (!Enabled) { return; } if (GameMain.DebugDraw) { AnimController.DebugDraw(spriteBatch); if (aiTarget != null) { aiTarget.Draw(spriteBatch); } } if (GUI.DisableHUD) { return; } Vector2 pos = DrawPosition; pos.Y = -pos.Y; if (speechBubbleTimer > 0.0f) { GUI.SpeechBubbleIcon.Draw(spriteBatch, pos - Vector2.UnitY * 100.0f, speechBubbleColor * Math.Min(speechBubbleTimer, 1.0f), 0.0f, Math.Min(speechBubbleTimer, 1.0f)); } if (this == controlled) { return; } float hoverRange = 300.0f; float fadeOutRange = 200.0f; float cursorDist = Vector2.Distance(WorldPosition, cam.ScreenToWorld(PlayerInput.MousePosition)); float hudInfoAlpha = MathHelper.Clamp(1.0f - (cursorDist - (hoverRange - fadeOutRange)) / fadeOutRange, 0.2f, 1.0f); if (hudInfoVisible && info != null) { string name = Info.DisplayName; if (controlled == null && name != Info.Name) { name += " " + TextManager.Get("Disguised"); } Vector2 namePos = new Vector2(pos.X, pos.Y - 110.0f - (5.0f / cam.Zoom)) - GUI.Font.MeasureString(Info.Name) * 0.5f / cam.Zoom; Vector2 screenSize = new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight); Vector2 viewportSize = new Vector2(cam.WorldView.Width, cam.WorldView.Height); namePos.X -= cam.WorldView.X; namePos.Y += cam.WorldView.Y; namePos *= screenSize / viewportSize; namePos.X = (float)Math.Floor(namePos.X); namePos.Y = (float)Math.Floor(namePos.Y); namePos *= viewportSize / screenSize; namePos.X += cam.WorldView.X; namePos.Y -= cam.WorldView.Y; Color nameColor = Color.White; if (Controlled != null && TeamID != Controlled.TeamID) { nameColor = Color.Red; } GUI.Font.DrawString(spriteBatch, name, namePos + new Vector2(1.0f / cam.Zoom, 1.0f / cam.Zoom), Color.Black, 0.0f, Vector2.Zero, 1.0f / cam.Zoom, SpriteEffects.None, 0.001f); GUI.Font.DrawString(spriteBatch, name, namePos, nameColor * hudInfoAlpha, 0.0f, Vector2.Zero, 1.0f / cam.Zoom, SpriteEffects.None, 0.0f); if (GameMain.DebugDraw) { GUI.Font.DrawString(spriteBatch, ID.ToString(), namePos - new Vector2(0.0f, 20.0f), Color.White); } } if (isDead) { return; } if (health < maxHealth * 0.98f && hudInfoVisible) { Vector2 healthBarPos = new Vector2(pos.X - 50, DrawPosition.Y + 100.0f); GUI.DrawProgressBar(spriteBatch, healthBarPos, new Vector2(100.0f, 15.0f), health / maxHealth, Color.Lerp(Color.Red, Color.Green, health / maxHealth) * 0.8f * hudInfoAlpha, new Color(0.5f, 0.57f, 0.6f, 1.0f) * hudInfoAlpha); } }
public virtual void DrawFront(SpriteBatch spriteBatch, Camera cam) { if (!Enabled) { return; } if (GameMain.DebugDraw) { AnimController.DebugDraw(spriteBatch); if (aiTarget != null) { aiTarget.Draw(spriteBatch); } } if (GUI.DisableHUD) { return; } Vector2 pos = DrawPosition; pos.Y += hudInfoHeight; if (CurrentHull != null && DrawPosition.Y > CurrentHull.WorldRect.Y - 130.0f) { float lowerAmount = DrawPosition.Y - (CurrentHull.WorldRect.Y - 130.0f); hudInfoHeight = MathHelper.Lerp(hudInfoHeight, 100.0f - lowerAmount, 0.1f); hudInfoHeight = Math.Max(hudInfoHeight, 20.0f); } else { hudInfoHeight = MathHelper.Lerp(hudInfoHeight, 100.0f, 0.1f); } pos.Y = -pos.Y; if (speechBubbleTimer > 0.0f) { GUI.SpeechBubbleIcon.Draw(spriteBatch, pos - Vector2.UnitY * 30, speechBubbleColor * Math.Min(speechBubbleTimer, 1.0f), 0.0f, Math.Min(speechBubbleTimer, 1.0f)); } if (this == controlled) { if (DebugDrawInteract) { Vector2 cursorPos = cam.ScreenToWorld(PlayerInput.MousePosition); cursorPos.Y = -cursorPos.Y; foreach (Item item in debugInteractablesAtCursor) { GUI.DrawLine(spriteBatch, cursorPos, new Vector2(item.DrawPosition.X, -item.DrawPosition.Y), Color.LightGreen, width: 4); } foreach (Item item in debugInteractablesInRange) { GUI.DrawLine(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y), new Vector2(item.DrawPosition.X, -item.DrawPosition.Y), Color.White * 0.1f, width: 4); } foreach (Pair <Item, float> item in debugInteractablesNearCursor) { GUI.DrawLine(spriteBatch, cursorPos, new Vector2(item.First.DrawPosition.X, -item.First.DrawPosition.Y), ToolBox.GradientLerp(item.Second, Color.Red, Color.Orange, Color.Green), width: 2); } } return; } float hoverRange = 300.0f; float fadeOutRange = 200.0f; float cursorDist = Vector2.Distance(WorldPosition, cam.ScreenToWorld(PlayerInput.MousePosition)); float hudInfoAlpha = MathHelper.Clamp(1.0f - (cursorDist - (hoverRange - fadeOutRange)) / fadeOutRange, 0.2f, 1.0f); if (!GUI.DisableCharacterNames && hudInfoVisible && info != null && (controlled == null || this != controlled.focusedCharacter)) { string name = Info.DisplayName; if (controlled == null && name != Info.Name) { name += " " + TextManager.Get("Disguised"); } Vector2 namePos = new Vector2(pos.X, pos.Y - 10.0f - (5.0f / cam.Zoom)) - GUI.Font.MeasureString(name) * 0.5f / cam.Zoom; Vector2 screenSize = new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight); Vector2 viewportSize = new Vector2(cam.WorldView.Width, cam.WorldView.Height); namePos.X -= cam.WorldView.X; namePos.Y += cam.WorldView.Y; namePos *= screenSize / viewportSize; namePos.X = (float)Math.Floor(namePos.X); namePos.Y = (float)Math.Floor(namePos.Y); namePos *= viewportSize / screenSize; namePos.X += cam.WorldView.X; namePos.Y -= cam.WorldView.Y; Color nameColor = Color.White; if (Controlled != null && TeamID != Controlled.TeamID) { nameColor = TeamID == TeamType.FriendlyNPC ? Color.SkyBlue : Color.Red; } GUI.Font.DrawString(spriteBatch, name, namePos + new Vector2(1.0f / cam.Zoom, 1.0f / cam.Zoom), Color.Black, 0.0f, Vector2.Zero, 1.0f / cam.Zoom, SpriteEffects.None, 0.001f); GUI.Font.DrawString(spriteBatch, name, namePos, nameColor * hudInfoAlpha, 0.0f, Vector2.Zero, 1.0f / cam.Zoom, SpriteEffects.None, 0.0f); if (GameMain.DebugDraw) { GUI.Font.DrawString(spriteBatch, ID.ToString(), namePos - new Vector2(0.0f, 20.0f), Color.White); } } if (IsDead) { return; } if (Vitality < MaxVitality * 0.98f && hudInfoVisible) { Vector2 healthBarPos = new Vector2(pos.X - 50, -pos.Y); GUI.DrawProgressBar(spriteBatch, healthBarPos, new Vector2(100.0f, 15.0f), Vitality / MaxVitality, Color.Lerp(Color.Red, Color.Green, Vitality / MaxVitality) * 0.8f * hudInfoAlpha, new Color(0.5f, 0.57f, 0.6f, 1.0f) * hudInfoAlpha); } }
public virtual void DrawFront(SpriteBatch spriteBatch, Camera cam) { if (!Enabled) { return; } if (GameMain.DebugDraw) { AnimController.DebugDraw(spriteBatch); if (aiTarget != null) { aiTarget.Draw(spriteBatch); } } if (GUI.DisableHUD) { return; } Vector2 pos = DrawPosition; pos.Y += hudInfoHeight; if (!showinghealth) { pos.Y -= 30f; } if (CurrentHull != null && DrawPosition.Y > CurrentHull.WorldRect.Y - 120.0f) { float lowerAmount = DrawPosition.Y - (CurrentHull.WorldRect.Y - 120.0f); hudInfoHeight = MathHelper.Lerp(hudInfoHeight, 100.0f - lowerAmount, 0.65f); hudInfoHeight = Math.Max(hudInfoHeight, 20.0f); } else { hudInfoHeight = MathHelper.Lerp(hudInfoHeight, 100.0f, 0.65f); } pos.Y = -pos.Y; if (speechBubbleTimer > 0.0f) { GUI.SpeechBubbleIcon.Draw(spriteBatch, pos - Vector2.UnitY * 100.0f, speechBubbleColor * Math.Min(speechBubbleTimer, 1.0f), 0.0f, Math.Min(speechBubbleTimer, 1.0f)); } //if (this == controlled) return; float hoverRange = 500.0f; float fadeOutRange = 300.0f; float cursorDist = Vector2.Distance(WorldPosition, cam.ScreenToWorld(PlayerInput.MousePosition)); float hudInfoAlpha = MathHelper.Clamp(1.0f - (cursorDist - (hoverRange - fadeOutRange)) / fadeOutRange, 0.25f, 1.0f); //Disable the brightness changes of players names for characterless server hosts if (GameMain.Server != null && Character.Controlled == null) { hudInfoAlpha = 1.0f; } if (hudInfoVisible && info != null) { string name = Info.DisplayName; if (name != Info.Name) { if (GameMain.Client != null && (GameMain.Client.HasPermission(ClientPermissions.Kick) || GameMain.Client.HasPermission(ClientPermissions.Ban))) { name += " (" + Info.Name + ")"; } else if (GameMain.Server != null) { name += " (" + Info.Name + ")"; } else if (controlled == null) { name += " " + TextManager.Get("Disguised"); } } Vector2 namePos = new Vector2(pos.X, pos.Y + 10.0f - (5.0f / cam.Zoom)) - GUI.Font.MeasureString(Info.Name) * 0.5f / cam.Zoom; Vector2 screenSize = new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight); Vector2 viewportSize = new Vector2(cam.WorldView.Width, cam.WorldView.Height); namePos.X -= cam.WorldView.X; namePos.Y += cam.WorldView.Y; namePos *= screenSize / viewportSize; namePos.X = (float)Math.Floor(namePos.X); namePos.Y = (float)Math.Floor(namePos.Y); namePos *= viewportSize / screenSize; namePos.X += cam.WorldView.X; namePos.Y -= cam.WorldView.Y; Color nameColor = Color.White; if (GameMain.NilMod.UseRecolouredNameInfo) { if (Character.Controlled == null) { if (TeamID == 0) { if (!isDead) { nameColor = Color.White; } else { nameColor = Color.DarkGray; } } else if (TeamID == 1) { if (!isDead) { nameColor = Color.LightBlue; } else { nameColor = Color.DarkBlue; } } else if (TeamID == 2) { if (!isDead) { nameColor = Color.Red; } else { nameColor = Color.DarkRed; } } //Im not really sure where to put this relative to teams and such so it can simply override all of them. if (HuskInfectionState >= 0.5f || this.SpeciesName.ToLowerInvariant() == "humanhusk") { nameColor = new Color(255, 100, 255, 255); } } else { if (TeamID == Character.Controlled.TeamID) { nameColor = Color.LightBlue; if (IsDead) { nameColor = Color.DarkBlue; } } if (TeamID != Character.Controlled.TeamID) { nameColor = Color.Red; if (IsDead) { nameColor = Color.DarkRed; } } } if (Character.Controlled != null && TeamID != Character.Controlled.TeamID) { nameColor = Color.Red; if (IsDead) { nameColor = Color.DarkRed; } } } else { if (Character.Controlled != null) { if (TeamID != Character.Controlled.TeamID) { nameColor = Color.Red; } } } GUI.Font.DrawString(spriteBatch, name, namePos + new Vector2(1.0f / cam.Zoom, 1.0f / cam.Zoom), Color.Black, 0.0f, Vector2.Zero, 1.0f / cam.Zoom, SpriteEffects.None, 0.001f); GUI.Font.DrawString(spriteBatch, name, namePos, nameColor * hudInfoAlpha, 0.0f, Vector2.Zero, 1.0f / cam.Zoom, SpriteEffects.None, 0.0f); if (GameMain.DebugDraw) { GUI.Font.DrawString(spriteBatch, ID.ToString(), namePos - new Vector2(0.0f, 20.0f), Color.White); } } showinghealth = false; if (isDead) { return; } if (GameMain.NilMod.UseUpdatedCharHUD) { if (((health < maxHealth * 0.98f) || oxygen < 95f || bleeding >= 0.05f || (((AnimController.CurrentHull == null) ? 100.0f : Math.Min(AnimController.CurrentHull.LethalPressure, 100.0f)) > 10f && NeedsAir && !Shielded && PressureProtection == 0f) || HuskInfectionState > 0f || Stun > 0f) && hudInfoVisible) { showinghealth = true; //Basic Colour Color baseoutlinecolour; //Basic Flash Colour if fine Color FlashColour; //Final Calculated outline colour Color outLineColour; //Negative Colours Color NegativeLow = new Color(145, 145, 145, 160); Color NegativeHigh = new Color(25, 25, 25, 220); //Health Colours Color HealthPositiveHigh = new Color(0, 255, 0, 15); Color HealthPositiveLow = new Color(255, 0, 0, 60); //Oxygen Colours Color OxygenPositiveHigh = new Color(0, 255, 255, 15); Color OxygenPositiveLow = new Color(0, 0, 200, 60); //Stun Colours Color StunPositiveHigh = new Color(235, 135, 45, 100); Color StunPositiveLow = new Color(204, 119, 34, 30); //Bleeding Colours Color BleedPositiveHigh = new Color(255, 50, 50, 100); Color BleedPositiveLow = new Color(150, 50, 50, 15); //Pressure Colours Color PressurePositiveHigh = new Color(255, 255, 0, 100); Color PressurePositiveLow = new Color(125, 125, 0, 15); //Husk Colours Color HuskPositiveHigh = new Color(255, 100, 255, 150); Color HuskPositiveLow = new Color(125, 30, 125, 15); float pressureFactor = (AnimController.CurrentHull == null) ? 100.0f : Math.Min(AnimController.CurrentHull.LethalPressure, 100.0f); if ((PressureProtection > 0.0f && (WorldPosition.Y > GameMain.NilMod.PlayerCrushDepthOutsideHull || (WorldPosition.Y > GameMain.NilMod.PlayerCrushDepthInHull && CurrentHull != null))) || Shielded) { pressureFactor = 0.0f; } if (IsRemotePlayer || this == Character.Controlled || AIController is HumanAIController) { //A players basic flash if ok baseoutlinecolour = new Color(255, 255, 255, 15); FlashColour = new Color(220, 220, 220, 15); if (HuskInfectionState >= 0.98f) { FlashColour = new Color(200, 0, 200, 255); } else if (HuskInfectionState > 0.5f) { FlashColour = new Color(85, 0, 85, 150); } else if (HuskInfectionState > 0f) { FlashColour = new Color(50, 0, 120, 50); } else if (pressureFactor > 80f) { FlashColour = new Color(200, 200, 0, 100); } else if (bleeding > 0.45f) { FlashColour = new Color(80, 30, 20, 100); } else if (pressureFactor > 45f) { FlashColour = new Color(200, 200, 0, 100); } else if (health < 0f) { FlashColour = new Color(25, 25, 25, 40); } else if (oxygen < 0f) { FlashColour = new Color(40, 40, 255, 40); } else if (pressureFactor > 5f) { FlashColour = new Color(200, 200, 0, 100); } else if (oxygen < 35f) { FlashColour = new Color(40, 40, 255, 40); } else if (health < 25f) { FlashColour = new Color(25, 25, 25, 40); } else if (oxygen < 70f) { FlashColour = new Color(40, 40, 255, 40); } else if (health < 50f) { FlashColour = new Color(25, 25, 25, 40); } else if (Stun >= 1f) { FlashColour = new Color(5, 5, 5, 80); } if (IsUnconscious || Stun >= 5f) { baseoutlinecolour = new Color(40, 40, 40, 35); } } //Is an AI or well, not controlled by anybody, make their border different else { baseoutlinecolour = new Color(40, 40, 40, 15); FlashColour = new Color(5, 5, 5, 15); //if (HuskInfectionState >= 2f) FlashColour = new Color(255, 0, 255, 255); //else if (HuskInfectionState > 1f) FlashColour = new Color(200, 0, 200, 150); //else if (HuskInfectionState > 0f) FlashColour = new Color(120, 0, 120, 100); if (pressureFactor > 80f && NeedsAir) { FlashColour = new Color(200, 200, 0, 100); } else if (bleeding > 1f) { FlashColour = new Color(255, 10, 10, 100); } else if (pressureFactor > 45f && NeedsAir) { FlashColour = new Color(200, 200, 0, 100); } else if (Stun >= 1f) { FlashColour = new Color(10, 10, 10, 100); } } if (GameMain.NilMod.CharFlashColourTime >= (NilMod.CharFlashColourRate / 2)) { outLineColour = Color.Lerp(baseoutlinecolour, FlashColour, (GameMain.NilMod.CharFlashColourTime - (NilMod.CharFlashColourRate / 2)) / (NilMod.CharFlashColourRate / 2)) * hudInfoAlpha; } else { outLineColour = Color.Lerp(FlashColour, baseoutlinecolour, GameMain.NilMod.CharFlashColourTime / (NilMod.CharFlashColourRate / 2)) * hudInfoAlpha; } //Smooth out the Health bar movement a little c: //if (LastHealthStatusVector == null || LastHealthStatusVector == Vector2.Zero) LastHealthStatusVector = new Vector2(pos.X - 20f, -pos.Y); //if ((LastHealthStatusVector.X + 40f) - DrawPosition.X > 2.0f || (LastHealthStatusVector.X + 40f) - DrawPosition.X < -2.0f || (LastHealthStatusVector.Y - 70f) - pos.Y > 2.0f || (LastHealthStatusVector.Y - 70f) - pos.Y < -2.0f) LastHealthStatusVector = new Vector2(pos.X - 40f, -pos.Y); //Vector2 healthBarPos = LastHealthStatusVector; //Smooth out the Health bar movement a little c: Vector2 namePos = Vector2.Zero; if (info != null) { namePos = new Vector2(pos.X, pos.Y + 10.0f - (5.0f / cam.Zoom)) - GUI.Font.MeasureString(Info.Name) * 0.5f / cam.Zoom; } Vector2 screenSize = new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight); Vector2 viewportSize = new Vector2(cam.WorldView.Width, cam.WorldView.Height); namePos.X -= cam.WorldView.X; namePos.Y += cam.WorldView.Y; namePos *= screenSize / viewportSize; namePos.X = (float)Math.Floor(namePos.X); namePos.Y = (float)Math.Floor(namePos.Y); namePos *= viewportSize / screenSize; namePos.X += cam.WorldView.X; namePos.Y -= cam.WorldView.Y; if (info == null) { if (LastHealthStatusVector == null || LastHealthStatusVector == Vector2.Zero) { LastHealthStatusVector = new Vector2(pos.X - 20f, -pos.Y); } if ((LastHealthStatusVector.X + 40f) - DrawPosition.X > 2.0f || (LastHealthStatusVector.X + 40f) - DrawPosition.X < -2.0f || (LastHealthStatusVector.Y - 70f) - pos.Y > 2.0f || (LastHealthStatusVector.Y - 70f) - pos.Y < -2.0f) { LastHealthStatusVector = new Vector2(pos.X - 40f, -pos.Y); } } else { if (LastHealthStatusVector == null || LastHealthStatusVector == Vector2.Zero) { LastHealthStatusVector = new Vector2(namePos.X, -namePos.Y); } if ((LastHealthStatusVector.X + 20f) - namePos.X > 2.0f || (LastHealthStatusVector.X + 20f) - namePos.X < -2.0f || (LastHealthStatusVector.Y - 30f) - namePos.Y > 2.0f || (LastHealthStatusVector.Y - 30f) - namePos.Y < -2.0f) { LastHealthStatusVector = new Vector2(namePos.X + 20f, -namePos.Y - 30f); } } Vector2 healthBarPos = LastHealthStatusVector; //GUI.DrawProgressBar(spriteBatch, healthBarPos, new Vector2(100.0f, 10.0f), health / maxHealth, Color.Lerp(Color.Red, Color.Green, health / maxHealth) * 0.8f); //Health Bar (Keep visible) if (Health >= 0f) { if ((NeedsAir && oxygen > 85f) || !NeedsAir) { GUI.DrawProgressBar(spriteBatch, healthBarPos, new Vector2(80.0f, 20.0f), health / maxHealth, Color.Lerp(HealthPositiveLow, HealthPositiveHigh, health / maxHealth) * hudInfoAlpha, outLineColour, 2f, 0, "Left"); } else { GUI.DrawProgressBar(spriteBatch, healthBarPos, new Vector2(80.0f, 10.0f), health / maxHealth, Color.Lerp(HealthPositiveLow, HealthPositiveHigh, health / maxHealth) * hudInfoAlpha, outLineColour, 2f, 0, "Left"); } } //Health has gone below 0 else { if ((NeedsAir && oxygen > 85f) || !NeedsAir) { GUI.DrawProgressBar(spriteBatch, healthBarPos, new Vector2(80.0f, 20.0f), -(health / maxHealth), Color.Lerp(NegativeLow, NegativeHigh, -(health / maxHealth)) * hudInfoAlpha, outLineColour, 2f, 0, "Right"); } else { GUI.DrawProgressBar(spriteBatch, healthBarPos, new Vector2(80.0f, 10.0f), -(health / maxHealth), Color.Lerp(NegativeLow, NegativeHigh, -(health / maxHealth)) * hudInfoAlpha, outLineColour, 2f, 0, "Right"); } } //Oxygen Bar if (NeedsAir && (oxygen <= 85f && oxygen >= 0f)) { GUI.DrawProgressBar(spriteBatch, new Vector2(healthBarPos.X, healthBarPos.Y - 10f), new Vector2(80.0f, 10.0f), oxygen / 100f, Color.Lerp(OxygenPositiveLow, OxygenPositiveHigh, oxygen / 100f) * hudInfoAlpha, outLineColour, 2f, 0f, "Left"); } //Oxygen has gone below 0 else if (NeedsAir && oxygen < 0f) { GUI.DrawProgressBar(spriteBatch, new Vector2(healthBarPos.X, healthBarPos.Y - 10f), new Vector2(80.0f, 10.0f), -(oxygen / 100f), Color.Lerp(NegativeLow, NegativeHigh, -(oxygen / 100f)) * hudInfoAlpha, outLineColour, 2f, 0f, "Right"); } //Stun Bar if (Stun > 1.0f && !IsUnconscious) { GUI.DrawProgressBar(spriteBatch, new Vector2(healthBarPos.X, healthBarPos.Y - 20f), new Vector2(80.0f, 10.0f), Stun / 60f, Color.Lerp(StunPositiveLow, StunPositiveHigh, Stun / 60f) * hudInfoAlpha, outLineColour, 2f, 0f, "Left"); } //Bleed Bar if (bleeding > 0.0f) { GUI.DrawProgressBar(spriteBatch, new Vector2(healthBarPos.X, healthBarPos.Y + 10f), new Vector2(40.0f, 10.0f), bleeding / 5f, Color.Lerp(BleedPositiveLow, BleedPositiveHigh, bleeding / 5f) * hudInfoAlpha, outLineColour, 2f, 0f, "Left"); } //Pressure Bar if (pressureFactor > 0.0f) { GUI.DrawProgressBar(spriteBatch, new Vector2(healthBarPos.X + 40f, healthBarPos.Y + 10f), new Vector2(40.0f, 10.0f), pressureFactor / 100f, Color.Lerp(PressurePositiveLow, PressurePositiveHigh, pressureFactor / 100f) * hudInfoAlpha, outLineColour, 2f, 0f, "Right"); } //Husk Bar if (HuskInfectionState > 0.0f) { GUI.DrawProgressBar(spriteBatch, new Vector2(healthBarPos.X + 80f, healthBarPos.Y + ((pressureFactor > 0.0f) ? 10.0f : 0.0f)), new Vector2(20.0f, (pressureFactor > 0.0f) ? 30.0f : 20.0f), HuskInfectionState, Color.Lerp(HuskPositiveLow, HuskPositiveHigh, HuskInfectionState) * hudInfoAlpha, outLineColour, 2f, 0f, "Bottom"); } } } else { Vector2 healthBarPos = new Vector2(pos.X - 50, DrawPosition.Y + 80.0f); GUI.DrawProgressBar(spriteBatch, healthBarPos, new Vector2(100.0f, 15.0f), health / maxHealth, Color.Lerp(Color.Red, Color.Green, health / maxHealth) * 0.8f * hudInfoAlpha, new Color(0.5f, 0.57f, 0.6f, 1.0f) * hudInfoAlpha, 2f, 0f, "Left"); } }