コード例 #1
0
    private void OnCollisionEnter(Collision collision)
    {
        // Do not hit itself
        if (collision.collider.transform.root == transform.root)
        {
            return;
        }

        damageController.CalculateImpactDamage(collision, this);

        if (collision.gameObject.GetComponent <TouchDamage>())
        {
            // add to any existing touch damage incase player is touching multiple touch damage bearing gameobjects
            damageController.AddTouchDamage(collision.gameObject.GetComponent <TouchDamage>().touchDamage *damageMultiplier);
        }
    }