A "suicide button" which can be used if the character is unconscious and the player doesn't want to wait for help, fixed submarine staying loaded when clicking the "load previous" button mid-round, main path waypoint generation bugfix

This commit is contained in:
Regalis
2016-04-20 17:22:22 +03:00
parent e33f30dad1
commit 188220c464
4 changed files with 80 additions and 26 deletions
+29 -2
View File
@@ -14,6 +14,8 @@ namespace Barotrauma
private static GUIButton cprButton;
private static GUIButton suicideButton;
private static GUIProgressBar drowningBar, healthBar;
private static float damageOverlayTimer;
@@ -36,6 +38,8 @@ namespace Barotrauma
if (cprButton != null && cprButton.Visible) cprButton.Update(deltaTime);
if (GameMain.NetworkMember != null && suicideButton != null && suicideButton.Visible) suicideButton.Update(deltaTime);
if (damageOverlayTimer > 0.0f) damageOverlayTimer -= deltaTime;
}
@@ -144,8 +148,6 @@ namespace Barotrauma
}
}
if (Screen.Selected == GameMain.EditMapScreen) return;
if (character.IsUnconscious || (character.Oxygen < 80.0f && !character.IsDead))
@@ -159,6 +161,11 @@ namespace Barotrauma
noiseOverlay.DrawTiled(spriteBatch, Vector2.Zero - offset, new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight) + offset,
Vector2.Zero,
Color.White * alpha);
}
else
{
if (suicideButton != null) suicideButton.Visible = false;
}
if (damageOverlayTimer>0.0f)
@@ -166,6 +173,26 @@ namespace Barotrauma
damageOverlay.Draw(spriteBatch, Vector2.Zero, Color.White * damageOverlayTimer, Vector2.Zero, 0.0f,
new Vector2(GameMain.GraphicsWidth / damageOverlay.size.X, GameMain.GraphicsHeight / damageOverlay.size.Y));
}
if (character.IsUnconscious && GameMain.NetworkMember!=null)
{
if (suicideButton == null)
{
suicideButton = new GUIButton(
new Rectangle(new Point(GameMain.GraphicsWidth / 2 - 60, 20), new Point(120, 20)), "Give in", GUI.Style);
suicideButton.ToolTip = "Let go of your character and enter spectator mode (other players will now longer be able to revive you)";
suicideButton.OnClicked = (button, userData) =>
{
character.Kill(character.CauseOfDeath);
return true;
};
}
suicideButton.Visible = true;
suicideButton.Draw(spriteBatch);
}
}
private static void DrawStatusIcons(SpriteBatch spriteBatch, Character character)