I am shooting a ball at blocks, and there are 3 Mega Blocks that make the weapon stronger. On my Mega Block 1, if a collision is detected from the Bullet Ball I shot, run code. That works fine. Now, if Mega Block 1 (tag=MegaBlock01) was hit, do one code, if Mega Block 2 was hit, etc. I wanted to put this code block on each Mega Block so I don't have to write new code for each.
public void OnTriggerEnter(Collider other) // This code is on my Mega Blocks
{
if (other.CompareTag("BulletBall")) // The Ball has hit me
{
StartMegaWeapon01();
// What I want is:
// If my tag is MegaBlock01, run StartMegaWeapon01();
// If my tag is MegaBlock02, run StartMegaWeapon02();
}
}
I want a collision detection within a collision detection.