Exemple #1
0
 public void OnCollisionStay(Collision collision)
 {
     if ((collision.transform.tag == "Player") && (action == true))
     {
         Target_Player target = collision.transform.GetComponent <Target_Player>();
         if (target != null)
         {
             target.TakeDamage(damage);
             target.gameObject.GetComponent <Rigidbody>().AddForce(0, forceApplied, 0);
             Debug.Log("Hit one");
             action = false;
         }
     }
 }
Exemple #2
0
 public void OnCollisionStay(Collision collision)
 {
     if ((collision.transform.tag == "Player") && (action == true))
     {
         Target_Player target = collision.transform.GetComponent <Target_Player>();
         if (target != null)
         {
             target.TakeHealth(health);
             Debug.Log("Healed one");
             action = false;
             Destroy(gameObject);
         }
     }
 }
Exemple #3
0
    public void OnCollisionEnter(Collision collision)
    {
        if (collision.transform.tag == "Player")
        {
            Target_Player target = collision.transform.GetComponent <Target_Player>();



            if (target != null)
            {
                target.TakeDamage(damage);
                Debug.Log(damage);
                Destroy(gameObject);
            }
        }
        Destroy(gameObject);
    }