Example #1
0
        void EquipWeaponOnGameStart()
        {
            currentWeaponRuntime.aiInventoryController = this;
            currentWeaponRuntime.FreshSpawnWeapon();
            currentWeaponRuntime.Init();
            currentWeaponRuntime.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;
            }
        }
        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);
        }