public override void ProcessAnimationEvent(CRAnimationEvData aeData)
    {
      if (enabled)
      {
        CRContactEvData ceData = (CRContactEvData) aeData;

#if UNITY_5_4_OR_NEWER
        emitParams_.position = ceData.position_;
#endif

        float numParticles = 0;
        //emit particles based on the selected magnitude of the contact   
        switch (magnitude_)
        {
          case EMagnitude.RelativeVeloctiyN:
            numParticles = (int)(ceData.relativeSpeed_N_ * emitfactor_);
            break;
          case EMagnitude.RelativeVelocityT:
            numParticles = (int)(ceData.relativeSpeed_T_ * emitfactor_);
            break;
          case EMagnitude.RelativeMomentumN:
            numParticles = (int)(ceData.relativeP_N_ * emitfactor_);
            break;
          case EMagnitude.RelativeMomentumT:
            numParticles = (int)(ceData.relativeP_T_ * emitfactor_);
            break;     
        }

#if UNITY_5_4_OR_NEWER
        particleSystem_.Emit(emitParams_, (int)numParticles);
#else
        particleSystem_.transform.localPosition = ceData.position_;
        particleSystem_.Emit((int)numParticles);
#endif 

      }
    }
示例#2
0
 public abstract void ProcessAnimationEvent(CRAnimationEvData aeData);