Disable Mouse click

Hello,

So basicly in my game i have a enviroment, i’m using the proton angrybots example, and i’m going to add a giant cube on my enviroment (invisable and no collider) so basicly if your in the cube you cant click the left button, i was wondering if anyone could help me with this, and when your out of the cube you can fire.

I got this code from another answer maybe it will help?

bool disableFiring = false;

float firingDisableDuration = 5.0f; // or whatever time you want

void MouseButtonPressed()
{
if( !disableFiring )
{
Fire();
disableFiring = true;
Invoke(“EnableFiring”, firingDisableDuration );
}
}

void EnableFiring()
{
disableFiring = false;
}

Well the code you list is designed to do autofire with a delay - but it would still work. Just set disableFiring when you are in the cube. Aren’t you going to want a collider for that though? Maybe on a different layer so it doesn’t affect your bullets?