Added a particle trail to railgun shells

This commit is contained in:
Regalis
2016-10-09 15:13:41 +03:00
parent e720fa366c
commit f4c5c5e542
4 changed files with 39 additions and 1 deletions
@@ -82,6 +82,10 @@
<Projectile launchimpulse="80.0">
<Attack damage="100" bleedingdamage="10" structuredamage="200" damagetype="Blunt"/>
<StatusEffect type="OnActive" target="This">
<ParticleEmitter particle="bubbles" anglemin="0" anglemax="360" particleamount="10" velocitymin="0" velocitymax="50" scalemin="2" scalemax="5"/>
</StatusEffect>
</Projectile>
<ItemContainer hideitems="true" capacity="1" canbeselected = "true">
@@ -110,9 +114,14 @@
<Projectile launchimpulse="80.0">
<Attack damage="1000" bleedingdamage="10" structuredamage="200" damagetype="Blunt"/>
<StatusEffect type="OnUse" Condition="-100.0" stun="10.0" disabledeltatime="true" sound="Content/Items/Weapons/bigexplosion.ogg">
<Explosion range="1000.0" structuredamage="1000" damage="1000" stun="10" force="50.0"/>
</StatusEffect>
<StatusEffect type="OnActive" target="This">
<ParticleEmitter particle="bubbles" anglemin="0" anglemax="360" particleamount="10" velocitymin="0" velocitymax="50" scalemin="2" scalemax="5"/>
</StatusEffect>
</Projectile>
<ItemContainer hideitems="true" capacity="1" canbeselected = "true">
@@ -88,6 +88,8 @@ namespace Barotrauma.Items.Components
item.body.CollisionCategories = Physics.CollisionProjectile;
item.body.CollidesWith = Physics.CollisionCharacter | Physics.CollisionWall | Physics.CollisionLevel;
IsActive = true;
if (stickJoint == null || !doesStick) return;
if (stickTarget != null)
@@ -111,6 +113,8 @@ namespace Barotrauma.Items.Components
public override void Update(float deltaTime, Camera cam)
{
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
if (stickJoint != null && stickJoint.JointTranslation < 0.01f)
{
if (stickTarget != null)
@@ -174,6 +178,8 @@ namespace Barotrauma.Items.Components
ApplyStatusEffects(ActionType.OnUse, 1.0f);
ApplyStatusEffects(ActionType.OnImpact, 1.0f);
IsActive = false;
item.body.FarseerBody.OnCollision -= OnProjectileCollision;
item.body.FarseerBody.IsBullet = false;
+5
View File
@@ -309,6 +309,11 @@ namespace Barotrauma
{
crackColor = Color.Red;
}
else if (highlightedLocation != currentLocation &&
(connection.Locations.Contains(highlightedLocation) && connection.Locations.Contains(currentLocation)))
{
crackColor = Color.Red * 0.5f;
}
else if (!connection.Passed)
{
crackColor *= 0.2f;
+19 -1
View File
@@ -15,6 +15,8 @@ namespace Barotrauma.Particles
public readonly float VelocityMin, VelocityMax;
public readonly float ScaleMin, ScaleMax;
public readonly float ParticleAmount;
public ParticleEmitterPrefab(XElement element)
@@ -37,6 +39,17 @@ namespace Barotrauma.Particles
AngleMin = MathHelper.ToRadians(AngleMin);
AngleMax = MathHelper.ToRadians(AngleMax);
if (element.Attribute("scalemin")==null)
{
ScaleMin = 1.0f;
ScaleMax = 1.0f;
}
else
{
ScaleMin = ToolBox.GetAttributeFloat(element,"scalemin",1.0f);
ScaleMax = Math.Max(ScaleMin, ToolBox.GetAttributeFloat(element, "scalemax", 1.0f));
}
if (element.Attribute("velocity") == null)
{
VelocityMin = ToolBox.GetAttributeFloat(element, "velocitymin", 0.0f);
@@ -58,7 +71,12 @@ namespace Barotrauma.Particles
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, 0.0f, hullGuess);
var particle = GameMain.ParticleManager.CreateParticle(particlePrefab, position, velocity, 0.0f, hullGuess);
if (particle!=null)
{
particle.Size *= Rand.Range(ScaleMin, ScaleMax);
}
}
}
}