3. Save the script.
By keeping all of an object’s critical information on the object itself, it is generally easier to maintain. In other words, it’s easier to modify, easier to understand, and easier to make modular.
Let’s look at a few of the variables to find out what they represent and how they are being stored. Most are pretty self-explanatory, but a few are definitely abstract.
State of Being/Location
You added a variable called location along with the other state-related variables. It will tell you the abstract state of the object in the scene—whether it can be picked, if it’s in inventory or being used as a cursor, if it’s currently visible, and other esoteric information not necessarily related to its physical state. For want of a better term (as you are already using the term state), it’s called location. You will be assigning a number to represent each of the possibilities.
Location: