private void OnGUI() { if (debugCostText) { Ray ray = MouseHook.mousehook.GetCamera().ScreenPointToRay(Input.mousePosition); RaycastHit hit; Physics.Raycast(ray, out hit); if (hit.collider != null) { Vector3Int hookPos = TerrainGen.GetGridPosition(hit.point); Vector2Int tilePos = Vector2Int.zero; tilePos.x = hookPos.x; tilePos.y = hookPos.z; List <Vector2Int> showHexes = TerrainGen.GetHexOffSetInRange(tilePos, 5); Vector2Int drawPos; string val; foreach (Vector2Int hex in showHexes) { Handles.color = Color.red; drawPos = hex + tilePos; PathNode node = pathGrids[PathType.normal][drawPos.x, drawPos.y]; val = "" + node.cost.Value; Handles.Label(TerrainGen.GetHexPosition(drawPos.x, drawPos.y), "" + val); Vector3 drawEnd = TerrainGen.GetHexPosition(node.from); if (node.from != Vector2Int.zero) { Vector3 angle = -MyMath.GetDirectionRatio(TerrainGen.GetHexPosition(drawPos), drawEnd); Quaternion lookat = Quaternion.LookRotation(angle, Vector3.up); Handles.ArrowHandleCap(0, TerrainGen.GetHexPosition(drawPos), lookat, TerrainGen.hexSize, EventType.Repaint); } drawEnd = TerrainGen.GetHexPosition(node.target); if (node.target != Vector2Int.zero) { Handles.color = Color.blue; Vector3 angle = -MyMath.GetDirectionRatio(TerrainGen.GetHexPosition(drawPos), drawEnd); Quaternion lookat = Quaternion.LookRotation(angle, Vector3.up); Vector3 drawStart = TerrainGen.GetHexPosition(drawPos); drawStart.y += 0.01f; Handles.ArrowHandleCap(1, drawStart, lookat, TerrainGen.hexSize, EventType.Repaint); } } } } }