Ejemplo n.º 1
0
    public override void SetWeaponType(IWeapon weapon, WeaponRestriction hand)
    {
        switch (hand)
        {
        case WeaponRestriction.Both:
            if (mainHandWeaponTypeName != "")
            {
                animator.SetFloat(mainHandWeaponTypeName, (float)weapon.WeaponType);
            }
            if (offHandWeaponTypeName != "")
            {
                animator.SetFloat(offHandWeaponTypeName, (float)weapon.WeaponType);
            }
            break;

        case WeaponRestriction.MainHand:
            if (mainHandWeaponTypeName != "")
            {
                animator.SetFloat(mainHandWeaponTypeName, (float)weapon.WeaponType);
            }
            break;

        case WeaponRestriction.OffHand:
            if (offHandWeaponTypeName != "")
            {
                animator.SetFloat(offHandWeaponTypeName, (float)weapon.WeaponType);
            }
            break;
        }
    }
Ejemplo n.º 2
0
    public override void SetSpeed(IWeapon weapon, WeaponRestriction hand)
    {
        AnimatorStateInfo stateInfo;

        switch (hand)
        {
        case WeaponRestriction.Both:
            throw new System.InvalidOperationException();

        case WeaponRestriction.MainHand:
            if (mainHandWeaponSpeedLayerName != "")
            {
                stateInfo = animator.GetCurrentAnimatorStateInfo(animator.GetLayerIndex(mainHandWeaponSpeedLayerName));

                if (stateInfo.IsName(mainHandWeaponSpeedLayerName + ".Primary"))
                {
                    if (weapon is IPhysicalWeapon)
                    {
                        animator.speed = 1.0f / (weapon as IPhysicalWeapon).AnimationTime;
                    }
                    if (weapon is IRangedWeapon)
                    {
                        animator.speed = 1.0f / (weapon as IRangedWeapon).AnimationTime;
                    }
                }
                else
                {
                    animator.speed = 1.0f;
                }
            }
            break;

        case WeaponRestriction.OffHand:
            if (offHandWeaponSpeedLayerName != "")
            {
                stateInfo = animator.GetCurrentAnimatorStateInfo(animator.GetLayerIndex(offHandWeaponSpeedLayerName));

                if (stateInfo.IsName(offHandWeaponSpeedLayerName + ".Primary"))
                {
                    if (weapon is IPhysicalWeapon)
                    {
                        animator.speed = 1.0f / (weapon as IPhysicalWeapon).AnimationTime;
                    }
                    if (weapon is IRangedWeapon)
                    {
                        animator.speed = 1.0f / (weapon as IRangedWeapon).AnimationTime;
                    }
                }
                else
                {
                    animator.speed = 1.0f;
                }
            }
            break;
        }
    }
Ejemplo n.º 3
0
    private bool CanEquip(ItemWeapon weapon, WeaponRestriction slot)
    {
        WeaponManager wm = GetComponentInParent <UIInventoryMenu>().target.GetComponentInParent <WeaponManager>();

        switch (weapon.Restriction)
        {
        case WeaponRestriction.Both:
        case WeaponRestriction.OffHand:
            if (wm != null && (wm.MainHandWeapon == null || wm.MainHandWeapon.WeaponHand == WeaponHand.OneHanded))
            {
                return(true);
            }
            else
            {
                return(slot == WeaponRestriction.MainHand);
            }

        case WeaponRestriction.MainHand:
            return(slot == WeaponRestriction.MainHand);
        }

        return(false);
    }
Ejemplo n.º 4
0
 public void Start()
 {
     restriction = weaponPrefab.GetComponent <IWeapon>().WeaponRestrictions;
 }
Ejemplo n.º 5
0
 public virtual void SetSpeed(IWeapon weapon, WeaponRestriction hand)
 {
 }
Ejemplo n.º 6
0
 public virtual void SetWeaponType(IWeapon weapon, WeaponRestriction hand)
 {
 }