private void ResetState() { state = State.IDLE; // Remove existing road preview on state reset if (roadPreview != null) { Destroy(roadPreview.gameObject); roadPreview = null; } UIManager.Instance.HideOnMousePrompt(); }
private void InputStartBuilding(Grid startGrid) { if (Input.GetMouseButtonDown(InputUtils.MOUSE_BUTTON_LEFT)) { if (startGrid != null) { state = State.BUILDING; roadPreview = Instantiate(roadFactory.GetRoadPreviewPrefab(), startGrid.transform.position, startGrid.transform.rotation, transform); roadPreview.StartGrid = startGrid; } else { // Invalid start grid, cancel road building operation ResetState(); } } }