Ejemplo n.º 1
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (stateInfo.IsName("enemy-vile intro stage-laugh"))
        {
            MegamanInput        playerInput  = GameObject.FindObjectOfType <MegamanInput> ();
            DeathRogumer        deathRogumer = GameObject.FindObjectOfType <DeathRogumer> ();
            EnemyIntroStageVile vile         = GameObject.FindObjectOfType <EnemyIntroStageVile> ();

            playerInput.manualLock = false;
            deathRogumer.ReadyToLeaveScene();
            vile.readyToAttack = true;
        }
    }
    public IEnumerator BeginCutscene()
    {
        megamanController = GameObject.FindObjectOfType<MegamanController> ();
        vile = GameObject.FindObjectOfType<EnemyIntroStageVile> ();
        deathRogumer = GameObject.FindObjectOfType<DeathRogumer> ();
        zeroController.gameObject.SetActive (true);
        zeroController.transform.position = new Vector3 (megamanController.transform.position.x - 4f, zeroController.transform.position.y, zeroController.transform.position.z);
        IntroStageCamera2DFollow camera2D = GameObject.FindObjectOfType<IntroStageCamera2DFollow> ();
        camera2D.enabled = false;
        bool loop = false;
        started = true;
        playing = true;

        VileTalks ();
        vilesDialog.gameObject.SetActive (true);
        yield return new WaitForSeconds (5f);
        DisableDialogs ();
        chatbox.gameObject.SetActive (false);
        zeroController.Fire ();
        yield return new WaitForSeconds (0.7f);
        vile.BreakArm ();
        megamanController.myRigidbody2D.gravityScale = 1f;
        megamanController.EnableBentOnKneeAndHurt ();
        yield return new WaitForSeconds (1f);
        zeroController.Slide ();
        //Move zero
        loop = true;
        while(loop)
        {
            zeroController.transform.Translate (((megamanController.transform.position + Vector3.right * 2f) - zeroController.transform.position) * zeroController.speed * Time.deltaTime);
            if((zeroController.transform.position.x - megamanController.transform.position.x) > 0.6f && Vector3.Distance(zeroController.transform.position, megamanController.transform.position) < 0.8f)
            {
                zeroController.StopSliding();
                loop = false;
            }
            yield return new WaitForSeconds(Time.deltaTime);
        }
        //
        zeroController.Aim ();
        yield return new WaitForSeconds (1f);
        zeroController.StopAiming ();
        zeroController.Charge ();
        deathRogumer.transform.position = new Vector3 (vile.transform.position.x, deathRogumer.transform.position.y, deathRogumer.transform.position.z);
        deathRogumer.Deploy ();
        yield return new WaitForSeconds (1f);
        deathRogumer.DeployLift ();
        yield return new WaitForSeconds (1f);
        vile.jumpForce.y *= 2;
        vile.SetIgnoreLiftCollision (true);
        vile.JumpUp ();
        zeroController.StopCharging ();
        zeroController.Fire ();
        yield return new WaitForSeconds (0.5f);
        zeroController.LookUp ();
        vile.SetIgnoreLiftCollision (false);
        yield return new WaitForSeconds (0.5f);
        deathRogumer.ReadyToLeaveScene ();
        yield return new WaitForSeconds (1f);
        zeroController.transform.localScale = new Vector3 (zeroController.transform.localScale.x * -1, zeroController.transform.localScale.y, zeroController.transform.localScale.z);
        megamanController.transform.localScale = new Vector3 (1, megamanController.transform.localScale.y, megamanController.transform.localScale.z);
        yield return new WaitForSeconds (1f);
        MegamanTalks ();
        DisableDialogs ();
        megamansDialogs [0].gameObject.SetActive (true);
        yield return new WaitForSeconds (5f);
        ZeroTalks ();
        DisableDialogs ();
        zerosDialogs [0].gameObject.SetActive (true);
        yield return new WaitForSeconds (5f);
        ZeroTalks ();
        DisableDialogs ();
        zerosDialogs [1].gameObject.SetActive (true);
        yield return new WaitForSeconds (5f);
        ZeroTalks ();
        DisableDialogs ();
        zerosDialogs [2].gameObject.SetActive (true);
        yield return new WaitForSeconds (5f);
        ZeroTalks ();
        DisableDialogs ();
        zerosDialogs [3].gameObject.SetActive (true);
        yield return new WaitForSeconds (5f);
        ZeroTalks ();
        DisableDialogs ();
        zerosDialogs [4].gameObject.SetActive (true);
        yield return new WaitForSeconds (5f);
        ZeroTalks ();
        DisableDialogs ();
        zerosDialogs [5].gameObject.SetActive (true);
        yield return new WaitForSeconds (5f);
        ZeroTalks ();
        DisableDialogs ();
        zerosDialogs [6].gameObject.SetActive (true);
        yield return new WaitForSeconds (5f);
        chatbox.gameObject.SetActive (false);
        yield return new WaitForSeconds (1f);
        zeroController.Teleport ();
        yield return new WaitForSeconds (1f);
        megamanController.TeleportOut ();
        yield return null;
    }
    public IEnumerator BeginCutscene()
    {
        megamanController = GameObject.FindObjectOfType <MegamanController> ();
        vile         = GameObject.FindObjectOfType <EnemyIntroStageVile> ();
        deathRogumer = GameObject.FindObjectOfType <DeathRogumer> ();
        zeroController.gameObject.SetActive(true);
        zeroController.transform.position = new Vector3(megamanController.transform.position.x - 4f, zeroController.transform.position.y, zeroController.transform.position.z);
        IntroStageCamera2DFollow camera2D = GameObject.FindObjectOfType <IntroStageCamera2DFollow> ();

        camera2D.enabled = false;
        bool loop = false;

        started = true;
        playing = true;

        VileTalks();
        vilesDialog.gameObject.SetActive(true);
        yield return(new WaitForSeconds(5f));

        DisableDialogs();
        chatbox.gameObject.SetActive(false);
        zeroController.Fire();
        yield return(new WaitForSeconds(0.7f));

        vile.BreakArm();
        megamanController.myRigidbody2D.gravityScale = 1f;
        megamanController.EnableBentOnKneeAndHurt();
        yield return(new WaitForSeconds(1f));

        zeroController.Slide();
        //Move zero
        loop = true;
        while (loop)
        {
            zeroController.transform.Translate(((megamanController.transform.position + Vector3.right * 2f) - zeroController.transform.position) * zeroController.speed * Time.deltaTime);
            if ((zeroController.transform.position.x - megamanController.transform.position.x) > 0.6f && Vector3.Distance(zeroController.transform.position, megamanController.transform.position) < 0.8f)
            {
                zeroController.StopSliding();
                loop = false;
            }
            yield return(new WaitForSeconds(Time.deltaTime));
        }
        //
        zeroController.Aim();
        yield return(new WaitForSeconds(1f));

        zeroController.StopAiming();
        zeroController.Charge();
        deathRogumer.transform.position = new Vector3(vile.transform.position.x, deathRogumer.transform.position.y, deathRogumer.transform.position.z);
        deathRogumer.Deploy();
        yield return(new WaitForSeconds(1f));

        deathRogumer.DeployLift();
        yield return(new WaitForSeconds(1f));

        vile.jumpForce.y *= 2;
        vile.SetIgnoreLiftCollision(true);
        vile.JumpUp();
        zeroController.StopCharging();
        zeroController.Fire();
        yield return(new WaitForSeconds(0.5f));

        zeroController.LookUp();
        vile.SetIgnoreLiftCollision(false);
        yield return(new WaitForSeconds(0.5f));

        deathRogumer.ReadyToLeaveScene();
        yield return(new WaitForSeconds(1f));

        zeroController.transform.localScale    = new Vector3(zeroController.transform.localScale.x * -1, zeroController.transform.localScale.y, zeroController.transform.localScale.z);
        megamanController.transform.localScale = new Vector3(1, megamanController.transform.localScale.y, megamanController.transform.localScale.z);
        yield return(new WaitForSeconds(1f));

        MegamanTalks();
        DisableDialogs();
        megamansDialogs [0].gameObject.SetActive(true);
        yield return(new WaitForSeconds(5f));

        ZeroTalks();
        DisableDialogs();
        zerosDialogs [0].gameObject.SetActive(true);
        yield return(new WaitForSeconds(5f));

        ZeroTalks();
        DisableDialogs();
        zerosDialogs [1].gameObject.SetActive(true);
        yield return(new WaitForSeconds(5f));

        ZeroTalks();
        DisableDialogs();
        zerosDialogs [2].gameObject.SetActive(true);
        yield return(new WaitForSeconds(5f));

        ZeroTalks();
        DisableDialogs();
        zerosDialogs [3].gameObject.SetActive(true);
        yield return(new WaitForSeconds(5f));

        ZeroTalks();
        DisableDialogs();
        zerosDialogs [4].gameObject.SetActive(true);
        yield return(new WaitForSeconds(5f));

        ZeroTalks();
        DisableDialogs();
        zerosDialogs [5].gameObject.SetActive(true);
        yield return(new WaitForSeconds(5f));

        ZeroTalks();
        DisableDialogs();
        zerosDialogs [6].gameObject.SetActive(true);
        yield return(new WaitForSeconds(5f));

        chatbox.gameObject.SetActive(false);
        yield return(new WaitForSeconds(1f));

        zeroController.Teleport();
        yield return(new WaitForSeconds(1f));

        megamanController.TeleportOut();
        yield return(null);
    }