IEnumerator FinishProcedure() { progressCounter = 0; PersistentEngine.player.ChangeState(actionAnimationOpen); if (doCloseup) { advCam.CloseUpEnd(); } PersistentEngine.player.SetTargetItem(base.interactiveItem); commenting = false; int i = 0; float time0 = Time.time; while (progressCounter == 0) { yield return(new WaitForSeconds(0.05f)); if (i > 20) { progressCounter = 2; } i++; if (Time.time - time0 > PersistentEngine.maxCharacterAnimationLength) { Debug.Log("Warning: ProcessArrivedAt interrupted, Time.time-time0 > maxCharacterAnimationLength"); break; } } yield return(new WaitForSeconds(0.1f)); if (string.IsNullOrEmpty(customActionOnPuzzleSolved) == false) { gameObject.SendMessage(customActionOnPuzzleSolved, SendMessageOptions.DontRequireReceiver); } gameObject.SendMessage("SwitchOn", SendMessageOptions.DontRequireReceiver); while (progressCounter == 1) { yield return(new WaitForSeconds(0.05f)); if (Time.time - time0 > PersistentEngine.maxCharacterAnimationLength) { Debug.Log("Warning: ProcessArrivedAt interrupted, Time.time-time0 > maxCharacterAnimationLength"); break; } } if (doDelay) { yield return(new WaitForSeconds(0.2f)); } PersistentEngine.player.ChangeState(endState); yield return(new WaitForSeconds(0.2f)); if (!string.IsNullOrEmpty(commentOnFinish)) { yield return(StartCoroutine(PersistentEngine.player.SpeakProcedure(commentOnFinish))); } StartCoroutine(CharacterSmileSuccess()); yield return(new WaitForSeconds(0.3f)); if (!stayInCutscene) { PersistentEngine.player.SetInCutScene(false); } }
IEnumerator ProcessArrivedAt() { if (desiredDirection == 1) { PersistentEngine.player.TurnTowards(true); } else if (desiredDirection == -1) { PersistentEngine.player.TurnTowards(false); } bool wasInCutScene = false; wasInCutScene = PersistentEngine.player.inCutScene; if (!allowInterruptions) { PersistentEngine.player.SetInCutScene(true, cutsceneTool, PersistentEngine.player.transform.position); } if (doCloseup) { advCamera.CloseUpBegin(closeUpCameraSize, closeUpOffset); } bool hasSomethingMeaningfulOccurred = false; for (int i = 0; i < actionChain.Length; i++) { if (!actionChain[i].enabled || actionChain[i].ShouldSkip()) { continue; } actionChain[i].StopHighlighting(); if (actionChain[i] is InteractiveItemComment) { yield return(new WaitForSeconds(0.1f)); } if (heldItem != null) { if (actionChain[i] is InteractiveItemCombine || actionChain[i] is InteractiveItemComment || actionChain[i] is InteractiveItemControlCamera || actionChain[i] is InteractiveItemChangeCamera) { yield return(StartCoroutine(actionChain[i].ProcessArrivedAt())); hasSomethingMeaningfulOccurred = true; } } else { if (!(actionChain[i] is InteractiveItemCombine)) { yield return(StartCoroutine(actionChain[i].ProcessArrivedAt())); } } } if (doCloseup) { advCamera.CloseUpEnd(); } if (!realyStayInCutscene) { if (!stayInCutscene || !hasSomethingMeaningfulOccurred) { if (!allowInterruptions && !wasInCutScene) { PersistentEngine.player.SetInCutScene(false); } } } }