Particle system improvements:
- particles can collide with the outer walls of the sub - drag + waterdrag parameters - fixed particles "twitching" when the submarine is moving fast - submarine velocity only affects the initial velocity of the particles (i.e. accelerating the sub doesn't automatically accelerate them)
This commit is contained in:
@@ -163,6 +163,8 @@ namespace Barotrauma
|
||||
hulls[1] = temp;
|
||||
}
|
||||
|
||||
flowTargetHull = hulls[0];
|
||||
|
||||
for (int i = 0 ; i <2; i++)
|
||||
{
|
||||
if (hulls[i]==null) continue;
|
||||
|
||||
@@ -537,8 +537,22 @@ namespace Barotrauma
|
||||
|
||||
if (sectionIndex < 0 || sectionIndex > sections.Length - 1) return;
|
||||
|
||||
if (GameMain.Client == null) SetDamage(sectionIndex, sections[sectionIndex].damage + damage);
|
||||
var section = sections[sectionIndex];
|
||||
|
||||
int particleAmount = (int)(Math.Min(Health - section.damage, damage) * Rand.Range(0.1f, 1.0f));
|
||||
for (int i = 0; i < particleAmount; i++)
|
||||
{
|
||||
Vector2 particlePos = new Vector2(
|
||||
Rand.Range(section.rect.X, section.rect.Right),
|
||||
Rand.Range(section.rect.Y - section.rect.Height, section.rect.Y));
|
||||
|
||||
if (Submarine != null) particlePos += Submarine.DrawPosition;
|
||||
|
||||
var particle = GameMain.ParticleManager.CreateParticle("shrapnel", particlePos, Rand.Vector(Rand.Range(1.0f, 50.0f)));
|
||||
if (particle == null) break;
|
||||
}
|
||||
|
||||
if (GameMain.Client == null) SetDamage(sectionIndex, section.damage + damage);
|
||||
}
|
||||
|
||||
public int FindSectionIndex(Vector2 displayPos)
|
||||
|
||||
@@ -444,6 +444,18 @@ namespace Barotrauma
|
||||
float wallImpact = Vector2.Dot(Velocity, -collisionNormal);
|
||||
|
||||
ApplyImpact(wallImpact, -collisionNormal, contact);
|
||||
|
||||
Vector2 n;
|
||||
FixedArray2<Vector2> particlePos;
|
||||
contact.GetWorldManifold(out n, out particlePos);
|
||||
|
||||
int particleAmount = (int)(wallImpact*10.0f);
|
||||
for (int i = 0; i < particleAmount; i++)
|
||||
{
|
||||
var particle = GameMain.ParticleManager.CreateParticle("iceshards",
|
||||
ConvertUnits.ToDisplayUnits(particlePos[0]) + Rand.Vector(Rand.Range(1.0f, 50.0f)),
|
||||
Rand.Vector(Rand.Range(50.0f,500.0f)) + Velocity);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user