private void OnCollisionEnter(Collision other) { if (other.gameObject.CompareTag("FireGolem")) { fireGolem = other.gameObject.GetComponent <FireGolem>(); if (fireGolem != null) { fireGolem.DoDamage(1); } } else if (other.gameObject.CompareTag("IceGolem")) { iceGolem = other.gameObject.GetComponent <IceGolem>(); if (iceGolem != null) { iceGolem.DoDamage(6); } } else if (other.gameObject.CompareTag("Eye")) { EyeEnemy = other.gameObject.GetComponent <EyeEnemy>(); if (EyeEnemy != null) { EyeEnemy.DoDamage(3); } } else if (other.gameObject.CompareTag("GhostBoss")) { GhostBoss = other.gameObject.GetComponent <GhostBoss>(); if (GhostBoss != null) { GhostBoss.DoDamage(3); } } else if (other.gameObject.CompareTag("EnemyPhantom")) { PhantomEnemy = other.gameObject.GetComponent <PhantomEnemy>(); if (PhantomEnemy != null) { PhantomEnemy.DoDamage(3); } } else if (other.gameObject.CompareTag("FinalBoss")) { rb.velocity = Vector3.zero; rb.useGravity = true; } else if (other.gameObject.CompareTag("BossIceField")) { Destroy(gameObject); } else { rb.constraints = RigidbodyConstraints.FreezeAll; Destroy(gameObject, 3); } }
private void OnCollisionEnter(Collision other) { audioSrc.PlayOneShot(ArrowHit); if (other.gameObject.CompareTag("Enemy")) { rb.velocity = Vector3.zero; rb.useGravity = true; enemy = other.gameObject.GetComponent <EyeEnemy>(); enemy.DoDamage(1); } else { rb.constraints = RigidbodyConstraints.FreezeAll; } }
private void OnCollisionEnter(Collision other) { if (other.gameObject.CompareTag("FireGolem")) { rb.velocity = Vector3.zero; rb.useGravity = true; fireGolem = other.gameObject.GetComponent <FireGolem>(); if (fireGolem != null) { fireGolem.DoDamage(4); Destroy(gameObject, 2); } } else if (other.gameObject.CompareTag("IceGolem")) { rb.velocity = Vector3.zero; rb.useGravity = true; iceGolem = other.gameObject.GetComponent <IceGolem>(); if (iceGolem != null) { iceGolem.DoDamage(4); Destroy(gameObject, 2); } } else if (other.gameObject.CompareTag("Eye")) { rb.velocity = Vector3.zero; rb.useGravity = true; enemy = other.gameObject.GetComponent <EyeEnemy>(); if (enemy != null) { enemy.DoDamage(4); Destroy(gameObject, 2); } } else if (other.gameObject.CompareTag("GhostBoss")) { rb.velocity = Vector3.zero; rb.useGravity = true; GhostBoss = other.gameObject.GetComponent <GhostBoss>(); if (GhostBoss != null) { GhostBoss.DoDamage(4); Destroy(gameObject, 2); } } else if (other.gameObject.CompareTag("EnemyPhantom")) { rb.velocity = Vector3.zero; rb.useGravity = true; PhantomEnemy = other.gameObject.GetComponent <PhantomEnemy>(); if (PhantomEnemy != null) { PhantomEnemy.DoDamage(4); Destroy(gameObject, 2); } } else if (other.gameObject.CompareTag("FinalBoss")) { rb.useGravity = true; } else if (other.gameObject.CompareTag("BossIceField")) { Destroy(gameObject); } }