|
|
|
@ -158,6 +158,9 @@ public class ParticleSystems |
|
|
|
[SerializeField] |
|
|
|
protected ParticleSystem explosion; |
|
|
|
|
|
|
|
[SerializeField] |
|
|
|
protected ParticleSystem rogueExplosion; |
|
|
|
|
|
|
|
[SerializeField] |
|
|
|
protected ParticleSystem teleportSplash; |
|
|
|
|
|
|
|
@ -172,14 +175,7 @@ public class ParticleSystems |
|
|
|
|
|
|
|
var main = effect.main; |
|
|
|
main.maxParticles = count; |
|
|
|
|
|
|
|
var startColor = main.startColor; |
|
|
|
startColor.gradient.colorKeys = new[] |
|
|
|
{ |
|
|
|
new GradientColorKey(colorMin, 0f), |
|
|
|
new GradientColorKey(colorMax, 1f), |
|
|
|
}; |
|
|
|
main.startColor = startColor; |
|
|
|
SetColorGradient(main, colorMin, colorMax); |
|
|
|
|
|
|
|
var velocity = effect.velocityOverLifetime; |
|
|
|
velocity.x = direction.x * 15f; |
|
|
|
@ -192,6 +188,15 @@ public class ParticleSystems |
|
|
|
InstantiateEffect(explosion, position, layer); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void CreateRogueExplosion(Vector3 position, Color colorMin, Color colorMax, Layers layer) |
|
|
|
{ |
|
|
|
var effect = InstantiateEffect(rogueExplosion, position, layer); |
|
|
|
if (effect == null) |
|
|
|
return; |
|
|
|
|
|
|
|
SetColorGradient(effect.main, colorMin, colorMax); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void CreateTeleportSplash(Vector3 position, Layers layer) |
|
|
|
{ |
|
|
|
InstantiateEffect(teleportSplash, position, layer); |
|
|
|
@ -223,4 +228,15 @@ public class ParticleSystems |
|
|
|
go.transform.GetChild(i).gameObject.layer = (int)layer; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected static void SetColorGradient(ParticleSystem.MainModule main, Color colorMin, Color colorMax) |
|
|
|
{ |
|
|
|
var startColor = main.startColor; |
|
|
|
startColor.gradient.colorKeys = new[] |
|
|
|
{ |
|
|
|
new GradientColorKey(colorMin, 0f), |
|
|
|
new GradientColorKey(colorMax, 1f), |
|
|
|
}; |
|
|
|
main.startColor = startColor; |
|
|
|
} |
|
|
|
} |