//gets tile position in world space Vector3 GetWorldTilePos(Tile tile) { Vector3 worldPos = GridBoard.CalcWorldPosFromCoords(tile.X, tile.Y); //y coordinate is disregarded worldPos.y = 0; return(worldPos); }
public void Init(int x, int y) { X = x; Y = y; var t = gameObject.transform; t.SetParent(null); t.localPosition = GridBoard.CalcWorldPosFromCoords(x, y); t.localRotation = Quaternion.identity; t.localScale = Vector3.one; t.SetParent(GridBoard.Instance.transform); gameObject.layer = GridBoard.Instance.gameObject.layer; }