Some visual effects when drowning or being killed by pressure

This commit is contained in:
Regalis
2016-02-19 15:00:45 +02:00
parent b49641ecb8
commit c59a2b5207
9 changed files with 66 additions and 11 deletions

View File

@@ -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)