示例#1
0
 public void ClearInventorySlot()
 {
     item         = null;
     icon.sprite  = null;
     icon.enabled = false;
     gameObject.SetActive(false);
 }
示例#2
0
        public void ChangeLeftWeapon()
        {
            currentLeftWeaponIndex = currentLeftWeaponIndex + 1;
            if (currentLeftWeaponIndex == 0 && weaponsInLeftHandSlots[0] != null)
            {
                leftWeapon = weaponsInLeftHandSlots[currentLeftWeaponIndex];
                weaponSlotManager.LoadWeaponOnSlot(weaponsInLeftHandSlots[currentLeftWeaponIndex], true);
            }
            else if (currentLeftWeaponIndex == 0 && weaponsInLeftHandSlots[0] == null)
            {
                currentLeftWeaponIndex = currentLeftWeaponIndex + 1;
            }

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

            if (currentLeftWeaponIndex > weaponsInLeftHandSlots.Length - 1)
            {
                currentLeftWeaponIndex = -1;
                leftWeapon             = unarmedWeapon;
                weaponSlotManager.LoadWeaponOnSlot(unarmedWeapon, true);
            }
        }
示例#3
0
 public void AddItem(WeaponItem newItem)
 {
     item         = newItem;
     icon.sprite  = item.itemIcon;
     icon.enabled = true;
     gameObject.SetActive(true);
 }
示例#4
0
 public void LoadWeaponOnSlot(WeaponItem weaponItem, bool isLeft)
 {
     if (isLeft)
     {
         leftHandSlot.LoadWeaponModel(weaponItem);
         LoadLeftWeaponDamageCollider();
         quickSlotsUI.UpdateWeaponQuickSlotsUI(true, weaponItem);
         if (weaponItem != null)
         {
             animator.CrossFade(weaponItem.left_hand_idle, 0.2f);
         }
         else
         {
             animator.CrossFade("Left Arm Empty", 0.2f);
         }
     }
     else
     {
         rightHandSlot.LoadWeaponModel(weaponItem);
         LoadRightWeaponDamageCollider();
         //quickSlotsUI.UpdateWeaponQuickSlotsUI(false, weaponItem);
         if (weaponItem != null)
         {
             animator.CrossFade(weaponItem.right_hand_idle, 0.2f);
         }
         else
         {
             animator.CrossFade("Right Arm Empty", 0.2f);
         }
     }
 }
示例#5
0
        public void ChangeRightWeapon()
        {
            currentRightWeaponIndex = currentRightWeaponIndex + 1;
            if (currentRightWeaponIndex == 0 && weaponsInRightHandSlots[0] != null)
            {
                rightWeapon = weaponsInRightHandSlots[currentRightWeaponIndex];
                weaponSlotManager.LoadWeaponOnSlot(weaponsInRightHandSlots[currentRightWeaponIndex], false);
            }
            else if (currentRightWeaponIndex == 0 && weaponsInRightHandSlots[0] == null)
            {
                currentRightWeaponIndex = currentRightWeaponIndex + 1;
            }

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

            if (currentRightWeaponIndex > weaponsInRightHandSlots.Length - 1)
            {
                currentRightWeaponIndex = -1;
                rightWeapon             = unarmedWeapon;
                weaponSlotManager.LoadWeaponOnSlot(unarmedWeapon, false);
            }
        }
示例#6
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;
        }
示例#7
0
 public void UpdateWeaponQuickSlotsUI(bool isLeft, WeaponItem weapon)
 {
     if (isLeft == false)
     {
         if (weapon.itemIcon != null)
         {
             rightWeaponIcon.sprite  = weapon.itemIcon;
             rightWeaponIcon.enabled = true;
         }
         else
         {
             rightWeaponIcon.sprite  = null;
             rightWeaponIcon.enabled = false;
         }
     }
     else
     {
         if (weapon.itemIcon != null)
         {
             leftWeaponIcon.sprite  = weapon.itemIcon;
             leftWeaponIcon.enabled = true;
         }
         else
         {
             leftWeaponIcon.sprite  = null;
             leftWeaponIcon.enabled = false;
         }
     }
 }
示例#8
0
 public void ClearItem()
 {
     weapon       = null;
     icon.sprite  = null;
     icon.enabled = false;
     gameObject.SetActive(false);
 }
示例#9
0
 public void AddItem(WeaponItem newWeapon)
 {
     weapon       = newWeapon;
     icon.sprite  = weapon.itemIcon;
     icon.enabled = true;
     gameObject.SetActive(true);
 }
示例#10
0
 private void Start()
 {
     rightWeapon = weaponsInRightHandSlots[0];
     leftWeapon  = weaponsInLeftHandSlots[0];
     weaponSlotManager.LoadWeaponOnSlot(rightWeapon, false);
     weaponSlotManager.LoadWeaponOnSlot(leftWeapon, true);
     rightWeapon = weaponsInRightHandSlots[currentRightWeaponIndex];
     leftWeapon  = weaponsInLeftHandSlots[currentLeftWeaponIndex];
     weaponSlotManager.LoadWeaponOnSlot(rightWeapon, false);
     weaponSlotManager.LoadWeaponOnSlot(leftWeapon, true);
 }
示例#11
0
 public void HandleWeaponCombo(WeaponItem weapon)
 {
     if (inputHandler.comboFlag)
     {
         animatorHandler.anim.SetBool("canDoCombo", false);
         if (lastAttack == weapon.OH_Light_Attack_1)
         {
             animatorHandler.PlayTargetAnimation(weapon.OH_Light_Attack_1, true);
         }
     }
 }
示例#12
0
 public void HandleHeavyAttack(WeaponItem weapon)
 {
     weaponSlotManager.attackingWeapon = weapon;
     animatorHandler.PlayTargetAnimation(weapon.OH_Heavy_Attack_1, true);
     lastAttack = weapon.OH_Light_Attack_1;
 }