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; } }
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; } }
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); }
public void Start() { restriction = weaponPrefab.GetComponent <IWeapon>().WeaponRestrictions; }
public virtual void SetSpeed(IWeapon weapon, WeaponRestriction hand) { }
public virtual void SetWeaponType(IWeapon weapon, WeaponRestriction hand) { }