예제 #1
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        AudioSource.PlayClipAtPoint(audio.clip, transform.position);
        Destroy(gameObject);
        DamageController damageController = collision.gameObject.GetComponent <DamageController>();

        if (damageController != null)
        {
            damageController.Damage(collideAttack);
        }
    }
예제 #2
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        AudioSource.PlayClipAtPoint(audio.clip, transform.position);
        Destroy(gameObject);
        DamageController damageController = collider.GetComponent <DamageController>();

        if (damageController != null)
        {
            if (!collider.CompareTag("Ground"))
            {
                damageController.Damage(damage);
            }
        }
    }
예제 #3
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Enemy")
     {
         print("Owie :c");
         damageNumbers.text = damageController.Damage(other.GetComponent <HealthController>()).ToString();
         Instantiate(damageNumbers, transform.position + new Vector3(UnityEngine.Random.Range(-1f, 1f), UnityEngine.Random.Range(-1f, 1f), UnityEngine.Random.Range(-1f, 1f)), Quaternion.LookRotation(Camera.main.transform.position - transform.position));
         other.GetComponent <BaddieController>().Bleed();
         Destroy(gameObject);
     }
     else if (!ignoreCollision.Contains(other.tag))
     {
         Destroy(gameObject);
     }
     else
     {
         print(other);
     }
 }
 //ダメージ判定
 protected virtual bool Hit(Transform hitTran)
 {
     return(dmgCtrl.Damage(damage, impact, myTran, hitTran, ownerTran));
 }