public static IGameObject createGameObject(int row, int col, BallsTypes type, bool isPlayer = false) { IGameObject gameObject; switch (type) { case BallsTypes.Universal: gameObject = new UniversalBubble(type); break; default: gameObject = new Bubble(type); break; } Color32 color = getColor(type); Vector3 pos; if (isPlayer) { pos = FieldManager.findCoordsForPlayer(); } else { pos = FieldManager.findCoordsByRowCol(row, col); gameObject.row = row; gameObject.col = col; } gameObject.createShape(FieldManager.CELL_WIDTH * 0.5f, pos.x, pos.y, color, FieldManager.gamePivot); gameObject.setActive = true; return(gameObject); }
public static void setCoords(this IGameObject obj, int row, int col, bool isPlayer = false) { Vector3 pos; if (isPlayer) { pos = FieldManager.findCoordsForPlayer(); } else { pos = FieldManager.findCoordsByRowCol(row, col); obj.row = row; obj.col = col; } obj.view.localPosition = new Vector3(pos.x, pos.y, 0); }