Positioning out-of-sub particles relative to the level, easier to climb stairs

This commit is contained in:
Regalis
2015-11-22 17:11:13 +02:00
parent 1eaf22d3d0
commit 77024a31fb
17 changed files with 41 additions and 33 deletions

View File

@@ -939,6 +939,9 @@
<None Include="Content\Items\Weapons\smack.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Items\Weapons\stunbaton.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Items\Weapons\stungrenade.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

Binary file not shown.

View File

@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.6.0")]
[assembly: AssemblyFileVersion("0.2.6.0")]
[assembly: AssemblyVersion("0.2.6.2")]
[assembly: AssemblyFileVersion("0.2.6.2")]

View File

@@ -353,12 +353,12 @@ namespace Barotrauma
GameMain.ParticleManager.CreateParticle("blood",
Position,
particleVel * Rand.Range(100.0f, 300.0f));
particleVel * Rand.Range(100.0f, 300.0f), 0.0f, character.AnimController.CurrentHull);
}
for (int i = 0; i < bloodAmount / 2; i++)
{
GameMain.ParticleManager.CreateParticle("waterblood", Position, Vector2.Zero);
GameMain.ParticleManager.CreateParticle("waterblood", Position, Vector2.Zero, 0.0f, character.AnimController.CurrentHull);
}
damage += Math.Max(amount,bleedingAmount) / character.MaxHealth * 100.0f;

View File

@@ -612,24 +612,19 @@ namespace Barotrauma
}
}
//the limb has gone through the surface of the water
if (Math.Abs(limb.LinearVelocity.Y) > 3.0 && inWater != prevInWater)
if (Math.Abs(limb.LinearVelocity.Y) > 5.0f && inWater != prevInWater)
{
//create a splash particle
GameMain.ParticleManager.CreateParticle("watersplash",
new Vector2(limb.Position.X, limbHull.Surface),
new Vector2(0.0f, Math.Abs(-limb.LinearVelocity.Y * 10.0f)),
0.0f);
//if (splash != null) splash.yLimits = ConvertUnits.ToSimUnits(
// new Vector2(
// limbHull.Rect.Y,
// limbHull.Rect.Y - limbHull.Rect.Height));
0.0f, limbHull);
GameMain.ParticleManager.CreateParticle("bubbles",
new Vector2(limb.Position.X, limbHull.Surface),
limb.LinearVelocity*0.001f,
0.0f);
0.0f, limbHull);

View File

@@ -89,7 +89,7 @@ namespace Barotrauma.Items.Components
if (!string.IsNullOrWhiteSpace(particles))
{
GameMain.ParticleManager.CreateParticle(particles, item.Position,
item.body.Rotation + ((item.body.Dir > 0.0f) ? 0.0f : MathHelper.Pi), 0.0f);
item.body.Rotation + ((item.body.Dir > 0.0f) ? 0.0f : MathHelper.Pi), 0.0f, item.CurrentHull);
}
return true;

View File

@@ -75,7 +75,8 @@ namespace Barotrauma.Items.Components
for (int i = 0; i < 5; i++)
{
GameMain.ParticleManager.CreateParticle("bubbles", item.Position,
-currForce/5.0f + new Vector2(Rand.Range(-100.0f, 100.0f), Rand.Range(-50f, 50f)));
-currForce / 5.0f + new Vector2(Rand.Range(-100.0f, 100.0f), Rand.Range(-50f, 50f)),
0.0f, item.CurrentHull);
}
}

View File

@@ -164,7 +164,7 @@ namespace Barotrauma.Items.Components
for (int i = 0; i < 10; i++)
{
var particle = GameMain.ParticleManager.CreateParticle("spark", item.Position,
baseVel + Rand.Vector(100.0f), 0.0f);
baseVel + Rand.Vector(100.0f), 0.0f, item.CurrentHull);
if (particle != null) particle.Size *= Rand.Range(0.5f, 1.0f);
}

View File

@@ -68,7 +68,7 @@ namespace Barotrauma.Items.Components
for (int i = 0; i < 10; i++)
{
var particle = GameMain.ParticleManager.CreateParticle("spark", pt.item.Position,
baseVel + Rand.Vector(100.0f), 0.0f);
baseVel + Rand.Vector(100.0f), 0.0f, item.CurrentHull);
if (particle != null) particle.Size *= Rand.Range(0.5f, 1.0f);
}

View File

