public void ClearItem()
 {
     weapon       = null;
     icon.sprite  = null;
     icon.enabled = false;
     gameObject.SetActive(false);
 }
        public void ChangeLeftWeapon()
        {
            currentLeftWeaponIndex = currentLeftWeaponIndex + 1;

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

            if (currentLeftWeaponIndex > weaponInLeftHandSlots.Length - 1)
            {
                currentLeftWeaponIndex = -1;
                leftWeapon             = unarmedWeapon;
                weaponSlotManager.LoadWeaponOnSlot(unarmedWeapon, true);
            }
        }
 public void AddItem(WeaponItem newWeapon)
 {
     weapon       = newWeapon;
     icon.sprite  = weapon.itemIcon;
     icon.enabled = true;
     gameObject.SetActive(true);
 }
        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;
        }
示例#5
0
 public void ClearInventorySlot()
 {
     item         = null;
     icon.sprite  = null;
     icon.enabled = false;
     gameObject.SetActive(false);
 }
示例#6
0
 public void AddItem(WeaponItem newItem)
 {
     item         = newItem;
     icon.sprite  = item.itemIcon;
     icon.enabled = true;
     gameObject.SetActive(true);
 }
 public void UpdateWeaponQuicklostsUI(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;
         }
     }
 }
 public void HandleWeaponCombo(WeaponItem weapon)
 {
     if (inputHandler.comboFlag)
     {
         animatorHandler.anim.SetBool("canDoCombo", false);
         if (lastAttack == weapon.oneHandedLightAttack1)
         {
             animatorHandler.PlayTargetAnimation(weapon.oneHandedLightAttack2, true);
         }
     }
 }
示例#9
0
        public void LoadWeaponOnSlot(WeaponItem weaponItem, bool isLeft)
        {
            if (isLeft)
            {
                leftHandSlot.LoadWeaponModel(weaponItem);
                LoadLeftDamageCollider();
                quickSlotUI.UpdateWeaponQuicklostsUI(true, weaponItem);

                #region Handle left hand idle animations
                if (weaponItem != null)
                {
                    animator.CrossFade(weaponItem.left_hand_idle, 0.2f);
                }
                else
                {
                    animator.CrossFade("Left Arm Empty", 0.2f);
                }
                #endregion
            }
            else
            {
                rightHandSlot.LoadWeaponModel(weaponItem);
                LoadRightDamageCollider();
                quickSlotUI.UpdateWeaponQuicklostsUI(false, weaponItem);

                #region Handle right hand idle animations
                if (weaponItem != null)
                {
                    animator.CrossFade(weaponItem.right_hand_idle, 0.2f);
                }
                else
                {
                    animator.CrossFade("Right Arm Empty", 0.2f);
                }
                #endregion
            }
        }
 private void Start()
 {
     rightWeapon = unarmedWeapon;
     leftWeapon  = unarmedWeapon;
 }
 public void HandleHeavyAttack(WeaponItem weapon)
 {
     weaponSlotManager.attackingWeapon = weapon;
     animatorHandler.PlayTargetAnimation(weapon.oneHandedHeavyAttack1, true);
     lastAttack = weapon.oneHandedHeavyAttack1;
 }