Example #1
0
    IEnumerator ResetPlayer()
    {
        yield return(new WaitForSeconds(1f));

        transitionScren.GetComponent <Animator>().Play("transition");

        yield return(new WaitForSeconds(dealayForReset));

        currentHealth = health;

        begin.UpdateLifes(lifes);
        transform.position             = spawnPoint.position;
        Camera.main.transform.position = new Vector3(transform.position.x, Camera.main.transform.position.y, Camera.main.transform.position.z);
        playerAnim.SetBool("ded", false);
        playerAnim.SetBool("shooting", false);
        gameObject.layer = 10;

        transitionScren.GetComponent <Animator>().Play("transition_close");

        float delay = transitionScren.GetComponent <Animator>().GetCurrentAnimatorClipInfo(0)[0].clip.length;

        yield return(new WaitForSeconds(delay - 1));

        pc.canMove = true;
    }
Example #2
0
    void Start()
    {
        health        = DatosPlayer.Salud;
        lifes         = DatosPlayer.Vidas;
        shakeDuration = DatosPlayer.StunDanno;

        currentHealth = health;
        playerAnim    = GetComponent <Animator>();
        pc            = GetComponent <Player_Controller>();
        begin         = GameObject.FindGameObjectWithTag("GameController").GetComponent <BeginManager>();
        lvlManager    = GameObject.FindGameObjectWithTag("GameController").GetComponent <LevelManager>();
        rb            = GetComponent <Rigidbody2D>();
        begin.UpdateLifes(lifes);
        myAudio = GetComponent <AudioSource>();
    }