Example #1
0
        /// <summary>
        /// Check emit particles.
        /// </summary>
        private void EmitCheck()
        {
            if (_prevPos == default(Vector3))
            {
                _prevPos = transform.position;
                return;
            }

            Vector3 delta = transform.position - _prevPos;

            if (delta.sqrMagnitude < _sqrDistanceThreshold)
            {
                return;
            }

            float   len = delta.magnitude;
            Vector3 dir = delta.normalized;

            for (float t = 0; t <= _distanceThreshold; t += 0.05f)
            {
                _particle.Emit(new ParticleParam
                {
                    Position = _prevPos + (dir * t),
                    Delay    = 0,
                    Color    = ColorVec,
                }, _particleCount);
            }

            _prevPos = transform.position;
        }
 /// <summary>
 /// Emit particles.
 /// </summary>
 public void Emit()
 {
     _particle.Emit(new ParticleParam
     {
         Position = transform.position,
         Delay    = 0,
         Color    = ColorVec,
     }, _countPerParticle);
 }