This page is still incomplete

Intro

Last post I was able to make a GameBoardGrid using BoardTile prefabs. Now I want to add units and be able to select and move them around.

Game Objects

First, we want to understand the game objects we’ll be creating, and understanding their role and where to put certain functions.

GameManager
Unit
BoardTile

Moving a Unit

These are my initial ideas on implementation before actually implementing it.

  1. gameManager enters idle state
  2. click on tile –> if idleState and containsUnit –> pass reference of self and unit to gameManager
  3. gameManager enters selectState
  4. click on tile –> if selectState and !containsUnit –> move unit to tile

How does the TicTacToe Tutorial handle Game Logic

BoardTile clicks() should always just report to the gameManager that a click event has occured. This indicates that a GameManager.handleTileClick() function would be useful. It should check take in the clicked tile position as an argument and check the GameManager’s state, whether or not it’s waiting for a tile to be selected or to initiate a Unit’s action functions.