We need to correct the following issue: right now, all four elemental buttons are always enabled, which means a power source of fire can be re-switched to the same fire element. This makes no sense.
If the power source element is fire, then the fire elemental button should be visible, but non-interactive. We could simply disable the GameObject itself, but then the button would be invisible. We want it to be grayed out and transparent so that the player knows he/she cannot interact with it right now but still has knowledge of its existence.
This is what we need it to look like:
Let's see how we can achieve this through code.
First, we need to add a method to our GameManager
component, which will enable all buttons. Afterwards, we'll disable the power source's current element button. Open our GameManger.cs
script, and add this new EnableAllButtons()
method:
// Enable all elemental buttons
public void EnableAllButtons()
{
// For each elemental...