Some visual effects when drowning or being killed by pressure
This commit is contained in:
@@ -809,7 +809,17 @@ namespace Barotrauma
|
||||
|
||||
if (moveCam)
|
||||
{
|
||||
cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, Submarine == null ? 400.0f : 250.0f, 0.05f);
|
||||
float pressureEffect = 0.0f;
|
||||
|
||||
if (pressureProtection < 80.0f && AnimController.CurrentHull != null && AnimController.CurrentHull.LethalPressure > 50.0f)
|
||||
{
|
||||
cam.Zoom = MathHelper.Lerp(cam.Zoom,
|
||||
(AnimController.CurrentHull.LethalPressure / 50.0f) * Rand.Range(1.0f, 1.05f),
|
||||
(AnimController.CurrentHull.LethalPressure - 50.0f) / 50.0f);
|
||||
}
|
||||
cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, (Submarine == null ? 400.0f : 250.0f)+pressureEffect, 0.05f);
|
||||
|
||||
|
||||
}
|
||||
|
||||
cursorPosition = cam.ScreenToWorld(PlayerInput.MousePosition);
|
||||
@@ -939,13 +949,14 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
if (!protectedFromPressure &&
|
||||
(AnimController.CurrentHull == null || AnimController.CurrentHull.LethalPressure >= 100.0f))
|
||||
(AnimController.CurrentHull == null || AnimController.CurrentHull.LethalPressure >= 80.0f))
|
||||
{
|
||||
PressureTimer += ((AnimController.CurrentHull == null) ?
|
||||
100.0f : AnimController.CurrentHull.LethalPressure) * deltaTime;
|
||||
|
||||
if (PressureTimer >= 100.0f)
|
||||
{
|
||||
if (controlled == this) cam.Zoom = 5.0f;
|
||||
Implode();
|
||||
return;
|
||||
}
|
||||
@@ -1178,7 +1189,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
SoundPlayer.PlayDamageSound(DamageSoundType.Implode, 50.0f, AnimController.RefLimb.body);
|
||||
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
Particle p = GameMain.ParticleManager.CreateParticle("waterblood",
|
||||
|
||||
@@ -12,6 +12,8 @@ namespace Barotrauma
|
||||
|
||||
private static Sprite statusIcons;
|
||||
|
||||
private static Sprite noise;
|
||||
|
||||
private static GUIProgressBar drowningBar, healthBar;
|
||||
|
||||
public static void TakeDamage()
|
||||
@@ -36,6 +38,11 @@ namespace Barotrauma
|
||||
statusIcons = new Sprite("Content/UI/statusIcons.png", Vector2.Zero);
|
||||
}
|
||||
|
||||
if (noise==null)
|
||||
{
|
||||
noise = new Sprite("Content/UI/noise.png", Vector2.Zero);
|
||||
}
|
||||
|
||||
DrawStatusIcons(spriteBatch, character);
|
||||
|
||||
if (character.Inventory != null) character.Inventory.DrawOwn(spriteBatch);
|
||||
@@ -89,6 +96,29 @@ namespace Barotrauma
|
||||
textPos.Y += 25;
|
||||
}
|
||||
}
|
||||
//Vector2 offset = Rand.Vector(noise.size.X);
|
||||
//offset.X = Math.Abs(offset.X);
|
||||
//offset.Y = Math.Abs(offset.Y);
|
||||
|
||||
//noise.DrawTiled(spriteBatch, Vector2.Zero - offset, new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight) + offset,
|
||||
// Vector2.Zero,
|
||||
// Color.White * 0.1f);
|
||||
|
||||
if (character.Oxygen < 50.0f)
|
||||
{
|
||||
Vector2 offset = Rand.Vector(noise.size.X);
|
||||
offset.X = Math.Abs(offset.X);
|
||||
offset.Y = Math.Abs(offset.Y);
|
||||
|
||||
noise.DrawTiled(spriteBatch, Vector2.Zero - offset, new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight) + offset,
|
||||
Vector2.Zero,
|
||||
Color.White * ((50.0f - character.Oxygen) / 50.0f));
|
||||
|
||||
//spriteBatch.Draw(noise.Texture,
|
||||
// new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
|
||||
// new Rectangle(Rand.Int(GameMain.GraphicsWidth), Rand.Int(GameMain.GraphicsHeight), (int)noise.size.X, (int)noise.size.Y),
|
||||
// Color.White * ((100.0f - character.Oxygen) / 100.0f));
|
||||
}
|
||||
}
|
||||
|
||||
private static void DrawStatusIcons(SpriteBatch spriteBatch, Character character)
|
||||
|
||||
Reference in New Issue
Block a user