コード例 #1
0
ファイル: Attack.cs プロジェクト: ivananovakova/GenZzz
 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;
         }
     }
 }
コード例 #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);
         }
     }
 }
コード例 #3
0
ファイル: Attack_enemy.cs プロジェクト: ivananovakova/GenZzz
    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);
    }