예제 #1
0
    IEnumerator Summon()
    {
        bossAnim.SetBool("summon", true);
        yield return(new WaitForSeconds(1));

        for (int i = 0; i < phases[actualPhase].meteorCount; i++)
        {
            camAnim.SetTrigger("shake");
            blinkPanel.Play();
            int       random      = Random.Range(0, spawnPoints.Length);
            Transform originPoint = spawnPoints[random];

            if (player == null)
            {
                break;
            }

            Vector2    direction = originPoint.position - player.position;
            float      angle     = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
            Quaternion rotation  = Quaternion.AngleAxis(angle, Vector3.forward);

            Quaternion rotationCorrection = Quaternion.AngleAxis(90, Vector3.forward);
            Instantiate(meteor, originPoint.position, rotation * rotationCorrection);
            yield return(new WaitForSeconds(phases[actualPhase].timeBetweenMeteor));
        }
        bossAnim.SetBool("summon", false);
        finishedAction = true;
    }
예제 #2
0
    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);
        }
    }