Exemplo n.º 1
0
    protected virtual void UpdateShooterAnimations()
    {
        if (shooterManager == null)
        {
            return;
        }

        if ((!isAiming && aimTimming <= 0) && meleeManager)
        {
            // set attack id from the melee weapon (trigger fullbody atk animations)
            animator.SetInteger("AttackID", meleeManager.GetAttackID());
        }
        else
        {
            // set attack id from the shooter weapon (trigger shot layer animations)
            animator.SetInteger("AttackID", shooterManager.GetAttackID());
        }
        // turn on the onlyarms layer to aim
        onlyArmsLayerWeight = Mathf.Lerp(onlyArmsLayerWeight, (isAiming || aimTimming > 0) ? 0f : (shooterManager.rWeapon || shooterManager.lWeapon) ? 1f : 0f, 6f * Time.deltaTime);
        animator.SetLayerWeight(onlyArmsLayer, onlyArmsLayerWeight);
        var weapon = shooterManager.rWeapon ? shooterManager.rWeapon : shooterManager.lWeapon;

        if (weapon != null && (isAiming || aimTimming > 0))
        {
            // set the move set id (base layer)
            animator.SetFloat("MoveSet_ID", shooterManager.GetMoveSetID(), .2f, Time.deltaTime);
        }
        else if (shooterManager.rWeapon != null)
        {
            // set the move set id (base layer)
            animator.SetFloat("MoveSet_ID", 0, .2f, Time.deltaTime);
        }
        // set the isBlocking false while using shooter weapons
        animator.SetBool("IsBlocking", false);
        // set the uppbody id (armsonly layer)
        animator.SetFloat("UpperBody_ID", shooterManager.GetUpperBodyID(), .2f, Time.deltaTime);
        // set if the character can aim or not (upperbody layer)
        animator.SetBool("CanAim", aimConditions);
        // character is aiming
        animator.SetBool("IsAiming", (isAiming || aimTimming > 0) && !isAttacking);
        // find states with the Reload tag
        isReloading = cc.IsAnimatorTag("Reload");
        // find states with the IsEquipping tag
        isEquipping = cc.IsAnimatorTag("IsEquipping");
    }
Exemplo n.º 2
0
    protected virtual void UpdateShooterAnimations()
    {
        if (shooterManager == null)
        {
            return;
        }

        if (!isAiming && meleeManager)
        {
            // set attack id from the melee weapon (trigger fullbody atk animations)
            cc.animator.SetInteger("AttackID", meleeManager.GetAttackID());
        }
        else
        {
            // set attack id from the shooter weapon (trigger shot layer animations)
            cc.animator.SetInteger("AttackID", shooterManager.GetAttackID());
        }
        // turn on the onlyarms layer to aim
        onlyArmsLayerWeight = Mathf.Lerp(onlyArmsLayerWeight, isAiming ? 0f : shooterManager.rWeapon ? 1f : 0f, 6f * Time.deltaTime);
        animator.SetLayerWeight(onlyArmsLayer, onlyArmsLayerWeight);

        if (shooterManager.rWeapon != null && isAiming)
        {
            // set the move set id (base layer)
            cc.animator.SetFloat("MoveSet_ID", shooterManager.GetMoveSetID(), .2f, Time.deltaTime);
        }
        else if (shooterManager.rWeapon != null)
        {
            // set the move set id (base layer)
            cc.animator.SetFloat("MoveSet_ID", 0, .2f, Time.deltaTime);
        }

        // set the uppbody id (armsonly layer)
        cc.animator.SetFloat("UpperBody_ID", shooterManager.GetUpperBodyID(), .2f, Time.deltaTime);
        // set if the character can aim or not (upperbody layer)
        cc.animator.SetBool("CanAim", aimConditions);
        // character is aiming
        cc.animator.SetBool("IsAiming", isAiming && !isAttacking);
        // find states with the Reload tag
        isReloading = cc.IsAnimatorTag("Reload");
    }