void OnTriggerEnter2D(Collider2D hitInfo) { //Debug.Log(hitInfo.name); PlayerHealth Player = hitInfo.GetComponent <PlayerHealth>(); BlobScript blob = hitInfo.GetComponent <BlobScript>(); if (Player != null) { Player.TakeDamage(damage); Destroy(bullet); } if (hitInfo.tag == "Walls") { Destroy(bullet); } if (hitInfo.tag == "Blob") { blob.TakeDamage(damage); Destroy(bullet); } if (hitInfo.tag == "Bubble") { Destroy(bullet); } }
void OnTriggerEnter2D(Collider2D hitInfo) { //Debug.Log(hitInfo.name); EnemyHealth enemy = hitInfo.GetComponent <EnemyHealth>(); BlobScript blob = hitInfo.GetComponent <BlobScript>(); if (enemy != null) { enemy.TakeDamage(damage); Destroy(bullet); } if (hitInfo.tag == "Walls") { Destroy(bullet); } if (hitInfo.tag == "Blob") { blob.TakeDamage(damage); Destroy(bullet); } if (hitInfo.tag == "Mold") { Destroy(bullet); } }