Multiple particle emitters can be be attached to a background sprite, hydrothermal vents push characters and subs upwards, tweaked hydrothermal smoke particles & trigger positioning

This commit is contained in:
Joonas Rikkonen
2017-08-26 17:07:13 +03:00
parent 1a12f46708
commit 362428280a
8 changed files with 128 additions and 48 deletions
@@ -25,9 +25,11 @@ namespace Barotrauma
private float cameraShake;
private Vector2 force;
public Vector2 WorldPosition
{
get { return ConvertUnits.ToDisplayUnits(physicsBody.Position); }
get { return physicsBody.Position; }
set { physicsBody.SetTransform(ConvertUnits.ToSimUnits(value), physicsBody.Rotation); }
}
@@ -56,6 +58,8 @@ namespace Barotrauma
physicsBody.SetTransform(ConvertUnits.ToSimUnits(position), rotation);
cameraShake = ToolBox.GetAttributeFloat(element, "camerashake", 0.0f);
force = ToolBox.GetAttributeVector2(element, "force", Vector2.Zero);
foreach (XElement subElement in element.Elements())
{
@@ -110,6 +114,7 @@ namespace Barotrauma
public void Update(float deltaTime)
{
triggerers.RemoveAll(t => t.Removed);
foreach (Entity triggerer in triggerers)
{
foreach (StatusEffect effect in statusEffects)
@@ -133,6 +138,18 @@ namespace Barotrauma
}
}
if (force != Vector2.Zero)
{
if (triggerer is Character)
{
((Character)triggerer).AnimController.Collider.ApplyForce(force * deltaTime);
}
else if (triggerer is Submarine)
{
((Submarine)triggerer).ApplyForce(force * deltaTime);
}
}
if (triggerer == Character.Controlled || triggerer == Character.Controlled?.Submarine)
{
GameMain.GameScreen.Cam.Shake = Math.Max(GameMain.GameScreen.Cam.Shake, cameraShake);