Ejemplo n.º 1
0
    private void HandleConjure()
    {
        if (hunter.GetConjureTransition() == 1)
        {
            hunter.can_conjure = true;
        }
        else
        {
            hunter.can_conjure = false;
        }

        if (Input.GetMouseButtonDown(1) && hunter.can_conjure) // if you can conjure a spear and start aiming
        {
            hunter.CreateSpearWrapper();
            hunter.FadeInSpearWrapper();
        }

        bool is_aiming = Input.GetMouseButton(1) && hunter.has_spear;

        if (is_aiming)
        {
            aim_canvas.gameObject.SetActive(is_aiming);

            bool throw_spear = (is_aiming && Input.GetMouseButtonDown(0));
            animator.SetBool("aiming", is_aiming); // dampen the animation to the target animation

            if (throw_spear)
            {
                animator.SetTrigger("throw");
            }
        }
        else
        {
            animator.SetBool("aiming", false);
            aim_canvas.gameObject.SetActive(false);
        }
    }