public void ChangeRightWeapon()
        {
            currentRightWeaponIndex++;

            if (currentRightWeaponIndex == 0 && weaponsInRightHandSlots[0] != null)
            {
                rightWeapon = weaponsInRightHandSlots[currentRightWeaponIndex];
                weaponSlotManager.LoadWeapnOnSlot(weaponsInRightHandSlots[currentRightWeaponIndex], false);
            }
            else if (currentRightWeaponIndex == 0 && weaponsInRightHandSlots[currentRightWeaponIndex] == null)
            {
                currentRightWeaponIndex++;
            }
            else if (currentRightWeaponIndex == 1 && weaponsInRightHandSlots[1] != null)
            {
                rightWeapon = weaponsInRightHandSlots[currentRightWeaponIndex];
                weaponSlotManager.LoadWeapnOnSlot(weaponsInRightHandSlots[currentRightWeaponIndex], false);
            }
            else if (currentRightWeaponIndex == 1 && weaponsInRightHandSlots[1] == null)
            {
                currentRightWeaponIndex++;
            }

            if (currentRightWeaponIndex > weaponsInRightHandSlots.Length - 1)
            {
                currentRightWeaponIndex = -1;
                rightWeapon             = unarmedWeapon;
                weaponSlotManager.LoadWeapnOnSlot(rightWeapon, false);
            }
        }
        public void ChangeLeftWeapon()
        {
            currentLeftWeaponIndex++;

            if (currentLeftWeaponIndex == 0 && weaponsInLeftHandSlots[0] != null)
            {
                leftWeapon = weaponsInLeftHandSlots[currentLeftWeaponIndex];
                weaponSlotManager.LoadWeapnOnSlot(weaponsInLeftHandSlots[currentLeftWeaponIndex], true);
            }
            else if (currentLeftWeaponIndex == 0 && weaponsInLeftHandSlots[currentLeftWeaponIndex] == null)
            {
                currentLeftWeaponIndex++;
            }
            else if (currentLeftWeaponIndex == 1 && weaponsInLeftHandSlots[1] != null)
            {
                leftWeapon = weaponsInLeftHandSlots[currentLeftWeaponIndex];
                weaponSlotManager.LoadWeapnOnSlot(weaponsInLeftHandSlots[currentLeftWeaponIndex], true);
            }
            else if (currentLeftWeaponIndex == 1 && weaponsInLeftHandSlots[1] == null)
            {
                currentLeftWeaponIndex++;
            }

            if (currentLeftWeaponIndex > weaponsInLeftHandSlots.Length - 1)
            {
                currentLeftWeaponIndex = -1;
                leftWeapon             = unarmedWeapon;
                weaponSlotManager.LoadWeapnOnSlot(leftWeapon, true);
            }
        }
Beispiel #3
0
 public void LoadWeapnOnSlot(WeaponItem weaponItem, bool isLeft)
 {
     if (isLeft)
     {
         leftHandSlot.LoadWeaponModel(weaponItem);
         LoadLeftWeaponDamageCollider();
         #region  Handle legft weapon idle animations
         if (weaponItem != null)
         {
             animator.CrossFade(weaponItem.leftHandIdleKatana, 0.2f);
         }
         else
         {
             animator.CrossFade("Left Arm Empty", 0.2f);
         }
         #endregion
     }
     else
     {
         rightHandSlot.LoadWeaponModel(weaponItem);
         LoadRightWeaponDamageCollider();
         #region  Handle right weapon idle animations
         if (weaponItem != null)
         {
             animator.CrossFade(weaponItem.rightHandIdleKatana, 0.2f);
         }
         else
         {
             animator.CrossFade("Right Arm Empty", 0.2f);
         }
         #endregion
     }
 }
Beispiel #4
0
        public void LoadWeaponModel(WeaponItem weaponItem)
        {
            UnloadWeaponAndDestroy();
            if (weaponItem == null)
            {
                UnloadWeapon();
                return;
            }

            GameObject model = Instantiate(weaponItem.modelPrefab) as GameObject;

            if (model != null)
            {
                if (parentOverride != null)
                {
                    model.transform.parent = parentOverride;
                }
                else
                {
                    model.transform.parent = transform;
                }
                model.transform.localPosition = Vector3.zero;
                model.transform.localRotation = Quaternion.identity;
                model.transform.localScale    = Vector3.one;
            }

            currentWeaponModel = model;
        }
Beispiel #5
0
 public void HandleWeaponCombo(WeaponItem weapon)
 {
     if (inputHandler.comboFlag)
     {
         animatorHandler.animator.SetBool("canDoCombo", false);
         if (lastAttack == weapon.oneHandLightAttack_1)
         {
             animatorHandler.PlayTargetAnimation(weapon.oneHandLightAttack_2, true);
         }
     }
 }
 private void Start()
 {
     rightWeapon = unarmedWeapon;
     leftWeapon  = unarmedWeapon;
 }
Beispiel #7
0
 public void HandleHeavyAttack(WeaponItem weapon)
 {
     animatorHandler.PlayTargetAnimation(weapon.oneHandHeavyAttack_1, true);
     lastAttack = weapon.oneHandHeavyAttack_1;
 }