Exemplo n.º 1
0
        public void EquipExistingWeapon(WeaponItemRuntime weapon)
        {
            weapon.transform.SetParent(rightHandTrans);
            weapon.transform.localPosition = Vector3.zero;
            weapon.transform.localRotation = Quaternion.identity;

            currentWeaponRuntime    = weapon;
            currentInHandWeaponData = weapon.weaponItemData;
            weapon.PickupWeaponPlayer();
            weapon.DisableCollisionColliders();

            animController.SetAnimInt(animController.animData.weaponAnimID, currentWeaponRuntime.weaponItemData.weaponAnimID);
            animController.PlayAnimationHash(animController.animData.getNewWeaponAnimationClass);

            switch (currentInHandWeaponData.weaponType)
            {
            case WeaponType.RANGED:
                EquipRangedWeapon();
                break;

            case WeaponType.MELEE:
                EquipMeleeWeapon();
                break;
            }
        }
 public void NewWeaponEquipped(WeaponType newWeapon, WeaponItemRuntime itemRuntime)
 {
     itemRuntime.transform.SetParent(playerRightHand);
     itemRuntime.transform.localPosition = Vector3.zero;
     itemRuntime.transform.localRotation = Quaternion.identity;
     itemRuntime.canAttack = true;
     itemRuntime.PickupWeaponPlayer();
     inventoryWeapons.Add(itemRuntime);
     ChangeCurrentInHandWeapon(itemRuntime);
 }
        void SpawnFreshWeapon(WeaponItem item)
        {
            WeaponItemRanged_DualWielded dualItem = item as WeaponItemRanged_DualWielded;

            if (dualItem != null)
            {
                SpawnDualWieldItem(dualItem);
                return;
            }

            GameObject weaponGeo = Instantiate(item.weaponPrefab, playerRightHand);

            weaponGeo.transform.localPosition = Vector3.zero;
            weaponGeo.transform.localRotation = Quaternion.identity;
            weaponGeo.SetActive(false);

            WeaponItemRuntime runtimeComponent = weaponGeo.GetComponent <WeaponItemRuntime>();

            runtimeComponent.FreshSpawnWeapon();
            runtimeComponent.PickupWeaponPlayer();
            runtimeComponent.Init();
            inventoryWeapons.Add(runtimeComponent);
        }