コード例 #1
0
 void OnCollisionEnter(Collision col)
 {
     Debug.Log(col.transform.name);
     if (col.transform.tag == "NPC")
     {
         Debug.Log(col.transform.name);
         if (dp != null)
         {
             dp.ProvideDamage(col.transform);
         }
         Debug.Log("Ho colpito collision");
     }
 }
コード例 #2
0
    void OnCollisionEnter(Collision col)
    {
        if (canBounce)
        {
            BulletBouncer bb = col.transform.GetComponent <BulletBouncer> ();
            if (bb != null && bb.active)
            {
                if (bb.target != null)
                {
                    Rigidbody br = transform.GetComponent <Rigidbody> ();
                    br.velocity = (bb.target.position - transform.position).normalized * br.velocity.magnitude;
                }
                return;
            }
        }
        ExplosionGenerator eg = GetComponent <ExplosionGenerator> ();

        if (eg != null)
        {
            eg.Detonate(col.transform);
        }
        if (dp != null)
        {
            dp.ProvideDamage(col.transform);
        }
        Destroy(gameObject);
    }
コード例 #3
0
 public void Fire(Transform t)
 {
     if (bigTimer <= 0f)
     {
         end = t == null ? transform.position + transform.root.forward * maxDistance : t.position;
         if (dp != null)
         {
             dp.ProvideDamage(t);
         }
         bigTimer = totalDuration;
     }
 }
コード例 #4
0
 public void attack()
 {
     if (currentTarget != null)
     {
         Debug.Log("SONO: " + currentTarget.gameObject.name);
         dp.ProvideDamage(currentTarget);
     }
     else
     {
         Debug.Log("Nessun Target");
     }
 }
コード例 #5
0
 void OnCollisionEnter(Collision col)
 {
     if (onContact)
     {
         ExplosionGenerator eg = GetComponent <ExplosionGenerator> ();
         if (eg != null)
         {
             eg.Detonate(null);
         }
         if (dp != null)
         {
             dp.ProvideDamage(col.transform);
         }
         Destroy(gameObject);
     }
 }