コード例 #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;
        }
    }
コード例 #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;
        }
    }
コード例 #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);
    }
コード例 #4
0
ファイル: ItemWeapon.cs プロジェクト: Judgy53/DungeonStalker
 public void Start()
 {
     restriction = weaponPrefab.GetComponent <IWeapon>().WeaponRestrictions;
 }
コード例 #5
0
 public virtual void SetSpeed(IWeapon weapon, WeaponRestriction hand)
 {
 }
コード例 #6
0
 public virtual void SetWeaponType(IWeapon weapon, WeaponRestriction hand)
 {
 }