Пример #1
0
    void OnTriggerEnter(Collider target)
    {
        BattleDamage damage = target.gameObject.GetComponent <BattleDamage>();

        if (damage)
        {
            damage.TakeDamage(target, hitDamage);
            m_splatSound.Play();
        }
    }
Пример #2
0
    void OnCollisionEnter(Collision target)
    {
        //Debug.Log(ToString() + " bitch slapping collision target " + target.gameObject.ToString() + " with impulse " + target.impulse.ToString() + " and relative velocity " + target.relativeVelocity.ToString());
        BattleDamage damage = target.gameObject.GetComponent <BattleDamage>();

        if (damage)
        {
            damage.TakeDamage(target.collider, hitDamage);
            m_splatSound.Play();
        }
    }
Пример #3
0
 //Shoot calculates the initial ballistics direction
 public void Shoot()
 {
     // Check if our raycast has hit anything
     if (targetHit)
     {
         //Debug.Log("Target hit at " + hitTarget.distance + "m at collider " + hitTarget.collider.ToString() + " belonging to " + hitTarget.collider.gameObject.name);
         BattleDamage battleDamage = hitTarget.collider.gameObject.GetComponent <BattleDamage>();
         if (battleDamage)
         {
             //damage the target
             battleDamage.TakeDamage(hitTarget, damagePoint);
         }
     }
 }