Advice Needed for Monopoly Style Board Game

I would definitely have your GameManager know the tile as an index, then for any given tile, there would be a collection of related information:

  • what is the next tile after it (and maybe the previous if you want to move backwards?)
  • what GameObject holds the position (in the Transform)
  • that GameObject would also have additional scripts might be activated on it when you land on it (if any)

That last one is where all the interesting engineering will happen.

Using interfaces, you could completely divorce the player from even caring about what tile he landed on, like so:

  • player moves to tile X
  • tells game manager “I am on tile X”
  • the game manager would search for interfaces on the GameObject that could be landed upon

One interface might be an ILandable or IPurchaseable or others. Their presence would enable a “PURCHASE” button. This way cells you cannot purchase (like GO and Jail) wouldn’t have a purchaseable interface.

In general, keep everything separate and connect it all up with references and design good APIs between them so they all know only what they need to do their thing.

Using Interfaces in Unity3D:

Check Youtube for other tutorials about interfaces and working in Unity3D. It’s a pretty powerful combination.

1 Like