Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Monopoly Game-Access board tiles using sprites?

Discussion in '2D' started by kantescore, Jun 14, 2019.

  1. kantescore

    kantescore

    Joined:
    Dec 4, 2018
    Posts:
    7
    hey everybody,

    i made a monopoly board with vector points,classes (of board,tile,player,dice,game,dice rolls) so basically the player can move arround
    the board, buy properties,pay basic property rent.the next step i want to enable players to build houses and hotel in every owned street(have methods to check if player owns the entire city to build houses or hotels).the board game itself is an image of a monopoly board.
    i placed a transparent sprite in each square on the board and would like to write a script for every sprite that once you click a sprite a panel will be opened and show the TILE class information.
    i want to know how to connect between TILE class and the sprite ... can i address the sprite as a gameobject
    and then attach it as a class property of TILE ? it sounds like a not-so elegant solution but i'm kinda lost here..

    any help will be appreciated
     
  2. coidevoid

    coidevoid

    Joined:
    Oct 26, 2017
    Posts:
    46
    I don't really understand what's your issue here.
    You said you placed some transparent sprite on every square of the board so you already have your GameObject,
    you can just make a class called "Tile" and then just create other classes that inherit from this class.

    So you'll have a class Tile that contains the "MouseOver" event and display the information of the tile
    and just override it in the class that inherits it to add more information / options (like build) to it ?

    Let me know if that helps