help dynamic interface c#

Hello,

I’m making a simple point and click adventure(Monkey Island). I’m very new to coding and have given myself the assignment to make this type of game because it seems easier than many other games and is a lot of fun to do.

What I’m trying to achieve:
In these games, the interface is always showing each option of interaction
( http://bulk.destructoid.com/ul/113597-the-memory-card-46-insult-swordfighting-/Monkey%20Island%20-%20Start%20of%20Game-468x.jpg ); open, close, pick up, turn on, etc.
But a lot of these things wouldn’t actually do anything.

I’m looking for a way to make this interface so that only the “actions” that actually work will show up on the screen.
for example: you can eat a fish, but not turn it off.
you can turn off a lightbulb, but not eat it.

my idea:
*make a base item class with methods for each action
*make a collection class to collect the details of each object in the game to fill in the methods in the base class (only filling in the ones needed)
*a GUI class that loads the buttons according to the available actions for the object you are standing next to.

I’ve been succesful in making the GUI and functionality behind it, but I have no idea how to tackle the collection and handling of the items.
It would be great if someone can push/point me in the right direction because I’ve been walking into walls for weeks now.

Thanks for your time!

There must be, as always is coding, a lot of ways to do that. Here is what I would do :

  • Set a flag of every object you can interact with (an apple => eat | pickup, a door => knock | open etc).
  • Each frame, get an array of every objects close enough, then add all the flags (flag = apple.flags | door.flags).
  • Finally, before displaying each actions, check if it’s flag is turned on (if( pickup = flags & pickup) if( GUI.Button…

If you find a better idea, go for it !