示例#1
0
 void Update()
 {
     for (int i = 0; i < _particleReference.Count; i++)
     {
         ParticleInformation tParticleInformation = _particleReference[ParticleType.DASH + i];
         if (_ticks[i] > tParticleInformation.Tick)
         {
             Reset(ParticleType.DASH + i);
             _ticks[i] = 0;
         }
         if (tParticleInformation.Tick != 0)
         {
             _ticks[i]++;
         }
     }
     for (int i = 0; i < _particles.Count; i++)
     {
         if (_particles[i].IsDestroyable)
         {
             if (!_particles[i].ParticleSystem.IsAlive())
             {
                 _particles[i].Remove();
                 _particles.Remove(_particles[i]);
             }
         }
     }
 }
示例#2
0
 /// <summary>
 /// Spawn particles
 /// </summary>
 /// <param name="iParticleType">In particle type.</param>
 /// <param name="iPosition">In particle position.</param>
 public void SpawnParticle(ParticleType iParticleType, Vector3 iPosition, bool iIsDestroyable = false)
 {
     if (iIsDestroyable)
     {
         ParticleInformation tParticleInformation = GenerateDestroyableParticle(iParticleType);
         tParticleInformation.SetParticlePosition(iPosition);
     }
     else
     {
         _particleReference[iParticleType].SetParticlePosition(iPosition);
     }
 }
示例#3
0
 /// <summary>
 /// Spawns the particle assigned to object.
 /// </summary>
 /// <param name="iParticleType">I particle type.</param>
 /// <param name="iTransform">I transform.</param>
 public void SpawnParticleAssignedToObject(ParticleType iParticleType, Transform iTransform, bool iIsDestroyable = false)
 {
     if (iIsDestroyable)
     {
         ParticleInformation tParticleInformation = GenerateDestroyableParticle(iParticleType);
         tParticleInformation.SetParticleParent(iTransform, iTransform.localRotation.eulerAngles);
     }
     else
     {
         _particleReference[iParticleType].SetParticleParent(iTransform, iTransform.localRotation.eulerAngles);
     }
 }
示例#4
0
    private ParticleInformation GenerateDestroyableParticle(ParticleType iParticleType)
    {
        GameObject tParticle = (GameObject)Resources.Load(ParticlePaths.PARTICLES[(int)iParticleType]);

        if (tParticle == null)
        {
            Debug.LogError("Could not find Particle prefab of: " + iParticleType);
        }
        else
        {
            ParticleInformation tParticleInformation = new ParticleInformation(tParticle);
            tParticleInformation.IsDestroyable = true;
            _particles.Add(tParticleInformation);
            return(tParticleInformation);
        }
        return(null);
    }