public void EquipItem(Item it) { IEquipable equipable = it as IEquipable; equipable.Equip(); string itemType = it.GetItemType(); Debug.Log(itemType); if (itemType == "Weapon" || itemType == "PickAxe") { Weapon weapon = (Weapon)it; WeaponHands weaponHands = weapon.weaponHands; attackPoint.localPosition = weapon.attackPointOffset; if (weaponHands == WeaponHands.OneHand) { playerAnimator.SetLayerWeight(1, 1f); playerAnimator.SetLayerWeight(2, 0f); } if (weaponHands == WeaponHands.TwoHand) { playerAnimator.SetLayerWeight(1, 0f); playerAnimator.SetLayerWeight(2, 1f); } } }
public override void Attack(int damage, float weaponLength, Weapon weapon) { WeaponHands weaponHands = weapon.weaponHands; if (weaponHands == WeaponHands.OneHand) { playerAnimator.SetTrigger(weapon.animatorTriggerName.ToString()); } if (weaponHands == WeaponHands.TwoHand) { playerAnimator.SetTrigger(weapon.animatorTriggerName.ToString()); } bool isCritical = IsCriticalHit(weapon.criticalChance); attackCollider.SetAttackData(damage, isCritical, weapon.GetItemType(), weapon.colliderRadius); }