//Update is called every frame. void Update() { if (levelInit.isInitializing()) { return; } if (boardState.isLevelClear()) { levelSelector.loadLevelSelect(); } gameCounter++; if (gameCounter % 100 == 0) { //DrawTopColors(); //Debug.Log(string.Format("gameCounter {0}", gameCounter)); } if (!Input.GetKey("left ctrl") && !Input.GetMouseButton(1)) { lastMousePos = null; } if (Input.GetKey("left ctrl") || Input.GetMouseButton(1)) { //Debug.Log(string.Format("Co-ords of right click is [X: {0} Y: {1}]", pointClicked.x, pointClicked.y)); if (lastMousePos.HasValue) { Vector2 posDiff = mainCam.ScreenToWorldPoint(lastMousePos.Value) - mainCam.ScreenToWorldPoint(Input.mousePosition); moveMainCam(posDiff); //Debug.Log(string.Format("PosDiff {0} ", posDiff)); } //Debug.Log(string.Format("Co-ords of right click is [X: {0} Y: {1}]", pointClicked.x, pointClicked.y)); lastMousePos = Input.mousePosition; } else if (Input.GetMouseButtonDown(0)) { Vector3 pointClicked = Camera.main.ScreenToWorldPoint(Input.mousePosition); TileState tileState = boardState.getTileState(pointClicked); if (tileState != null) { Color color = tileState.getGameTile().getTileColor(); TileCapture bestTileMatch = boardState.processBombDrop(pointClicked, acm.getCurColor()); bombManager.addBomb(pointClicked, bestTileMatch, acm.getCurColor()); //Debug.Log(string.Format("Co-ords of mouse is [X: {0} Y: {1}] {2}", pointClicked.x, pointClicked.y, color.ToString())); } } }
public void paintBoardState() { Debug.Log("Painting board state"); // paint background tilemap for (int x = 0; x < boardDimensions.x; x++) { for (int y = 0; y < boardDimensions.y; y++) { TileState tileState = boardState[x, y]; if (tileState != null) { Tile tile = tileState.getGameTile().getTile(); tileManager.setBackgroundTile(tile, x, y); if (tileState.modifierTile != null) { tileManager.setModifierTile(tileState.modifierTile, x, y); } } } } }