protected IEnumerator OnEnterAction() { float timeArcade = 0; if (TimeAttackSystem.Instance != null) { TimeAttackSystem.Instance.PauseTimer(); timeArcade = TimeAttackSystem.Instance.timer; } ChangueScene(); StopCoroutine("LevelCounterTime"); Klaus.CanMove(true); Klaus.activeJump = false; Instantiate(floatingMusik, transform.position, transform.rotation);//Musica Camera.main.GetComponent <InputTouchPS4>().Block(true); float timer = CounterTimerPlay.Instance.EndTime(); SaveManager.Instance.AddPlayTime(timer); ManagerAnalytics.MissionCompleted(Application.loadedLevelName, false, timer, timeArcade, true); CompleteScene(); CompleteLevel(); yield return(StartCoroutine(new TimeCallBacks().WaitPause(TimeTochangeLevel))); if (SaveManager.Instance.comingFromTimeArcadeMode && ShowArcade) { ManagerHudUI.Instance.ShowLevelCompleted(SceneToGoArcade); } else { ActivateManualty(); } }
IEnumerator WaitingPortal() { while (true) { if (!ManagerPause.Pause && !ManagerStop.Stop) { if (ReInput.players.GetPlayer(0).GetAxis("Move Y") > SaveManager.Instance.dataKlaus.controlSensitivity) { //Entro al nivel CharacterManager.Instance.FreezeAll(); LoadLevelManager.Instance.LoadLevel(NextScene, true); MoveStateKlaus[] moves = GameObject.FindObjectsOfType <MoveStateKlaus>(); for (int i = 0; i < moves.Length; ++i) { moves[i].isEnter = true; } anim.SetTrigger("Open"); StartCoroutine(EnterPortal(timeEnter)); float timer = CounterTimerPlay.Instance.EndTime(); SaveManager.Instance.AddPlayTime(timer); ManagerAnalytics.MissionCompleted(Application.loadedLevelName, false, timer, 0, false); break; } } yield return(null); } }
IEnumerator WaitingPortal() { CharacterManager.Instance.FreezeAll(); CharacterManager.Instance.BecomeInmortal(true); //Salvo posToShow = CollectablesManager.setCollectable(TypeLevel); GetComponent <SpriteRenderer>().enabled = false; for (int i = 0; i < transform.childCount; ++i) { transform.GetChild(i).gameObject.SetActive(false); } yield return(StartCoroutine(new TimeCallBacks().WaitPause(timeToShowNextStep))); collectable_UI.onFinish += FinishGivePiece; if (posToShow >= 0) { collectable_UI.SetCollect(posToShow); } else { collectable_UI.SetCollect(0); } float timer = CounterTimerPlay.Instance.EndTime(); SaveManager.Instance.AddPlayTime(timer); ManagerAnalytics.MissionCompleted(Application.loadedLevelName, false, timer, 0, false); //Precargo la escena de video // LoadLevelManager.Instance.LoadLevel(Application.loadedLevelName + "_Video", ThreadPriority.Low, true); }
public void CompleteScene() { StopCoroutine("LevelCounterTime"); SaveManager.Instance.AddPlayTime(timer); ManagerAnalytics.MissionCompleted(Application.loadedLevelName, false, timer, 0, true); if (completeSceneCallback != null) { completeSceneCallback(); } }
protected override void OnEnterAction(Collider2D other) { base.OnEnterAction(other); float timer = door.StopTimerAndReturn(); SaveManager.Instance.AddPlayTime(timer); SaveManager.Instance.dataKlaus.CompleteMainStory = true; ManagerAnalytics.MissionCompleted(Application.loadedLevelName, false, timer, 0, false); LoadLevelManager.Instance.LoadLevel(SaveManager.Instance.comingFromTimeArcadeMode ? NextSceneArcadeMode : NextSceneHistory, false); }
void EnterKlauses() { float timeArcade = 0; if (TimeAttackSystem.Instance != null) { TimeAttackSystem.Instance.PauseTimer(); if (isFinalLevel || isEndTimeAttack) { timeArcade = TimeAttackSystem.Instance.timer; } } doorAnim.SetBool("Open", true); for (int i = 0; i < CharacterManager.Instance.canMove.Length && EntrarMismoTiempo && SoloPaEntrar == null; ++i) { if (CharacterManager.Instance.canMove[i]) { CharacterManager.Instance.charsInput[i].GetComponent <MoveState>().isEnter = true; } } float timer = CounterTimerPlay.Instance.EndTime(); SaveManager.Instance.AddPlayTime(timer); ManagerAnalytics.MissionCompleted(Application.loadedLevelName, isTutorial, timer, timeArcade, isFinalLevel || isEndTimeAttack); CompleteScene(); if (isFinalLevel || isEndTimeAttack) { CompleteLevel(); HUD_LevelCompletedMenu.Instance.SetQuote(QuoteText); Camera.main.GetComponent <InputTouchPS4>().Block(true); if (SaveManager.Instance.isComingFromArcade) { ManagerHudUI.Instance.ShowLevelCompleted(SceneToGoArcade, preLoadScene); } else { ManagerHudUI.Instance.ShowLevelCompleted(NextScene, preLoadScene); } } else { EffectCamera(); } }
IEnumerator EnterKlauses() { float timeArcade = 0; if (TimeAttackSystem.Instance != null) { TimeAttackSystem.Instance.PauseTimer(); timeArcade = TimeAttackSystem.Instance.timer; } if (onEnterElevator != null) { onEnterElevator(); } yield return(StartCoroutine(new TimeCallBacks().WaitPause(0.1f))); Instantiate(floatingMusik, transform.position, transform.rotation);//Musica Camera.main.GetComponent <InputTouchPS4>().Block(true); for (int i = 0; i < CharacterManager.Instance.canMove.Length; ++i) { if (CharacterManager.Instance.canMove[i]) { CharacterManager.Instance.charsInput[i].GetComponent <MoveState>().isEnterElevator = true; } } float timer = CounterTimerPlay.Instance.EndTime(); SaveManager.Instance.AddPlayTime(timer); ManagerAnalytics.MissionCompleted(SceneManager.GetActiveScene().name, false, timer, timeArcade, true); CompleteScene(); CompleteLevel(); yield return(StartCoroutine(new TimeCallBacks().WaitPause(TimeToWaitKlausEnter))); doorAnim.SetTrigger("Close");//Se abre la reja yield return(StartCoroutine(new TimeCallBacks().WaitPause(TimeToWaitCloseDoor))); if (SaveManager.Instance.isComingFromArcade) { ManagerHudUI.Instance.ShowLevelCompleted(SceneToGoArcade); } else { ActivateManualty(); } }
protected virtual void OnEnterAction(Collider2D other) { float timer = CounterTimerPlay.Instance.EndTime(); SaveManager.Instance.AddPlayTime(timer); ManagerAnalytics.MissionCompleted(Application.loadedLevelName, false, timer, 0, false); isActive = true; //Entro al nivel CharacterManager.Instance.FreezeAll(); gameObject.AddComponent <AudioListener>(); for (int i = 0; i < CharacterManager.Instance.charsInput.Length; ++i) { CharacterManager.Instance.charsInput[i].gameObject.SetActive(false); } if (PreLoadScene) { LoadLevelManager.Instance.LoadLevel(SaveManager.Instance.comingFromCollectables ? SaveManager.Instance.LevelToLoadCollectable : DefaultScene, true); } else { CollectableLoadLevel loaded = GetComponentInChildren <CollectableLoadLevel>(); if (loaded != null) { loaded.PreloadScene = false; if (SaveManager.Instance.comingFromCollectables) { loaded.sceneToLoad = SaveManager.Instance.LevelToLoadCollectable; } else { loaded.sceneToLoad = DefaultScene; } } } if (CameraShake.Instance != null) { CameraShake.Instance.StartShake(ShakePReset); } //Aviso a HUD anim.SetTrigger("Play"); }
IEnumerator Cutscene_Enter() { audioEnding.PlayDelayed(0.01f); DeadState state = target.GetComponentInChildren <DeadState>(); state.blockRespawn = true; state.UnSuscribeOnStart(OnPlayerDead); CharacterManager.Instance.FreezeAll(); // Flip if needed if (target.position.x < cachedRigidbody.position.x) { target.GetComponentInChildren <FlipSprite>().FlipIfCanFlip(Vector3.right); } else { target.GetComponentInChildren <FlipSprite>().FlipIfCanFlip(-Vector3.right); } // Show K1 dialogues Animator K1Animator = K1.GetComponent(typeof(Animator)) as Animator; SpriteRenderer K1Sprite = K1.GetComponent(typeof(SpriteRenderer)) as SpriteRenderer; K1Animator.enabled = false; K1Sprite.sprite = K1SpriteAngry.sprite; for (int i = 0; i != K1Dialogues.Length; ++i) { K1Dialogues[i].InitText(); if (i == 0) { CameraShake.Instance.StartShake(); } //VolDownMusik if (AS_W4BossMusik.Instance != null) { AS_W4BossMusik.Instance.MusikMuere(); } yield return(StartCoroutine(new TimeCallBacks().WaitForSecondsPauseStop(K1TimeBewteenDialogues[i]))); if (i == 0) { CameraShake.Instance.StopShake(); } } yield return(StartCoroutine(new TimeCallBacks().WaitForSecondsPauseStop(timeForKlausAttack))); K1Animator.enabled = true; // Klaus GETS UP AND ATTACKS!! animator.SetBool("FinalAttack", true); animator.SetBool("Vulnerable", false); Blink overlayBlink = overlay.GetComponent <Blink>(); overlayBlink.Play(5f, new Color(0, 0, 0, 0), new Color(0, 0, 0, 0.5f)); foreach (GameObject effect in beforeReleaseEffects) { effect.SetActive(true); } foreach (GameObject effect in onReleaseEffects) { effect.SetActive(true); } //MusikClonesUp messageMix.SendMessage("NormalMix"); if (AS_W4BossMusik.Instance != null) { AS_W4BossMusik.Instance.MusikRevive(); } BulletHandler bullet = finalBulletPrefab.Spawn <BulletHandler>(cachedRigidbody.position, Quaternion.identity); bullet.transform.right = Vector3.Normalize(target.position - transform.position); bullet.SetDirection(new BulletInfo(bullet.transform.right, 60f)); // Hide dialogues for (int i = 0; i != K1Dialogues.Length; ++i) { K1Dialogues[i].HideText(); yield return(StartCoroutine(new TimeCallBacks().WaitForSecondsPauseStop(0.1f))); } yield return(StartCoroutine(new TimeCallBacks().WaitForSecondsPauseStop(0.5f))); // Now Klaus waits until it exits its trance overlayBlink.Stop(); overlayBlink.SetColor(new Color(0, 0, 0, 0)); foreach (GameObject effect in onReleaseEffects) { effect.SetActive(false); } yield return(StartCoroutine(new TimeCallBacks().WaitForSecondsPauseStop(timeAfterKlausAttack * 0.1f))); foreach (GameObject effect in beforeReleaseEffects) { effect.SetActive(false); } yield return(StartCoroutine(new TimeCallBacks().WaitForSecondsPauseStop(timeAfterKlausAttack * 0.9f))); // He gets up and sees K1 animator.SetTrigger("WakeUp"); KlausDialogues[0].HideText(); Collider2D[] colliders = target.GetComponentsInChildren <Collider2D>(); foreach (Collider2D collider in colliders) { collider.enabled = false; } target.GetComponentInChildren <Rigidbody2D>().isKinematic = true; DynamicCameraManager.Instance.RemoveEspecialTargetForK1(); DynamicCameraManager.Instance.ChangueEspecialTargetForK1(transform, 0.5f, 7.5f, 0.5f); while (!inFrontOfCpu) { yield return(null); } // Run to the CPU animator.SetFloat("SpeedX", 5f); yield return(StartCoroutine(MoveTowards(cpuPosition, 5f, restrictY: true))); animator.SetFloat("SpeedX", 0f); ShowOutroDialogue(7); //lUIS COunter float timer = CounterTimerPlay.Instance.EndTime(); SaveManager.Instance.AddPlayTime(timer); ManagerAnalytics.MissionCompleted(Application.loadedLevelName, false, timer, 0, true); // Hack the CPU LoadLevelManager.Instance.LoadLevel(SaveManager.Instance.isComingFromArcade ? "PrincipalMenu" : nextScene, true); animator.SetBool("TurnAround", true); animator.SetBool("isCoding", true); cpu.SetBool("Hacking", true); klausAudio.clip = klausHacking; klausAudio.loop = true; klausAudio.spatialBlend = 1; klausAudio.volume = 0.6f; klausAudio.Play(); yield return(StartCoroutine(new TimeCallBacks().WaitForSecondsPauseStop(hackTime))); // CPU hacked klausAudio.Stop(); klausAudio.loop = false; sfxAudio.clip = klausHaked; sfxAudio.spatialBlend = 1; sfxAudio.volume = 0.6f; sfxAudio.Play(); cpu.SetBool("HackingTrue", true); yield return(StartCoroutine(new TimeCallBacks().WaitForSecondsPauseStop(2f))); ShowOutroDialogue(8); // Load level yield return(StartCoroutine(new TimeCallBacks().WaitForSecondsPauseStop(2f))); LoadLevelManager.Instance.ActivateLoadedLevel(); while (true) { yield return(null); } }