@ -161,15 +161,15 @@ public class ParticleSystems
[SerializeField]
[SerializeField]
protected ParticleSystem teleportSplash ;
protected ParticleSystem teleportSplash ;
[SerializeField]
protected ParticleSystem lavaSplash ;
public virtual void RunParticleEffect ( Vector3 position , Vector3 direction , Color colorMin , Color colorMax , int count , Layers layer )
public virtual void RunParticleEffect ( Vector3 position , Vector3 direction , Color colorMin , Color colorMax , int count , Layers layer )
{
{
if ( particleEffect = = null )
var effect = InstantiateEffect ( particleEffect , position , layer ) ;
if ( effect = = null )
return ;
return ;
var effect = Object . Instantiate ( particleEffect ) ;
SetLayer ( effect . gameObject , layer ) ;
effect . transform . position = position ;
var main = effect . main ;
var main = effect . main ;
main . maxParticles = count ;
main . maxParticles = count ;
@ -189,22 +189,28 @@ public class ParticleSystems
public virtual void CreateExplosion ( Vector3 position , Layers layer )
public virtual void CreateExplosion ( Vector3 position , Layers layer )
{
{
if ( explosion = = null )
return ;
var effect = Object . Instantiate ( explosion ) ;
SetLayer ( effect . gameObject , layer ) ;
effect . transform . position = position ;
InstantiateEffect ( explosion , position , layer ) ;
}
}
public virtual void CreateTeleportSplash ( Vector3 position , Layers layer )
public virtual void CreateTeleportSplash ( Vector3 position , Layers layer )
{
{
if ( teleportSplash = = null )
return ;
InstantiateEffect ( teleportSplash , position , layer ) ;
}
public virtual void CreateLavaSplash ( Vector3 position , Layers layer )
{
InstantiateEffect ( lavaSplash , position , layer ) ;
}
protected virtual ParticleSystem InstantiateEffect ( ParticleSystem template , Vector3 position , Layers layer )
{
if ( template = = null )
return null ;
var effect = Object . Instantiate ( teleportSplash ) ;
var effect = Object . Instantiate ( template ) ;
SetLayer ( effect . gameObject , layer ) ;
SetLayer ( effect . gameObject , layer ) ;
effect . transform . position = position ;
effect . transform . position = position ;
return effect ;
}
}
protected static void SetLayer ( GameObject go , Layers layer )
protected static void SetLayer ( GameObject go , Layers layer )