public void TogglePlanes() { planesOn = !planesOn; if (ARManager.arPlaneManager != null) { ARManager.SetPlanesInvisible(planesOn); } }
public void BackToMainMenu() { DestroyGameSessionObjects(); ARManager.SetPlanesInvisible(false); ARManager.SetPlanesActive(false); ARManager.SetPlaneManagerActive(false); MenuManager.instance.SpawnMenu(eMenus.MAIN_MENU); GameModeManager.instance.DestroyActiveGameMode(); }
private void OnDisable() { UIManager.onDrawModeButtonPressed -= ChangeDrawState; UIManager.onBlockDisplayButtonPressed -= ChangeBlock; UIManager.onEnemyDisplayButtonPressed -= ChangeEnemy; if (worldZeroBlock != null) { Destroy(worldZeroBlock); } ARManager.SetPlanesInvisible(true); ARManager.SetPlanesActive(false); ARManager.SetPlaneManagerActive(false); }
void ChangeState(eTrashkitballState newState) { //Exiting State if (trashkitballState == eTrashkitballState.IN_PLAY) { if (newState != eTrashkitballState.GAME_OVER) { generalUI.SetActive(false); } } else if (trashkitballState == eTrashkitballState.GAME_OVER) { gameOverUI.SetActive(false); } trashkitballState = newState; //Entering State if (trashkitballState == eTrashkitballState.INIT) { ARManager.SetPlaneManagerActive(true); ARManager.SetPlanesInvisible(false); ARManager.TogglePlanePrefab(false); SpawnARObjectPlacement(); trashCount = 10; score = 0; currentDisplayedScore = 0; animatingScore = false; scoreText.text = "0"; trashCountText.text = trashCount.ToString(); } else if (trashkitballState == eTrashkitballState.IN_PLAY) { //Deactivate any planes that may be above the trashcan var planes = ARManager.arPlaneManager.trackables; foreach (var p in planes) { if (p.transform.position.y > (spawnedTrashcan.transform.position.y + spawnedTrashcan.GetComponentInChildren <MeshRenderer>().bounds.size.y / 2)) { //ARDebug.Log("Turned off plane above trashcan", 5); p.gameObject.SetActive(false); } } ARManager.SetPlaneManagerActive(false); ARManager.SetPlanesInvisible(true); generalUI.SetActive(true); //This is a stupid way to do this, use triggers in the animator and have them be able to call themselves of the Any state //canvasAnimator.Play("New State"); canvasAnimator.SetTrigger("Play"); StartCoroutine(SpawnTrashTimed(1.5f)); } else if (trashkitballState == eTrashkitballState.RESETTING_AR) { DestroyGameSessionObjects(); StartCoroutine(RestartLocalARSession()); } else if (trashkitballState == eTrashkitballState.GAME_OVER) { gameOverUI.SetActive(true); toCloseUI.SetActive(false); goScoreText.text = score.ToString(); canvasAnimator.SetTrigger("GameOver"); SoundManager.instance.PlaySound(gameOver_sfx); } }