private void SetWeaponInSlot(WeaponItem weapon, EquipmentSlotEnum equipmentSlotID) { switch (equipmentSlotID) { case EquipmentSlotEnum.RightHandSlot01: weaponsInRightHandSlots[0] = weapon; break; case EquipmentSlotEnum.RightHandSlot02: weaponsInRightHandSlots[1] = weapon; break; case EquipmentSlotEnum.RightHandSlot03: weaponsInRightHandSlots[2] = weapon; break; case EquipmentSlotEnum.LeftHandSlot01: weaponsInLeftHandSlots[0] = weapon; break; case EquipmentSlotEnum.LeftHandSlot02: weaponsInLeftHandSlots[1] = weapon; break; case EquipmentSlotEnum.LeftHandSlot03: weaponsInLeftHandSlots[2] = weapon; break; } if (weapon != null) { weaponsInInventory.Remove(weapon); } }
private void UpdateWeaponSlots() { leftWeapon = weaponsInLeftHandSlots[currentLeftWeaponIndex] != null ? weaponsInLeftHandSlots[currentLeftWeaponIndex] : unarmedWeapon; rightWeapon = weaponsInRightHandSlots[currentRightWeaponIndex] != null ? weaponsInRightHandSlots[currentRightWeaponIndex] : unarmedWeapon; weaponSlotManager.LoadWeaponOnSlot(rightWeapon, WeaponSlotID.RightHandSlot); weaponSlotManager.LoadWeaponOnSlot(leftWeapon, WeaponSlotID.LeftHandSlot); }
public void UpdateWeaponQuickSlotsUI(bool isLeft, WeaponItem weapon) { Image quickSlotImage = isLeft ? leftWeaponIcon : rightWeaponIcon; quickSlotImage.sprite = weapon.icon; quickSlotImage.enabled = weapon.icon != null; }
public void EquipWeapon(WeaponItem weapon, EquipmentSlotEnum equipmentSlotID) { MoveWeaponBackToInventory(equipmentSlotID); SetWeaponInSlot(weapon, equipmentSlotID); UpdateWeaponSlots(); }
private void Start() { rightWeapon = weaponsInRightHandSlots[0] == null ? unarmedWeapon : weaponsInRightHandSlots[0]; leftWeapon = weaponsInLeftHandSlots[0] == null ? unarmedWeapon : weaponsInLeftHandSlots[0]; weaponSlotManager.LoadWeaponOnSlot(rightWeapon, WeaponSlotID.RightHandSlot); weaponSlotManager.LoadWeaponOnSlot(leftWeapon, WeaponSlotID.LeftHandSlot); }
public void SetColliderDamageAbsorbtion(WeaponItem weapon) { if (weapon != null) { blockingPhysicalDamageAbsorbtion = weapon.physicalDamageAbsorbtion; stability = weapon.stability; } }
private void MoveWeaponBackToInventory(EquipmentSlotEnum equipmentSlotID) { WeaponItem equippedWeapon = GetEquippedWeapon(equipmentSlotID); if (equippedWeapon != null) { weaponsInInventory.Add(equippedWeapon); } }
private void SelectNextLeftWeapon() { currentLeftWeaponIndex++; if (currentLeftWeaponIndex > weaponsInLeftHandSlots.Length - 1) { currentLeftWeaponIndex = 0; } leftWeapon = weaponsInLeftHandSlots[currentLeftWeaponIndex] != null ? weaponsInLeftHandSlots[currentLeftWeaponIndex] : unarmedWeapon; }
private void LoadWeapons() { foreach (HandEquipmentSlot slot in handEquipmentSlots) { WeaponItem weapon = playerInventory.GetEquippedWeapon(slot.equipmentSlotID); if (weapon != playerInventory.unarmedWeapon) { slot.AddItem(weapon); } } }
public void AddItem(WeaponItem newWeapon) { if (newWeapon == null) { return; } weapon = newWeapon; icon.sprite = weapon.icon; icon.enabled = true; }
public void HandleBlock(WeaponItem weapon) { if (playerManager.isBlocking || playerManager.isInteracting) { return; } animatorHandler.PlayTargetAnimation("Block_Idle", false, true); EnableBlockingCollider(weapon); playerManager.isBlocking = true; }
public void LoadWeaponModel(WeaponItem weaponItem) { UnloadItemModelAndDestroy(); if (weaponItem == null) { UnloadItemModel(); return; } LoadItemModel(weaponItem); }
private void PerformAttack(WeaponItem weapon, PlayerAttackAction attack) { if (playerStats.currentStamina <= 0) { return; } if (attack.actionAnimation == string.Empty) { throw new Exception("Attack with missing animation called: " + attack); } weaponSlotManager.attackingWeapon = weapon; animatorHandler.PlayTargetAnimation(attack.actionAnimation, true, true); lastAttack = attack; }
public void LoadWeaponOnSlot(WeaponItem weapon, bool isLeft) { if (isLeft) { leftHandSlot.currentWeapon = weapon; leftHandSlot.LoadWeaponModel(weapon); LoadWeaponDamageCollider(true); } else { rightHandSlot.currentWeapon = weapon; rightHandSlot.LoadWeaponModel(weapon); LoadWeaponDamageCollider(false); } }
public void LoadWeaponOnSlot(WeaponItem weaponItem, WeaponSlotID slotID) { WeaponHolderSlot slot = GetWeaponHolderSlot(slotID); if (slot.slotID == WeaponSlotID.LeftHandSlot) { leftHandSlot.currentWeapon = weaponItem; leftHandSlot.LoadWeaponModel(weaponItem); LoadLeftWeaponDamageCollider(); quickSlotsUI.UpdateWeaponQuickSlotsUI(true, weaponItem); if (weaponItem != null && weaponItem.Left_Hand_Idle != null) { animator.CrossFade(weaponItem.Left_Hand_Idle, 0.2f); } else { animator.CrossFade("Left Arm Empty", 0.2f); } } else { if (InputHandler.twoHandFlag) { backSlot.LoadWeaponModel(leftHandSlot.currentWeapon); leftHandSlot.UnloadItemModelAndDestroy(); animator.CrossFade(weaponItem.Two_Hand_Idle, 0.2f); } else { backSlot.UnloadItemModelAndDestroy(); animator.CrossFade("Both Arms Empty", 0.2f); if (weaponItem != null && weaponItem.Right_Hand_Idle != null) { animator.CrossFade(weaponItem.Right_Hand_Idle, 0.2f); } else { animator.CrossFade("Right Arm Empty", 0.2f); } } rightHandSlot.currentWeapon = weaponItem; rightHandSlot.LoadWeaponModel(weaponItem); LoadRightWeaponDamageCollider(); quickSlotsUI.UpdateWeaponQuickSlotsUI(false, weaponItem); } }
public void HandleWeaponCombo(WeaponItem weapon) { animatorHandler.anim.SetBool("canDoCombo", false); if (lastAttack == weapon.OH_Light_Attack_1 || lastAttack == weapon.TH_Light_Attack_1) { LightAttack2(weapon); } else if (lastAttack == weapon.OH_Light_Attack_2 || lastAttack == weapon.TH_Light_Attack_2) { LightAttack1(weapon); } else if (lastAttack == weapon.OH_Heavy_Attack_1 || lastAttack == weapon.TH_Heavy_Attack_1) { HeavyAttack2(weapon); } else if (lastAttack == weapon.OH_Heavy_Attack_2 || lastAttack == weapon.TH_Heavy_Attack_2) { HeavyAttack1(weapon); } }
private void HandleAttackInput() { if (rhLightAttack_Input || rhStrongAttack_Input) { animatorHandler.anim.SetBool("isUsingRightHand", true); if (playerManager.canDoCombo) { playerAttacker.HandleWeaponCombo(playerInventory.rightWeapon); } else { if (playerManager.isInteracting) { return; } if (rhStrongAttack_Input) { playerAttacker.HandleHeavyAttack(playerInventory.rightWeapon); } else { playerAttacker.HandleLightAttack(playerInventory.rightWeapon); } } } lhLightAttack_Input = inputActions.PlayerActions.LeftAttack1.phase == UnityEngine.InputSystem.InputActionPhase.Started; if (lhLightAttack_Input) { WeaponItem blockingWeapon = twoHandFlag ? playerInventory.rightWeapon : playerInventory.leftWeapon; playerAttacker.HandleBlock(blockingWeapon); } else { playerManager.isBlocking = false; playerAttacker.DisableBlockingCollider(); } }
private void HeavyAttack1(WeaponItem weapon) { PlayerAttackAction attack = inputHandler.twoHandFlag ? weapon.TH_Heavy_Attack_1 : weapon.OH_Heavy_Attack_1; PerformAttack(weapon, attack); }
private void LightAttack2(WeaponItem weapon) { PlayerAttackAction attack = inputHandler.twoHandFlag ? weapon.TH_Light_Attack_2 : weapon.OH_Light_Attack_2; PerformAttack(weapon, attack); }
public void HandleHeavyAttack(WeaponItem weapon) { HeavyAttack1(weapon); }
public void HandleLightAttack(WeaponItem weapon) { LightAttack1(weapon); }
private void EnableBlockingCollider(WeaponItem weapon) { blockingCollider.SetColliderDamageAbsorbtion(weapon); blockingCollider.EnableCollider(); }
public override void UnequipItem() { weapon = null; base.UnequipItem(); }
public override void ClearInventorySlot() { weapon = null; base.ClearInventorySlot(); }
public void AddItem(WeaponItem newItem) { weapon = newItem; base.AddItem(newItem); }