/** * Setup and prepare for the next state */ private void transitionState(State nextState) { leaveState(); if (nextState == State.LEVEL_STARTING) { cameraFollowing.target = player; levelMetadata = FindObjectOfType <LevelMetadata>(); SpawnPoint spawn = FindObjectOfType <SpawnPoint>(); spawnPoint = spawn.gameObject; levelTimer = 0; deaths = 0; collectablesGot = 0; playerWolf.setFacingDirection(spawn.facingDirection); playerWolf.setPosition(spawn.transform.position); playerWolf.setToLevelStartState(); levelStart.show(); UIlevelTimer.SetActive(true); } else if (nextState == State.IN_LEVEL) { } else if (nextState == State.PAUSED) { playerWolf.setPaused(true); } else if (nextState == State.LEVEL_ENDING) { playerWolf.setToLevelEndState(); levelEnd.show(); } else if (nextState == State.LEVEL_LOADING) { UIlevelTimer.SetActive(false); } else if (nextState == State.MAIN_MENU) { cameraFollowing.enabled = false; player.SetActive(false); cam.transform.position = mainMenuCameraPosition.transform.position; } currentState = nextState; }