示例#1
0
    private void OnTriggerStay(Collider other)
    {
        HP hp = other.GetComponent <HP>();

        if (hp)
        {
            if (other.tag == "Player")
            {
                if (characterStatus.isInCar == false)
                {
                    float damage = (modul(rigidbody.velocity) - smallestSpeed) * kDamage;
                    if (damage > 0)
                    {
                        hp.Change(damage);
                    }
                }
            }
            else
            {
                CharacterNavigationController characterNavigationController = other.GetComponent <CharacterNavigationController>();
                if (characterNavigationController.isInCar == false)
                {
                    float damage = (modul(rigidbody.velocity) - smallestSpeed) * kDamage;
                    if (damage > 0)
                    {
                        hp.Change(damage);
                    }
                }
            }
        }
    }