@@ -43,25 +43,26 @@ namespace Barotrauma
public void Explode(Vector2 simPosition)
{
Vector2 displayPosition = ConvertUnits.ToDisplayUnits(simPosition);
Hull hull = Hull.FindHull(displayPosition);
if (shockwave)
{
GameMain.ParticleManager.CreateParticle("shockwave", displayPosition,
Vector2.Zero, 0.0f);
Vector2.Zero, 0.0f, hull);
}
for (int i = 0; i < attack.Range * 10; i++)
{
if (sparks)
{
GameMain.ParticleManager.CreateParticle("spark", displayPosition,
Rand.Vector(Rand.Range(500.0f, 800.0f)), 0.0f);
Rand.Vector(Rand.Range(500.0f, 800.0f)), 0.0f, hull);
}
if (flames)
{
GameMain.ParticleManager.CreateParticle("explosionfire", displayPosition + Rand.Vector(50f),
Rand.Vector(Rand.Range(50f, 100.0f)), 0.0f);
Rand.Vector(Rand.Range(50f, 100.0f)), 0.0f, hull);
}
}
@@ -80,8 +81,6 @@ namespace Barotrauma
if (force == 0.0f && attack.Stun == 0.0f && attack.GetDamage(1.0f) == 0.0f) return;
//Hull hull = Hull.FindHull(displayPosition);
foreach (Character c in Character.CharacterList)
{
float dist = Vector2.Distance(c.SimPosition, simPosition);

View File

@@ -254,7 +254,7 @@ namespace Barotrauma
UpdateRoomToRoom(deltaTime);
}
if (FlowForce.Length() > 150.0f && flowTargetHull != null && flowTargetHull.Volume < flowTargetHull.FullVolume)
if (LerpedFlowForce.Length() > 150.0f && flowTargetHull != null && flowTargetHull.Volume < flowTargetHull.FullVolume)
{
//UpdateFlowForce();

View File

@@ -271,7 +271,7 @@ namespace Barotrauma
{
GameMain.ParticleManager.CreateParticle("mist",
new Vector2(rect.X + WaveWidth * i,surface + waveY[i]),
new Vector2(0.0f, -50.0f));
new Vector2(0.0f, -50.0f), 0.0f, this);
}
waveY[i] = waveY[i] + waveVel[i];

View File

@@ -73,6 +73,9 @@ namespace Barotrauma.Particles
spriteIndex = Rand.Int(prefab.Sprites.Count);
currentHull = Hull.FindHull(position, hullGuess);
if (currentHull == null) position = Submarine.Loaded == null ? position : position + Submarine.Loaded.Position;
this.position = position;
prevPosition = position;
@@ -102,8 +105,6 @@ namespace Barotrauma.Particles
if (prefab.DeleteOnCollision || prefab.CollidesWithWalls)
{
currentHull = Hull.FindHull(position, hullGuess);
hullGaps = currentHull==null ? new List<Gap>() : currentHull.FindGaps();
//hullLimits = new List<Hull>();
//hullLimits = FindLimits(position);
@@ -253,7 +254,6 @@ namespace Barotrauma.Particles
public void Draw(SpriteBatch spriteBatch)
{
drawPosition = Physics.Interpolate(prevPosition, position);
drawPosition.Y = -drawPosition.Y;
float drawRotation = Physics.Interpolate(prevRotation, rotation);
//drawPosition = ConvertUnits.ToDisplayUnits(drawPosition);
@@ -263,10 +263,14 @@ namespace Barotrauma.Particles
if (prefab.GrowTime>0.0f && totalLifeTime-lifeTime < prefab.GrowTime)
{
drawSize *= ((totalLifeTime - lifeTime) / prefab.GrowTime);
}
prefab.Sprites[spriteIndex].Draw(spriteBatch, drawPosition, color * alpha,
Vector2 screenSpacePos = currentHull == null && Submarine.Loaded != null ? drawPosition - Submarine.Loaded.Position : drawPosition;
screenSpacePos.Y = -screenSpacePos.Y;
prefab.Sprites[spriteIndex].Draw(spriteBatch,
screenSpacePos,
color * alpha,
prefab.Sprites[spriteIndex].origin, drawRotation,
drawSize, SpriteEffects.None, prefab.Sprites[spriteIndex].Depth);

View File

@@ -51,14 +51,14 @@ namespace Barotrauma.Particles
ParticleAmount = ToolBox.GetAttributeInt(element, "particleamount", 1);
}
public void Emit(Vector2 position)
public void Emit(Vector2 position, Hull hullGuess = null)
{
for (int i = 0; i<ParticleAmount; i++)
{
float angle = Rand.Range(AngleMin, AngleMax);
Vector2 velocity = new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)) * Rand.Range(VelocityMin, VelocityMax);
GameMain.ParticleManager.CreateParticle(particlePrefab, position, velocity);
GameMain.ParticleManager.CreateParticle(particlePrefab, position, velocity, 0.0f, hullGuess);
}
}
}

View File

@@ -47,9 +47,9 @@ namespace Barotrauma.Particles
}
}
public Particle CreateParticle(string prefabName, Vector2 position, float angle, float speed)
public Particle CreateParticle(string prefabName, Vector2 position, float angle, float speed, Hull hullGuess = null)
{
return CreateParticle(prefabName, position, new Vector2((float)Math.Cos(angle), (float)-Math.Sin(angle)) * speed, angle);
return CreateParticle(prefabName, position, new Vector2((float)Math.Cos(angle), (float)-Math.Sin(angle)) * speed, angle, hullGuess);
}
public Particle CreateParticle(string prefabName, Vector2 position, Vector2 speed, float rotation=0.0f, Hull hullGuess = null)

View File

@@ -1,3 +1,9 @@
---------------------------------------------------------------------------------------------------------
v0.2.6.2
---------------------------------------------------------------------------------------------------------
- added missing stunbaton sound file
---------------------------------------------------------------------------------------------------------
v0.2.6.1
---------------------------------------------------------------------------------------------------------

Binary file not shown.