Fire & explosion decals
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Barotrauma.Lights;
|
||||
using Barotrauma.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Linq;
|
||||
@@ -78,6 +79,32 @@ namespace Barotrauma
|
||||
lightSource.Range = Math.Max(size.X, size.Y) * 10.0f / 2.0f;
|
||||
lightSource.Color = new Color(1.0f, 0.45f, 0.3f) * Rand.Range(0.8f, 1.0f);
|
||||
lightSource.Position = position + Vector2.UnitY * 30.0f;
|
||||
|
||||
if (size.X > 256.0f)
|
||||
{
|
||||
if (burnDecals.Count == 0)
|
||||
{
|
||||
var newDecal = hull.AddDecal("burnt", WorldPosition + size/2);
|
||||
if (newDecal != null) burnDecals.Add(newDecal);
|
||||
}
|
||||
else if (WorldPosition.X < burnDecals[0].WorldPosition.X - 256.0f)
|
||||
{
|
||||
var newDecal = hull.AddDecal("burnt", WorldPosition);
|
||||
if (newDecal != null) burnDecals.Insert(0, newDecal);
|
||||
}
|
||||
else if (WorldPosition.X + size.X > burnDecals[burnDecals.Count-1].WorldPosition.X + 256.0f)
|
||||
{
|
||||
var newDecal = hull.AddDecal("burnt", WorldPosition + Vector2.UnitX * size.X);
|
||||
if (newDecal != null) burnDecals.Add(newDecal);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (Decal d in burnDecals)
|
||||
{
|
||||
//prevent the decals from fading out as long as the firesource is alive
|
||||
d.FadeTimer = Math.Min(d.FadeTimer, d.FadeInTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user