Esempio n. 1
0
 protected virtual void OnCollisionEnter(Collision collision)
 {
     if (collision != null)
     {
         if (ragdoll && ragdoll.isActive)
         {
             ragdoll.OnRagdollCollisionEnter(new vRagdollCollision(this.gameObject, collision));
         }
     }
 }
Esempio n. 2
0
        void OnCollisionEnter(Collision collision)
        {
            if (collision != null)
            {
                if (ragdoll && ragdoll.isActive)
                {
                    ragdoll.OnRagdollCollisionEnter(new vRagdollCollision(this.gameObject, collision));
                    if (!inAddDamage)
                    {
                        float impactforce = collision.relativeVelocity.x + collision.relativeVelocity.y + collision.relativeVelocity.z;
                        if (impactforce > 10 || impactforce < -10)
                        {
                            inAddDamage = true;
                            vDamage damage = new vDamage((int)Mathf.Abs(impactforce) - 10);
                            damage.ignoreDefense = true;
                            damage.sender        = collision.transform;
                            damage.hitPosition   = collision.contacts[0].point;

                            Invoke("ResetAddDamage", 0.1f);
                        }
                    }
                }
            }
        }