deactivate object when click anywhere else

I want to do something like that:
there is a grid, and there are cannons on it. I want to make it so that when I click on one cannon it activates and then I can shoot with it by pressing space (shooting is already done) as well as it deactivates whichever cannon that was previously activated. So that only one cannon is active at a time. And if I click somewhere else (not on cannon) it deactivates all cannons.

You can use queue or list to de-activate previous GameObject(Cannon). but if you want to make it in easy way just deactivate all the cannon when you click on cannon or anywhere else and re-activate just on cannon.