private float shrinkFactor = 0.6f; // 1 is normal, 0.6 when pressed void Start() { rend = GetComponent <Renderer>(); tintScale = 1f; // set ref of CreatePuzzle CreatePuzzle = GameObject.Find("_LevelManager").GetComponent <CreatePuzzle>(); cellSize = CreatePuzzle.getCellSize(); // get cell size }
public void confirmedHintActivation() { int bSize = CreatePuzzle.bSize; float cellSize = CreatePuzzle.getCellSize() / 7.5f; // default float s = 68 / (bSize - 0.2f); // for positioning bool foundIt = false; // find the pos of next hint for (int y = bSize - 1; y > -1; y--) { if (!foundIt) { for (int x = 0; x < bSize; x++) { if (CreatePuzzle.solution2d[y, x] == hintRevealNum) { Canvas clone; clone = Instantiate(CanvasHintNum, new Vector3(s * (x - (bSize - 1) * 0.5f), -s * (y - (bSize - 1) * 0.5f) + 25, 0), Quaternion.Euler(0, 0, 0)); // set parent clone.transform.SetParent(ArrowsBoard.transform); // re-scale clone.transform.localScale = new Vector3(cellSize, cellSize, 0); // set text number clone.GetComponentInChildren <TextMeshProUGUI>().text = "" + hintRevealNum; hintRevealNum++; foundIt = true; break; } } } } int limit = bSize; if (limit == 5) { limit = 7; } if (hintRevealNum > limit) { hintObject.SetActive(false); hintButton.SetActive(false); } }