Пример #1
0
    private void MoveMeleeWeapon(Vector3 mousePosition)
    {
        if (!currentWeaponHand.IsMelee() || !currentWeaponHand.GetWeapon().CanAttack())
        {
            return;
        }

        float attackCooldown = currentWeaponHand.GetWeapon().attackCooldown;

        MovementUtils.Instance.RotateTowardsAndBack(currentWeaponHand.GetHand().transform, mousePosition, attackCooldown * 1 / 3, attackCooldown * 2 / 3);
    }
Пример #2
0
    private void AimWeapon()
    {
        Vector3    mousePosition = GetMousePosition();
        WeaponHand weaponHand    = GetUsedWeaponHand(mousePosition);

        if (weaponHand.IsMelee())
        {
            return;
        }

        if (weaponHand != currentWeaponHand)
        {
            if (currentIdleCoroutine != null)
            {
                StopCoroutine(currentIdleCoroutine);
            }
            currentIdleCoroutine = MoveToIdlePosition(GetIdleWeaponHand(mousePosition));
        }

        MovementUtils.Instance.RotateTowards(weaponHand.GetHand(), mousePosition);
        currentWeaponHand = weaponHand;
    }
Пример #3
0
    private Coroutine MoveToIdlePosition(WeaponHand weaponHand)
    {
        Vector3 idlePosition = weaponHand.GetDefaultHandPointGlobal();

        return(MovementUtils.Instance.RotateTowards(weaponHand.GetHand(), weaponHand.GetDefaultHandPointGlobal(), 1f));
    }