electricity bugfixes, destructable doors, ai improvements, removed rope, container changes
This commit is contained in:
@@ -31,12 +31,18 @@ namespace Subsurface.Particles
|
||||
private Vector2 drawPosition;
|
||||
|
||||
private float checkCollisionTimer;
|
||||
|
||||
|
||||
public bool InWater
|
||||
{
|
||||
get { return prefab.inWater; }
|
||||
}
|
||||
|
||||
public Vector2 yLimits
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Vector2 Size
|
||||
{
|
||||
get { return size; }
|
||||
@@ -49,7 +55,7 @@ namespace Subsurface.Particles
|
||||
set { velocityChange = value; }
|
||||
}
|
||||
|
||||
public void Init(Vector2 position, float rotation, Vector2 speed, ParticlePrefab prefab)
|
||||
public void Init(ParticlePrefab prefab, Vector2 position, Vector2 speed, float rotation)
|
||||
{
|
||||
this.prefab = prefab;
|
||||
|
||||
@@ -73,13 +79,13 @@ namespace Subsurface.Particles
|
||||
|
||||
rand = (float)Game1.localRandom.NextDouble();
|
||||
sizeChange = prefab.sizeChangeMin + (prefab.sizeChangeMax - prefab.sizeChangeMin) * rand;
|
||||
|
||||
|
||||
yLimits = Vector2.Zero;
|
||||
|
||||
color = prefab.startColor;
|
||||
alpha = prefab.startAlpha;
|
||||
|
||||
velocityChange = prefab.velocityChange;
|
||||
|
||||
velocityChange = prefab.velocityChange;
|
||||
}
|
||||
|
||||
public bool Update(float deltaTime)
|
||||
@@ -110,6 +116,14 @@ namespace Subsurface.Particles
|
||||
color.G / 255.0f + prefab.colorChange.Y * deltaTime,
|
||||
color.B / 255.0f + prefab.colorChange.Z * deltaTime);
|
||||
|
||||
if (yLimits!=Vector2.Zero)
|
||||
{
|
||||
if (position.Y>yLimits.X || position.Y<yLimits.Y)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (prefab.deleteOnHit)
|
||||
{
|
||||
if (checkCollisionTimer > 0.0f)
|
||||
|
||||
@@ -40,12 +40,12 @@ namespace Subsurface.Particles
|
||||
}
|
||||
}
|
||||
|
||||
public Particle CreateParticle(Vector2 position, float angle, float speed, string prefabName)
|
||||
public Particle CreateParticle(string prefabName, Vector2 position, float angle, float speed)
|
||||
{
|
||||
return CreateParticle(position, angle, new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)) * speed, prefabName);
|
||||
return CreateParticle(prefabName, position, new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)) * speed, angle);
|
||||
}
|
||||
|
||||
public Particle CreateParticle(Vector2 position, float rotation, Vector2 speed, string prefabName)
|
||||
public Particle CreateParticle(string prefabName, Vector2 position, Vector2 speed, float rotation=0.0f)
|
||||
{
|
||||
ParticlePrefab prefab;
|
||||
prefabs.TryGetValue(prefabName, out prefab);
|
||||
@@ -56,17 +56,17 @@ namespace Subsurface.Particles
|
||||
return null;
|
||||
}
|
||||
|
||||
return CreateParticle(position, rotation, speed, prefab);
|
||||
return CreateParticle(prefab, position, speed, rotation);
|
||||
}
|
||||
|
||||
public Particle CreateParticle(Vector2 position, float rotation, Vector2 speed, ParticlePrefab prefab)
|
||||
public Particle CreateParticle(ParticlePrefab prefab, Vector2 position, Vector2 speed, float rotation=0.0f)
|
||||
{
|
||||
if (!Map.RectContains(cam.WorldView, ConvertUnits.ToDisplayUnits(position))) return null;
|
||||
if (particleCount >= MaxParticles) return null;
|
||||
|
||||
if (particles[particleCount] == null) particles[particleCount] = new Particle();
|
||||
|
||||
particles[particleCount].Init(position, rotation, speed, prefab);
|
||||
particles[particleCount].Init(prefab, position, speed, rotation);
|
||||
|
||||
particleCount++;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user