void Update() { if (Input.GetMouseButton(0)) { if (EventSystem.current.IsPointerOverGameObject()) { return; } Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); tile curTile = GetTile(Mathf.RoundToInt(mousePos.x), Mathf.RoundToInt(mousePos.y)); if (curTile != null) { // Debug.Log(curTile.getPos()); SpriteRenderer sprt = curTile.obj.GetComponent <SpriteRenderer>(); curTile.setState(state); if (curTile.isGoals()) { end = curTile; curTile.spriteRenderer.color = Color.green; } else if (curTile.isStart()) { start = curTile; curTile.spriteRenderer.color = Color.red; } else if (curTile.isWalkable()) { curTile.spriteRenderer.color = Color.white; } else { curTile.spriteRenderer.color = Color.black; } Debug.Log(state); } } if (Input.GetMouseButton(2)) { Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); tile curTile = GetTile(Mathf.RoundToInt(mousePos.x), Mathf.RoundToInt(mousePos.y)); if (curTile != null) { Debug.Log(curTile.state); Debug.Log(curTile.isGoals()); } } if (SolveType) { TypeText.text = "Depth First Search"; } else { TypeText.text = "Breath First Search"; } }