Y
Y
yraiv2022-02-18 12:29:19
Unity
yraiv, 2022-02-18 12:29:19

Is it possible to track in which object the static bool variable was turned off?

For several days I have been trying to implement the most common logic in all TD games.
There are several towers on the field. When a person clicks on the tower, the sprite turns on, which looks like a regular circle and shows the person the range of the tower. As planned, if a person clicks on an empty spot on the field or selects another tower, then the previous one should turn off the sprite with a range. Otherwise, it turns out that a person can choose several towers at once, and this is not at all correct.
I can't think of any logic to implement this. I want to try to do it through a static bool, and every time I check, when a person clicks on the tower, the value is true or false. If true, then I would like to find the object that assigned this value and turn it off, I understand that this is not the correct logic, but I could not find any other option that would suit me, please tell me how to implement this mechanic.. .

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question