add ckg
plantilla base para movimiento básico
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aba8838cbca05e9428104ba03f4c9eca
|
||||
folderAsset: yes
|
||||
timeCreated: 1573354029
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,116 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ammoOnInventory : objectOnInventory
|
||||
{
|
||||
public ammoPickup mainAmmoPickup;
|
||||
|
||||
string ammoName;
|
||||
|
||||
public override void activateCombineObjectActionOnInventory (GameObject currentPlayer, inventoryInfo inventoryInfoToUse)
|
||||
{
|
||||
int amountTaken = 0;
|
||||
|
||||
bool canCombineAmmo = false;
|
||||
|
||||
ammoName = mainAmmoPickup.ammoName;
|
||||
|
||||
print ("ammo selected for the weapon " + ammoName);
|
||||
|
||||
playerComponentsManager currentPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
|
||||
|
||||
playerWeaponsManager weaponsManager = currentPlayerComponentsManager.getPlayerWeaponsManager ();
|
||||
|
||||
playerWeaponSystem currrentPlayerWeaponSystem = weaponsManager.getWeaponSystemByName (ammoName);
|
||||
|
||||
inventoryManager mainInventoryManager = currentPlayerComponentsManager.getInventoryManager ();
|
||||
|
||||
print ("ammo type selected is " + currrentPlayerWeaponSystem.getWeaponSystemName () + " to combine with the ammo for the weapon " + ammoName);
|
||||
|
||||
bool ammoToUseIsForWeaponSelected = false;
|
||||
inventoryInfo firstObjectToCombine = mainInventoryManager.getCurrentFirstObjectToCombine ();
|
||||
inventoryInfo secondObjectToCombine = mainInventoryManager.getCurrentSecondObjectToCombine ();
|
||||
|
||||
print ("first inventory object selected is " + firstObjectToCombine.Name);
|
||||
print ("second inventory object selected is " + secondObjectToCombine.Name);
|
||||
|
||||
if (firstObjectToCombine.isWeapon && firstObjectToCombine.mainWeaponObjectInfo.getWeaponAmmoName () == secondObjectToCombine.Name) {
|
||||
ammoToUseIsForWeaponSelected = true;
|
||||
} else {
|
||||
if (secondObjectToCombine.isWeapon && secondObjectToCombine.mainWeaponObjectInfo.getWeaponAmmoName () == firstObjectToCombine.Name) {
|
||||
ammoToUseIsForWeaponSelected = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (ammoToUseIsForWeaponSelected) {
|
||||
int amountAvailable = inventoryInfoToUse.amountPerUnit;
|
||||
|
||||
if (inventoryInfoToUse.storeTotalAmountPerUnit) {
|
||||
amountAvailable = inventoryInfoToUse.amount;
|
||||
}
|
||||
|
||||
print ("amount available " + amountAvailable);
|
||||
|
||||
bool weaponAvailable = weaponsManager.checkIfWeaponIsAvailable (ammoName);
|
||||
bool weaponHasAmmoLimit = weaponsManager.hasAmmoLimit (ammoName);
|
||||
|
||||
if (!weaponAvailable) {
|
||||
if (mainInventoryManager.existInPlayerInventoryFromName (ammoName)) {
|
||||
weaponAvailable = true;
|
||||
|
||||
weaponHasAmmoLimit = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (weaponAvailable) {
|
||||
if (weaponHasAmmoLimit) {
|
||||
bool weaponHasMaximumAmmoAmount = weaponsManager.hasMaximumAmmoAmount (ammoName);
|
||||
|
||||
if (weaponHasMaximumAmmoAmount) {
|
||||
print ("maximum amount on " + ammoName);
|
||||
} else {
|
||||
amountTaken = applyDamage.getPlayerWeaponAmmoAmountToPick (weaponsManager, ammoName, amountAvailable);
|
||||
}
|
||||
|
||||
print ("use weapon ammo limit");
|
||||
} else {
|
||||
if (currrentPlayerWeaponSystem.isUseRemainAmmoFromInventoryActive ()) {
|
||||
int magazineSizeToRefill = currrentPlayerWeaponSystem.getAmmoAmountToRefillMagazine ();
|
||||
|
||||
print ("magazine free space " + magazineSizeToRefill);
|
||||
if (magazineSizeToRefill > 0) {
|
||||
if (amountAvailable >= magazineSizeToRefill) {
|
||||
amountTaken = magazineSizeToRefill;
|
||||
} else {
|
||||
amountTaken = amountAvailable;
|
||||
}
|
||||
} else {
|
||||
amountTaken = 0;
|
||||
|
||||
canCombineAmmo = true;
|
||||
}
|
||||
|
||||
print ("use remain ammo from inventory active");
|
||||
} else {
|
||||
amountTaken = amountAvailable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print (amountTaken);
|
||||
|
||||
if (amountTaken > 0) {
|
||||
weaponsManager.setWeaponRemainAmmoFromInventory (currrentPlayerWeaponSystem);
|
||||
|
||||
weaponsManager.AddAmmo ((int)Mathf.Round (amountTaken), ammoName);
|
||||
|
||||
canCombineAmmo = true;
|
||||
}
|
||||
} else {
|
||||
print ("Weapon selected doesn't use the ammo of the " + ammoName);
|
||||
}
|
||||
|
||||
mainInventoryManager.setCombineObjectsWithNewBehaviorResult ((int)amountTaken, canCombineAmmo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6fc65a721246a1745b929c81fe467156
|
||||
timeCreated: 1565430059
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/Inventory Pickups Behaviour/ammoOnInventory.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,45 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class energyOnInventory : objectOnInventory
|
||||
{
|
||||
public override void activateUseObjectActionOnInventoryWithExternalCharacter (GameObject currentPlayer, GameObject currentExternalCharacterForInventoryUsage, int amountToUse)
|
||||
{
|
||||
useObject (currentPlayer, currentExternalCharacterForInventoryUsage, amountToUse);
|
||||
}
|
||||
|
||||
public override void activateUseObjectActionOnInventory (GameObject currentPlayer, int amountToUse)
|
||||
{
|
||||
useObject (currentPlayer, currentPlayer, amountToUse);
|
||||
}
|
||||
|
||||
void useObject (GameObject characterInventoryOwner, GameObject characterToReceiveObjectEffect, int amountToUse)
|
||||
{
|
||||
float totalAmountToUse = mainInventoryObject.inventoryObjectInfo.amountPerUnit * amountToUse;
|
||||
|
||||
float totalAmountToPick = applyDamage.getEnergyAmountToPick (characterToReceiveObjectEffect, totalAmountToUse);
|
||||
|
||||
applyDamage.setEnergy (totalAmountToPick, characterToReceiveObjectEffect);
|
||||
|
||||
int totalAmountUsed = (int)totalAmountToPick / mainInventoryObject.inventoryObjectInfo.amountPerUnit;
|
||||
|
||||
if (totalAmountToPick % totalAmountToUse > 0) {
|
||||
totalAmountUsed += 1;
|
||||
}
|
||||
|
||||
if (!useOnlyAmountNeeded) {
|
||||
totalAmountUsed = amountToUse;
|
||||
}
|
||||
|
||||
if (amountToUse > 0) {
|
||||
checkExternalElementsOnUseInventoryObject (characterToReceiveObjectEffect);
|
||||
}
|
||||
|
||||
inventoryManager currentInventoryManager = characterInventoryOwner.GetComponent<inventoryManager> ();
|
||||
|
||||
if (currentInventoryManager != null) {
|
||||
currentInventoryManager.setUseObjectWithNewBehaviorResult (totalAmountUsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 229945a4d70f6da49be33f41ecd2e8a1
|
||||
timeCreated: 1565494931
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/Inventory Pickups Behaviour/energyOnInventory.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,60 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class healthOnInventory : objectOnInventory
|
||||
{
|
||||
public bool showDebugPrint;
|
||||
|
||||
public override void activateUseObjectActionOnInventoryWithExternalCharacter (GameObject currentPlayer, GameObject currentExternalCharacterForInventoryUsage, int amountToUse)
|
||||
{
|
||||
useObject (currentPlayer, currentExternalCharacterForInventoryUsage, amountToUse);
|
||||
}
|
||||
|
||||
public override void activateUseObjectActionOnInventory (GameObject currentPlayer, int amountToUse)
|
||||
{
|
||||
useObject (currentPlayer, currentPlayer, amountToUse);
|
||||
}
|
||||
|
||||
void useObject (GameObject characterInventoryOwner, GameObject characterToReceiveObjectEffect, int amountToUse)
|
||||
{
|
||||
float totalAmountToUse = mainInventoryObject.inventoryObjectInfo.amountPerUnit * amountToUse;
|
||||
|
||||
float totalAmountToPick = applyDamage.getHealthAmountToPick (characterToReceiveObjectEffect, totalAmountToUse);
|
||||
|
||||
int totalAmountUsed = 0;
|
||||
|
||||
if (!useOnlyAmountNeeded || totalAmountToPick > 0) {
|
||||
applyDamage.setHeal (totalAmountToPick, characterToReceiveObjectEffect);
|
||||
|
||||
totalAmountUsed = (int)totalAmountToPick / mainInventoryObject.inventoryObjectInfo.amountPerUnit;
|
||||
|
||||
if (totalAmountToPick % totalAmountToUse > 0) {
|
||||
totalAmountUsed += 1;
|
||||
}
|
||||
|
||||
if (!useOnlyAmountNeeded) {
|
||||
totalAmountUsed = amountToUse;
|
||||
}
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("health refilled " + totalAmountToPick);
|
||||
print ("health units used " + totalAmountUsed);
|
||||
}
|
||||
|
||||
checkExternalElementsOnUseInventoryObject (characterToReceiveObjectEffect);
|
||||
}
|
||||
|
||||
inventoryManager currentInventoryManager = characterInventoryOwner.GetComponent<inventoryManager> ();
|
||||
|
||||
if (currentInventoryManager != null) {
|
||||
currentInventoryManager.setUseObjectWithNewBehaviorResult (totalAmountUsed);
|
||||
|
||||
if (closeInventoryOnObjectUsed && totalAmountUsed > 0) {
|
||||
if (currentInventoryManager.isInventoryMenuOpened ()) {
|
||||
currentInventoryManager.openOrCloseInventory (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85d97a8c5c0038045bc940607e2a375a
|
||||
timeCreated: 1565482883
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/Inventory Pickups Behaviour/healthOnInventory.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,45 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class jetpackFuelOnInventory : objectOnInventory
|
||||
{
|
||||
public override void activateUseObjectActionOnInventory (GameObject currentPlayer, int amountToUse)
|
||||
{
|
||||
float totalAmountToUse = mainInventoryObject.inventoryObjectInfo.amountPerUnit * amountToUse;
|
||||
|
||||
float totalAmountToPick = 0;
|
||||
|
||||
playerComponentsManager mainPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
|
||||
|
||||
if (mainPlayerComponentsManager != null) {
|
||||
jetpackSystem jetpackManager = mainPlayerComponentsManager.getJetpackSystem ();
|
||||
|
||||
if (jetpackManager != null) {
|
||||
totalAmountToPick = jetpackManager.getJetpackFuelAmountToPick ();
|
||||
|
||||
jetpackManager.getJetpackFuel (totalAmountToPick);
|
||||
}
|
||||
}
|
||||
|
||||
int totalAmountUsed = (int)totalAmountToPick / mainInventoryObject.inventoryObjectInfo.amountPerUnit;
|
||||
|
||||
if (totalAmountToPick % totalAmountToUse > 0) {
|
||||
totalAmountUsed += 1;
|
||||
}
|
||||
|
||||
if (!useOnlyAmountNeeded) {
|
||||
totalAmountUsed = amountToUse;
|
||||
}
|
||||
|
||||
if (amountToUse > 0) {
|
||||
checkExternalElementsOnUseInventoryObject (currentPlayer);
|
||||
}
|
||||
|
||||
inventoryManager currentInventoryManager = currentPlayer.GetComponent<inventoryManager> ();
|
||||
|
||||
if (currentInventoryManager != null) {
|
||||
currentInventoryManager.setUseObjectWithNewBehaviorResult (totalAmountUsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a1999e09e33dac49b82ec3d794d4a36
|
||||
timeCreated: 1565504211
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/Inventory Pickups Behaviour/jetpackFuelOnInventory.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,59 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class meleeShieldOnInventory : objectOnInventory
|
||||
{
|
||||
[Header ("Custom Settings")]
|
||||
[Space]
|
||||
|
||||
public meleeShieldPickup mainMeleeShieldPickup;
|
||||
|
||||
public override void activateUseObjectActionOnInventory (GameObject currentPlayer, int amountToUse)
|
||||
{
|
||||
playerComponentsManager mainPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
|
||||
|
||||
if (mainPlayerComponentsManager != null) {
|
||||
|
||||
checkExternalElementsOnUseInventoryObject (currentPlayer);
|
||||
|
||||
meleeWeaponsGrabbedManager mainMeleeWeaponsGrabbedManager = mainPlayerComponentsManager.getMeleeWeaponsGrabbedManager ();
|
||||
|
||||
if (mainMeleeWeaponsGrabbedManager != null) {
|
||||
mainMeleeWeaponsGrabbedManager.toggleDrawOrSheatheShield (mainMeleeShieldPickup.shieldName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void eventOnPickObject (GameObject currentPlayer)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void eventOnDropObject (GameObject currentPlayer)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override bool setObjectEquippedStateOnInventory (GameObject currentPlayer, bool state)
|
||||
{
|
||||
playerComponentsManager mainPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
|
||||
|
||||
if (mainPlayerComponentsManager != null) {
|
||||
meleeWeaponsGrabbedManager mainMeleeWeaponsGrabbedManager = mainPlayerComponentsManager.getMeleeWeaponsGrabbedManager ();
|
||||
|
||||
if (mainMeleeWeaponsGrabbedManager != null) {
|
||||
|
||||
if (state) {
|
||||
return mainMeleeWeaponsGrabbedManager.equipShield (mainMeleeShieldPickup.shieldName);
|
||||
} else {
|
||||
return mainMeleeWeaponsGrabbedManager.unequipeShield (mainMeleeShieldPickup.shieldName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2832daf17d071c34dafca96ebe907440
|
||||
timeCreated: 1617129003
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/Inventory Pickups Behaviour/meleeShieldOnInventory.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,40 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class meleeWeaponConsumableOnInventory : objectOnInventory
|
||||
{
|
||||
public bool showDebugPrint;
|
||||
|
||||
public meleeWeaponConsumablePickup mainMeleeWeaponConsumablePickup;
|
||||
|
||||
public override void activateUseObjectActionOnInventory (GameObject currentPlayer, int amountToUse)
|
||||
{
|
||||
playerComponentsManager currentPlayerComponetsManager = currentPlayer.GetComponent<playerComponentsManager> ();
|
||||
|
||||
if (currentPlayerComponetsManager != null) {
|
||||
|
||||
grabbedObjectMeleeAttackSystem currentGrabbedObjectMeleeAttackSystem = currentPlayerComponetsManager.getGrabbedObjectMeleeAttackSystem ();
|
||||
|
||||
if (currentGrabbedObjectMeleeAttackSystem != null) {
|
||||
if (currentGrabbedObjectMeleeAttackSystem.setDamageTypeAndReactionInfo (mainMeleeWeaponConsumablePickup.weaponConsumableName)) {
|
||||
checkExternalElementsOnUseInventoryObject (currentPlayer);
|
||||
} else {
|
||||
amountToUse = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inventoryManager currentInventoryManager = currentPlayer.GetComponent<inventoryManager> ();
|
||||
|
||||
if (currentInventoryManager != null) {
|
||||
currentInventoryManager.setUseObjectWithNewBehaviorResult (amountToUse);
|
||||
|
||||
if (closeInventoryOnObjectUsed && amountToUse > 0) {
|
||||
if (currentInventoryManager.isInventoryMenuOpened ()) {
|
||||
currentInventoryManager.openOrCloseInventory (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3cde2fa7682b56c4eb47641a06770d09
|
||||
timeCreated: 1623454124
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/Inventory Pickups Behaviour/meleeWeaponConsumableOnInventory.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,45 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class meleeWeaponOnInventory : objectOnInventory
|
||||
{
|
||||
[Header ("Custom Settings")]
|
||||
[Space]
|
||||
|
||||
public meleeWeaponPickup mainMeleeWeaponPickup;
|
||||
|
||||
public bool checkEventsOnChangeEquipState = true;
|
||||
|
||||
|
||||
// string weaponName;
|
||||
|
||||
public override void eventOnPickObject (GameObject currentPlayer)
|
||||
{
|
||||
// weaponName = mainMeleeWeaponPickup.weaponName;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void eventOnDropObject (GameObject currentPlayer)
|
||||
{
|
||||
// weaponName = mainMeleeWeaponPickup.weaponName;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override bool setObjectEquippedStateOnInventory (GameObject currentPlayer, bool state)
|
||||
{
|
||||
// weaponName = mainMeleeWeaponPickup.weaponName;
|
||||
|
||||
if (checkEventsOnChangeEquipState) {
|
||||
checkRemoteEvents (currentPlayer);
|
||||
|
||||
checkRemoteEventsOnSetObjectEquipState (currentPlayer, state);
|
||||
|
||||
checkIfEnableAbilitiesOnEquipInventoryObject (currentPlayer, state);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f56eec65b59b50547ad3f2ef3f0cfb82
|
||||
timeCreated: 1611322890
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/Inventory Pickups Behaviour/meleeWeaponOnInventory.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,331 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class objectOnInventory : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public inventoryObject mainInventoryObject;
|
||||
|
||||
public bool useOnlyAmountNeeded;
|
||||
|
||||
public bool closeInventoryOnObjectUsed;
|
||||
|
||||
[Space]
|
||||
[Header ("Condition Settings")]
|
||||
[Space]
|
||||
|
||||
public bool checkConditionsToUseObjectEnabled;
|
||||
|
||||
public bool playerOnGroundToUseObject;
|
||||
|
||||
public bool actionSystemNotPlayingAnimations;
|
||||
|
||||
public bool useCustomMessageOnConditionFailed;
|
||||
[TextArea (3, 10)] public string customMessageOnConditionFailed;
|
||||
|
||||
[Space]
|
||||
[Header ("Remote Events Settings")]
|
||||
[Space]
|
||||
|
||||
public bool useRemoteEvent;
|
||||
|
||||
[Space]
|
||||
|
||||
public List<string> remoteEventList = new List<string> ();
|
||||
|
||||
[Space]
|
||||
[Header ("Remote Events On Use Object Settings")]
|
||||
[Space]
|
||||
|
||||
public bool useRemoteEventOnUseObject;
|
||||
|
||||
[Space]
|
||||
|
||||
public List<string> remoteEventListOnUseObject = new List<string> ();
|
||||
|
||||
[Space]
|
||||
[Header ("Remote Events On Equip Object Settings")]
|
||||
[Space]
|
||||
|
||||
public bool useRemoteEventOnEquipObject;
|
||||
|
||||
[Space]
|
||||
|
||||
public List<string> remoteEventListOnEquipObject = new List<string> ();
|
||||
|
||||
[Space]
|
||||
[Space]
|
||||
|
||||
public bool useRemoteEventOnUnequipObject;
|
||||
|
||||
[Space]
|
||||
|
||||
public List<string> remoteEventListOnUnquipObject = new List<string> ();
|
||||
|
||||
[Space]
|
||||
[Header ("Enable Abilities on Equip Inventory Object Settings")]
|
||||
[Space]
|
||||
|
||||
public bool useAbilitiesListToEnableOnEquipInventoryObject;
|
||||
|
||||
[Space]
|
||||
|
||||
public List<string> abilitiesListToEnableOnEquipInventoryObject = new List<string> ();
|
||||
|
||||
[Space]
|
||||
[Header ("Enable Abilities on Use Inventory Object Settings")]
|
||||
[Space]
|
||||
|
||||
public bool useAbilitiesListToEnableOnUseInventoryObject;
|
||||
|
||||
[Space]
|
||||
|
||||
public List<string> abilitiesListToEnableOnUseInventoryObject = new List<string> ();
|
||||
|
||||
[Space]
|
||||
[Header ("Activate Abilities on Use Inventory Object Settings")]
|
||||
[Space]
|
||||
|
||||
public bool activateAbilityOnUseInventoryObject;
|
||||
|
||||
[Space]
|
||||
|
||||
public string abilityNameToActiveOnUseInventoryObject;
|
||||
public bool abilityIsTemporallyActivated;
|
||||
|
||||
public bool checkIfAbilityIsNotActiveOrOnCoolDown;
|
||||
|
||||
[Space]
|
||||
[Header ("Stats To Increase Settings")]
|
||||
[Space]
|
||||
|
||||
public bool increaseStatsValues;
|
||||
public List<objectExperienceSystem.statInfo> statsToIncreaseInfoList = new List<objectExperienceSystem.statInfo> ();
|
||||
|
||||
[Space]
|
||||
[Header ("Crafting Settings")]
|
||||
[Space]
|
||||
|
||||
public bool getCraftingRecipes;
|
||||
public List<string> craftingRecipesList = new List<string> ();
|
||||
|
||||
|
||||
public virtual void activateUseObjectActionOnInventory (GameObject currentPlayer, int amountToUse)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void activateUseObjectActionOnInventoryWithExternalCharacter (GameObject currentPlayer, GameObject currentExternalCharacterForInventoryUsage, int amountToUse)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void activateCombineObjectActionOnInventory (GameObject currentPlayer, inventoryInfo inventoryInfoToUse)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void carryPhysicalObjectFromInventory (GameObject currentPlayer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void eventOnPickObject (GameObject currentPlayer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void eventOnDropObject (GameObject currentPlayer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void checkRemoteEvents (GameObject currentPlayer)
|
||||
{
|
||||
if (useRemoteEvent) {
|
||||
if (remoteEventList.Count == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
playerComponentsManager currentPlayerComponetsManager = currentPlayer.GetComponent<playerComponentsManager> ();
|
||||
|
||||
if (currentPlayerComponetsManager != null) {
|
||||
remoteEventSystem currentRemoteEventSystem = currentPlayerComponetsManager.getRemoteEventSystem ();
|
||||
|
||||
if (currentRemoteEventSystem != null) {
|
||||
for (int i = 0; i < remoteEventList.Count; i++) {
|
||||
|
||||
currentRemoteEventSystem.callRemoteEvent (remoteEventList [i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void checkRemoteEventsOnUseObject (GameObject currentPlayer)
|
||||
{
|
||||
if (useRemoteEventOnUseObject) {
|
||||
if (remoteEventListOnUseObject.Count == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
playerComponentsManager currentPlayerComponetsManager = currentPlayer.GetComponent<playerComponentsManager> ();
|
||||
|
||||
if (currentPlayerComponetsManager != null) {
|
||||
remoteEventSystem currentRemoteEventSystem = currentPlayerComponetsManager.getRemoteEventSystem ();
|
||||
|
||||
if (currentRemoteEventSystem != null) {
|
||||
for (int i = 0; i < remoteEventListOnUseObject.Count; i++) {
|
||||
|
||||
currentRemoteEventSystem.callRemoteEvent (remoteEventListOnUseObject [i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void checkRemoteEventsOnSetObjectEquipState (GameObject currentPlayer, bool state)
|
||||
{
|
||||
bool checkEvents = false;
|
||||
|
||||
if (useRemoteEventOnEquipObject && state) {
|
||||
if (remoteEventListOnEquipObject.Count > 0) {
|
||||
checkEvents = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (useRemoteEventOnUnequipObject && !state) {
|
||||
if (remoteEventListOnUnquipObject.Count > 0) {
|
||||
checkEvents = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (checkEvents) {
|
||||
playerComponentsManager currentPlayerComponetsManager = currentPlayer.GetComponent<playerComponentsManager> ();
|
||||
|
||||
if (currentPlayerComponetsManager != null) {
|
||||
remoteEventSystem currentRemoteEventSystem = currentPlayerComponetsManager.getRemoteEventSystem ();
|
||||
|
||||
if (currentRemoteEventSystem != null) {
|
||||
if (state) {
|
||||
if (useRemoteEventOnEquipObject) {
|
||||
for (int i = 0; i < remoteEventListOnEquipObject.Count; i++) {
|
||||
currentRemoteEventSystem.callRemoteEvent (remoteEventListOnEquipObject [i]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (useRemoteEventOnUnequipObject) {
|
||||
for (int i = 0; i < remoteEventListOnUnquipObject.Count; i++) {
|
||||
currentRemoteEventSystem.callRemoteEvent (remoteEventListOnUnquipObject [i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public virtual bool setObjectEquippedStateOnInventory (GameObject currentPlayer, bool state)
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// public virtual bool isObjectEquipped ()
|
||||
// {
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// public virtual void updateObjectState ()
|
||||
// {
|
||||
//
|
||||
// }
|
||||
|
||||
public virtual void checkIfEnableAbilitiesOnEquipInventoryObject (GameObject currentPlayer, bool state)
|
||||
{
|
||||
if (useAbilitiesListToEnableOnEquipInventoryObject && currentPlayer != null) {
|
||||
GKC_Utils.enableOrDisableAbilityGroupByName (currentPlayer.transform, state, abilitiesListToEnableOnEquipInventoryObject);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void checkIfEnableAbilitiesOnUseInventoryObject (GameObject currentPlayer)
|
||||
{
|
||||
if (useAbilitiesListToEnableOnUseInventoryObject && currentPlayer != null) {
|
||||
GKC_Utils.enableOrDisableAbilityGroupByName (currentPlayer.transform, true, abilitiesListToEnableOnUseInventoryObject);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void checkIfActivateAbilitiesOnUseInventoryObject (GameObject currentPlayer)
|
||||
{
|
||||
if (activateAbilityOnUseInventoryObject && currentPlayer != null) {
|
||||
GKC_Utils.activateAbilityByName (currentPlayer.transform, abilityNameToActiveOnUseInventoryObject, abilityIsTemporallyActivated, true);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool checkIfAbilitiesOnUseOrCooldown (GameObject currentPlayer)
|
||||
{
|
||||
if (activateAbilityOnUseInventoryObject && currentPlayer != null) {
|
||||
return GKC_Utils.checkIfAbilitiesOnUseOrCooldown (currentPlayer.transform, abilityNameToActiveOnUseInventoryObject);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void checkIfIncreaseStatsOnUseInventoryObject (GameObject currentPlayer)
|
||||
{
|
||||
if (increaseStatsValues && currentPlayer != null) {
|
||||
GKC_Utils.increaseStatsByList (currentPlayer.transform, true, statsToIncreaseInfoList);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void checkIfaddNewBlueprintsUnlockedList (GameObject currentPlayer)
|
||||
{
|
||||
if (getCraftingRecipes && currentPlayer != null) {
|
||||
GKC_Utils.addNewBlueprintsUnlockedList (currentPlayer, craftingRecipesList);
|
||||
}
|
||||
}
|
||||
|
||||
public bool checkConditions (GameObject currentPlayer)
|
||||
{
|
||||
if (checkConditionsToUseObjectEnabled) {
|
||||
playerController currentPlayerController = currentPlayer.GetComponent<playerController> ();
|
||||
|
||||
if (currentPlayerController != null) {
|
||||
if (playerOnGroundToUseObject) {
|
||||
if (!currentPlayerController.isPlayerOnGround ()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (actionSystemNotPlayingAnimations) {
|
||||
if (currentPlayerController.isActionActive ()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void checkExternalElementsOnUseInventoryObject (GameObject currentPlayer)
|
||||
{
|
||||
checkIfEnableAbilitiesOnUseInventoryObject (currentPlayer);
|
||||
|
||||
checkIfActivateAbilitiesOnUseInventoryObject (currentPlayer);
|
||||
|
||||
checkIfIncreaseStatsOnUseInventoryObject (currentPlayer);
|
||||
|
||||
checkIfaddNewBlueprintsUnlockedList (currentPlayer);
|
||||
|
||||
checkRemoteEvents (currentPlayer);
|
||||
|
||||
checkRemoteEventsOnUseObject (currentPlayer);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7fc4ef5e309f7d4289d930826da24d3
|
||||
timeCreated: 1565585603
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/Inventory Pickups Behaviour/objectOnInventory.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,45 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class oxygenOnInventory : objectOnInventory
|
||||
{
|
||||
public override void activateUseObjectActionOnInventoryWithExternalCharacter (GameObject currentPlayer, GameObject currentExternalCharacterForInventoryUsage, int amountToUse)
|
||||
{
|
||||
useObject (currentPlayer, currentExternalCharacterForInventoryUsage, amountToUse);
|
||||
}
|
||||
|
||||
public override void activateUseObjectActionOnInventory (GameObject currentPlayer, int amountToUse)
|
||||
{
|
||||
useObject (currentPlayer, currentPlayer, amountToUse);
|
||||
}
|
||||
|
||||
void useObject (GameObject characterInventoryOwner, GameObject characterToReceiveObjectEffect, int amountToUse)
|
||||
{
|
||||
float totalAmountToUse = mainInventoryObject.inventoryObjectInfo.amountPerUnit * amountToUse;
|
||||
|
||||
float totalAmountToPick = applyDamage.getOxygenAmountToPick (characterToReceiveObjectEffect, totalAmountToUse);
|
||||
|
||||
applyDamage.setOxygen (totalAmountToPick, characterToReceiveObjectEffect);
|
||||
|
||||
int totalAmountUsed = (int)totalAmountToPick / mainInventoryObject.inventoryObjectInfo.amountPerUnit;
|
||||
|
||||
if (totalAmountToPick % totalAmountToUse > 0) {
|
||||
totalAmountUsed += 1;
|
||||
}
|
||||
|
||||
if (!useOnlyAmountNeeded) {
|
||||
totalAmountUsed = amountToUse;
|
||||
}
|
||||
|
||||
if (amountToUse > 0) {
|
||||
checkExternalElementsOnUseInventoryObject (characterToReceiveObjectEffect);
|
||||
}
|
||||
|
||||
inventoryManager currentInventoryManager = characterInventoryOwner.GetComponent<inventoryManager> ();
|
||||
|
||||
if (currentInventoryManager != null) {
|
||||
currentInventoryManager.setUseObjectWithNewBehaviorResult (totalAmountUsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a76c8915dd8284442a02b8b950668cd8
|
||||
timeCreated: 1566641310
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/Inventory Pickups Behaviour/oxygenOnInventory.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class shieldOnInventory : objectOnInventory
|
||||
{
|
||||
public override void activateUseObjectActionOnInventory (GameObject currentPlayer, int amountToUse)
|
||||
{
|
||||
float totalAmountToUse = mainInventoryObject.inventoryObjectInfo.amountPerUnit * amountToUse;
|
||||
|
||||
float totalAmountToPick = applyDamage.getShieldAmountToPick (currentPlayer, totalAmountToUse);
|
||||
|
||||
applyDamage.setShield (totalAmountToPick, currentPlayer);
|
||||
|
||||
int totalAmountUsed = (int)totalAmountToPick / mainInventoryObject.inventoryObjectInfo.amountPerUnit;
|
||||
|
||||
if (totalAmountToPick % totalAmountToUse > 0) {
|
||||
totalAmountUsed += 1;
|
||||
}
|
||||
|
||||
if (!useOnlyAmountNeeded) {
|
||||
totalAmountUsed = amountToUse;
|
||||
}
|
||||
|
||||
if (amountToUse > 0) {
|
||||
checkExternalElementsOnUseInventoryObject (currentPlayer);
|
||||
}
|
||||
|
||||
inventoryManager currentInventoryManager = currentPlayer.GetComponent<inventoryManager> ();
|
||||
|
||||
if (currentInventoryManager != null) {
|
||||
currentInventoryManager.setUseObjectWithNewBehaviorResult (totalAmountUsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0cc7dd0f21ec9cb46b65f5293787864b
|
||||
timeCreated: 1566402425
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/Inventory Pickups Behaviour/shieldOnInventory.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,45 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class staminaOnInventory : objectOnInventory
|
||||
{
|
||||
public override void activateUseObjectActionOnInventoryWithExternalCharacter (GameObject currentPlayer, GameObject currentExternalCharacterForInventoryUsage, int amountToUse)
|
||||
{
|
||||
useObject (currentPlayer, currentExternalCharacterForInventoryUsage, amountToUse);
|
||||
}
|
||||
|
||||
public override void activateUseObjectActionOnInventory (GameObject currentPlayer, int amountToUse)
|
||||
{
|
||||
useObject (currentPlayer, currentPlayer, amountToUse);
|
||||
}
|
||||
|
||||
void useObject (GameObject characterInventoryOwner, GameObject characterToReceiveObjectEffect, int amountToUse)
|
||||
{
|
||||
float totalAmountToUse = mainInventoryObject.inventoryObjectInfo.amountPerUnit * amountToUse;
|
||||
|
||||
float totalAmountToPick = applyDamage.getStaminaAmountToPick (characterToReceiveObjectEffect, totalAmountToUse);
|
||||
|
||||
applyDamage.setStamina (totalAmountToPick, characterToReceiveObjectEffect, false);
|
||||
|
||||
int totalAmountUsed = (int)totalAmountToPick / mainInventoryObject.inventoryObjectInfo.amountPerUnit;
|
||||
|
||||
if (totalAmountToPick % totalAmountToUse > 0) {
|
||||
totalAmountUsed += 1;
|
||||
}
|
||||
|
||||
if (!useOnlyAmountNeeded) {
|
||||
totalAmountUsed = amountToUse;
|
||||
}
|
||||
|
||||
if (amountToUse > 0) {
|
||||
checkExternalElementsOnUseInventoryObject (characterToReceiveObjectEffect);
|
||||
}
|
||||
|
||||
inventoryManager currentInventoryManager = characterInventoryOwner.GetComponent<inventoryManager> ();
|
||||
|
||||
if (currentInventoryManager != null) {
|
||||
currentInventoryManager.setUseObjectWithNewBehaviorResult (totalAmountUsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7778eee72a010a3449d9d6bbfa05032e
|
||||
timeCreated: 1566498719
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/Inventory Pickups Behaviour/staminaOnInventory.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class vehicleFuelOnInventory : MonoBehaviour {
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e78bf2f7581157479da89a896defa1e
|
||||
timeCreated: 1576149719
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/Inventory Pickups Behaviour/vehicleFuelOnInventory.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,55 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class weaponAttachmentOnInventory : objectOnInventory
|
||||
{
|
||||
public weaponAttachmentPickup mainWeaponAttachmentPickup;
|
||||
|
||||
string attachmentName;
|
||||
|
||||
public override void activateCombineObjectActionOnInventory (GameObject currentPlayer, inventoryInfo inventoryInfoToUse)
|
||||
{
|
||||
playerComponentsManager mainPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
|
||||
|
||||
if (mainPlayerComponentsManager != null) {
|
||||
playerWeaponsManager weaponsManager = mainPlayerComponentsManager.getPlayerWeaponsManager ();
|
||||
|
||||
inventoryManager mainInventoryManager = mainPlayerComponentsManager.getInventoryManager ();
|
||||
|
||||
if (mainInventoryManager != null) {
|
||||
|
||||
attachmentName = mainWeaponAttachmentPickup.attachmentName;
|
||||
|
||||
string weaponName = "";
|
||||
|
||||
bool canCombineAttachment = false;
|
||||
|
||||
inventoryInfo firstObjectToCombine = mainInventoryManager.getCurrentFirstObjectToCombine ();
|
||||
|
||||
if (firstObjectToCombine.isWeapon) {
|
||||
weaponName = firstObjectToCombine.Name;
|
||||
} else {
|
||||
inventoryInfo secondObjectToCombine = mainInventoryManager.getCurrentSecondObjectToCombine ();
|
||||
|
||||
if (secondObjectToCombine.isWeapon) {
|
||||
weaponName = secondObjectToCombine.Name;
|
||||
}
|
||||
}
|
||||
|
||||
if (weaponName != "") {
|
||||
|
||||
if (weaponsManager.pickupAttachment (weaponName, attachmentName)) {
|
||||
canCombineAttachment = true;
|
||||
}
|
||||
|
||||
if (!canCombineAttachment) {
|
||||
weaponsManager.showCantPickAttacmentMessage (attachmentName);
|
||||
}
|
||||
}
|
||||
|
||||
mainInventoryManager.setCombineObjectsWithNewBehaviorResult (1, canCombineAttachment);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c3c7ba5c69775044ea5670b77a937eb8
|
||||
timeCreated: 1565507937
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/Inventory Pickups Behaviour/weaponAttachmentOnInventory.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,55 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class weaponOnInventory : objectOnInventory
|
||||
{
|
||||
[Header ("Custom Settings")]
|
||||
[Space]
|
||||
|
||||
public weaponPickup mainWeaponPickup;
|
||||
|
||||
public bool checkEventsOnChangeEquipState = true;
|
||||
|
||||
public int remainingAmmo = -1;
|
||||
|
||||
string weaponName;
|
||||
|
||||
|
||||
public override void eventOnPickObject (GameObject currentPlayer)
|
||||
{
|
||||
if (remainingAmmo > -1) {
|
||||
weaponName = mainWeaponPickup.weaponName;
|
||||
|
||||
playerWeaponsManager weaponsManager = currentPlayer.GetComponent<playerWeaponsManager> ();
|
||||
|
||||
playerWeaponSystem currrentPlayerWeaponSystem = weaponsManager.getWeaponSystemByName (weaponName);
|
||||
|
||||
currrentPlayerWeaponSystem.setCurrentProjectilesInMagazine (remainingAmmo);
|
||||
}
|
||||
}
|
||||
|
||||
public override void eventOnDropObject (GameObject currentPlayer)
|
||||
{
|
||||
weaponName = mainWeaponPickup.weaponName;
|
||||
|
||||
playerWeaponsManager weaponsManager = currentPlayer.GetComponent<playerWeaponsManager> ();
|
||||
|
||||
playerWeaponSystem currrentPlayerWeaponSystem = weaponsManager.getWeaponSystemByName (weaponName);
|
||||
|
||||
remainingAmmo = currrentPlayerWeaponSystem.getProjectilesInMagazine ();
|
||||
}
|
||||
|
||||
public override bool setObjectEquippedStateOnInventory (GameObject currentPlayer, bool state)
|
||||
{
|
||||
if (checkEventsOnChangeEquipState) {
|
||||
checkRemoteEvents (currentPlayer);
|
||||
|
||||
checkRemoteEventsOnSetObjectEquipState (currentPlayer, state);
|
||||
|
||||
checkIfEnableAbilitiesOnEquipInventoryObject (currentPlayer, state);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7826f206167d46d4bb651bfc8308381f
|
||||
timeCreated: 1574822294
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/Inventory Pickups Behaviour/weaponOnInventory.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 211b2eea83d0eb142a1197c462fe7264
|
||||
folderAsset: yes
|
||||
timeCreated: 1614637723
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,61 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class inventoryQuickAccessSlotElement : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public quickAccessSlotInfo mainQuickAccessSlotInfo;
|
||||
|
||||
[System.Serializable]
|
||||
public class quickAccessSlotInfo
|
||||
{
|
||||
public string Name;
|
||||
public bool slotActive;
|
||||
public GameObject slot;
|
||||
|
||||
[Space]
|
||||
|
||||
public string slotCategoryName;
|
||||
|
||||
[Space]
|
||||
|
||||
public Text amountText;
|
||||
public RawImage slotIcon;
|
||||
|
||||
[Space]
|
||||
|
||||
public RawImage rightSecondarySlotIcon;
|
||||
public RawImage leftSecondarySlotIcon;
|
||||
|
||||
[Space]
|
||||
|
||||
public bool secondarySlotActive;
|
||||
|
||||
public string firstElementName;
|
||||
public string secondElementName;
|
||||
|
||||
[Space]
|
||||
|
||||
public Text iconNumberKeyText;
|
||||
|
||||
public Transform slotSelectedIconPosition;
|
||||
|
||||
public GameObject currentlySelectedIcon;
|
||||
|
||||
public Image backgroundImage;
|
||||
|
||||
public GameObject slotMainSingleContent;
|
||||
public GameObject slotMainDualContent;
|
||||
|
||||
public GameObject amountTextContent;
|
||||
|
||||
[Space]
|
||||
[Space]
|
||||
|
||||
public inventoryInfo inventoryInfoAssigned;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65a71a0340cab2e4f9e5ee2b0e227fd3
|
||||
timeCreated: 1611438126
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/Inventory Quick Access
|
||||
System/inventoryQuickAccessSlotElement.cs
|
||||
uploadId: 814740
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,20 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6fba8304bbbb59479d894b6178194fd
|
||||
timeCreated: 1611212048
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/Inventory Quick Access
|
||||
System/inventoryQuickAccessSlotsSystem.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64d62528ceec00849a746524e946d476
|
||||
folderAsset: yes
|
||||
timeCreated: 1586365117
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu (fileName = "Initial Inventory List Data", menuName = "GKC/Create Initial Inventory List Data", order = 51)]
|
||||
public class initialinventoryListData : ScriptableObject
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public int ID;
|
||||
|
||||
[Space]
|
||||
|
||||
public List<initialInventoryObjectInfo> initialInventoryObjectInfoList = new List<initialInventoryObjectInfo> ();
|
||||
|
||||
[System.Serializable]
|
||||
public class initialInventoryObjectInfo
|
||||
{
|
||||
public string Name;
|
||||
public int amount;
|
||||
|
||||
public bool isEquipped;
|
||||
|
||||
public bool addInventoryObject = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 14a18edf5c34fa342b66285456c1949c
|
||||
timeCreated: 1677703155
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/Scriptable Objects/initialinventoryListData.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu (fileName = "Inventory List Data", menuName = "GKC/Create Inventory List Data", order = 51)]
|
||||
public class inventoryListManagerData : ScriptableObject
|
||||
{
|
||||
public List<inventoryCategoryInfo> inventoryList = new List<inventoryCategoryInfo> ();
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a85dbdace788e3b4ca3ffc77fc712a66
|
||||
timeCreated: 1586348770
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/Scriptable Objects/inventoryListManagerData.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ammoInventoryPrefabCreationSystem : inventoryPrefabCreationSystem
|
||||
{
|
||||
public override void createInventoryPrefabObject ()
|
||||
{
|
||||
ammoPickup currentAmmoPickup = GetComponent<ammoPickup> ();
|
||||
|
||||
inventoryObject currentInventoryObject = GetComponentInChildren<inventoryObject> ();
|
||||
|
||||
string newName = currentInventoryObject.inventoryObjectInfo.Name;
|
||||
|
||||
newName = newName.Replace (" Ammo", "");
|
||||
|
||||
currentAmmoPickup.setAmmoName (newName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: acc1e4129de373a4fad2a60d537ba5f2
|
||||
timeCreated: 1576347153
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/ammoInventoryPrefabCreationSystem.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,66 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class carryPhysicallyObjectFromInventory : objectOnInventory
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public grabPhysicalObjectSystem mainGrabPhysicalObjectSystem;
|
||||
|
||||
|
||||
public override void carryPhysicalObjectFromInventory (GameObject currentPlayer)
|
||||
{
|
||||
//check if player is already carrying a different physical object, to remove it properly
|
||||
//check also if that object is an inventory object, to send it back to the inventory
|
||||
|
||||
mainGrabPhysicalObjectSystem.setCurrentPlayer (currentPlayer);
|
||||
|
||||
grabObjects currentGrabObjects = currentPlayer.GetComponent<grabObjects> ();
|
||||
|
||||
if (currentGrabObjects != null) {
|
||||
bool isCarryingPhysicalObject = currentGrabObjects.isCarryingPhysicalObject ();
|
||||
|
||||
bool isSendGrabbedObjectToInventoryIfGrabbingNewOneEnabled = false;
|
||||
|
||||
GameObject currentObjectGrabbed = null;
|
||||
|
||||
playerComponentsManager currentPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
|
||||
|
||||
if (currentPlayerComponentsManager != null) {
|
||||
isSendGrabbedObjectToInventoryIfGrabbingNewOneEnabled = currentPlayerComponentsManager.getInventoryManager ().isSendGrabbedObjectToInventoryIfGrabbingNewOneEnabled ();
|
||||
}
|
||||
|
||||
if (isSendGrabbedObjectToInventoryIfGrabbingNewOneEnabled) {
|
||||
currentObjectGrabbed = currentGrabObjects.getCurrentPhysicalObjectGrabbed ();
|
||||
|
||||
if (currentObjectGrabbed != null) {
|
||||
if (currentObjectGrabbed.GetComponentInChildren<objectOnInventory> () == null) {
|
||||
currentObjectGrabbed = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isCarryingPhysicalObject) {
|
||||
currentGrabObjects.checkIfDropObjectIfPhysical ();
|
||||
|
||||
currentGrabObjects.grabPhysicalObjectExternally (gameObject);
|
||||
} else {
|
||||
currentGrabObjects.getClosestPhysicalObjectToGrab ();
|
||||
|
||||
currentGrabObjects.grabObject ();
|
||||
}
|
||||
|
||||
if (isSendGrabbedObjectToInventoryIfGrabbingNewOneEnabled) {
|
||||
if (currentObjectGrabbed != null) {
|
||||
pickUpObject currentPickupObject = currentObjectGrabbed.GetComponent<pickUpObject> ();
|
||||
|
||||
if (currentPickupObject != null) {
|
||||
currentPickupObject.pickObjectAfterXWait (currentPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3b80410c99776740a93cde49b053e42
|
||||
timeCreated: 1565819570
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/carryPhysicallyObjectFromInventory.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class consumableInventoryPrefabCreationSystem : inventoryPrefabCreationSystem
|
||||
{
|
||||
public override void createInventoryPrefabObject ()
|
||||
{
|
||||
generalPickup currentGeneralPickup = GetComponent<generalPickup> ();
|
||||
|
||||
inventoryObject currentInventoryObject = GetComponentInChildren<inventoryObject> ();
|
||||
|
||||
string newName = currentInventoryObject.inventoryObjectInfo.Name;
|
||||
|
||||
currentGeneralPickup.setConsumableName (newName);
|
||||
|
||||
currentGeneralPickup.setObjectTakenAsPickupMessage (newName + " x -AMOUNT-");
|
||||
|
||||
currentGeneralPickup.setObjectTakenAsInventoryMessage (newName + " x -AMOUNT- Stored");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb3a22cdba7e2e8439898b3a5020d7e3
|
||||
timeCreated: 1626669573
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/consumableInventoryPrefabCreationSystem.cs
|
||||
uploadId: 814740
|
||||
232
Assets/Game Kit Controller/Scripts/Inventory/currencySystem.cs
Normal file
232
Assets/Game Kit Controller/Scripts/Inventory/currencySystem.cs
Normal file
@@ -0,0 +1,232 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class currencySystem : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public int currentMoneyAmount;
|
||||
|
||||
public string statName = "Money";
|
||||
public string extraStringContent = "$";
|
||||
|
||||
public bool showTotalMoneyAmountOnChange;
|
||||
|
||||
public bool increaseMoneyTextSmoothly;
|
||||
public float increaseMoneyTextRate = 0.01f;
|
||||
public float delayToStartIncreasMoneyText = 0.5f;
|
||||
|
||||
[Space]
|
||||
|
||||
public float timeToShowTotalMoneyAmount;
|
||||
|
||||
public bool hideTotalAmountMoneyPAnelAfterDelay = true;
|
||||
|
||||
[Space]
|
||||
[Header ("Events Settings")]
|
||||
[Space]
|
||||
|
||||
public UnityEvent eventOnReceiveMoney;
|
||||
public eventParameters.eventToCallWithString eventOnReceiveMoneyWithString;
|
||||
|
||||
[Space]
|
||||
[Header ("Components")]
|
||||
[Space]
|
||||
|
||||
public GameObject totalMoneyAmountPanel;
|
||||
public Text totalMoneyAmountText;
|
||||
public playerStatsSystem playerStatsManager;
|
||||
|
||||
|
||||
int moneyToAdd;
|
||||
int previousMoneyAmount;
|
||||
|
||||
bool firstAmountAssigned;
|
||||
|
||||
bool previousMoneyToAddChecked = true;
|
||||
|
||||
Coroutine showTotalMoneyCoroutine;
|
||||
|
||||
bool lastAmountAddedIsPositive = true;
|
||||
|
||||
float customMoneyChangeSpeed;
|
||||
|
||||
|
||||
public void increaseTotalMoneyAmount (float extraValue, float customMoneyChangeSpeedValue)
|
||||
{
|
||||
customMoneyChangeSpeed = customMoneyChangeSpeedValue;
|
||||
|
||||
increaseTotalMoneyAmount (extraValue);
|
||||
}
|
||||
|
||||
public void increaseTotalMoneyAmount (float extraValue)
|
||||
{
|
||||
if (increaseMoneyTextSmoothly) {
|
||||
if (moneyToAdd == 0) {
|
||||
previousMoneyAmount = currentMoneyAmount;
|
||||
|
||||
previousMoneyToAddChecked = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (extraValue > 0) {
|
||||
lastAmountAddedIsPositive = true;
|
||||
} else {
|
||||
lastAmountAddedIsPositive = false;
|
||||
}
|
||||
|
||||
currentMoneyAmount += (int)extraValue;
|
||||
|
||||
eventOnReceiveMoney.Invoke ();
|
||||
|
||||
string newString = "";
|
||||
|
||||
if (extraValue > 0) {
|
||||
newString = "+";
|
||||
} else {
|
||||
newString = "-";
|
||||
}
|
||||
|
||||
newString += extraValue + extraStringContent;
|
||||
|
||||
eventOnReceiveMoneyWithString.Invoke (newString);
|
||||
|
||||
playerStatsManager.updateStatValue (statName, currentMoneyAmount);
|
||||
|
||||
if (showTotalMoneyAmountOnChange) {
|
||||
if (increaseMoneyTextSmoothly) {
|
||||
moneyToAdd += (int)extraValue;
|
||||
}
|
||||
|
||||
showTotalMoneyAmountPanel ();
|
||||
}
|
||||
}
|
||||
|
||||
public void initializeMoneyAmount (float newValue)
|
||||
{
|
||||
currentMoneyAmount = (int)newValue;
|
||||
|
||||
updateTotayMoneyAmountText (currentMoneyAmount.ToString ());
|
||||
}
|
||||
|
||||
public void updateMoneyAmountWithoutUpdatingStatManager (int statId, float amount)
|
||||
{
|
||||
currentMoneyAmount = (int)amount;
|
||||
|
||||
updateTotayMoneyAmountText (currentMoneyAmount.ToString ());
|
||||
}
|
||||
|
||||
public bool useMoney (float amountToUse)
|
||||
{
|
||||
if (currentMoneyAmount >= (int)amountToUse) {
|
||||
currentMoneyAmount -= (int)amountToUse;
|
||||
|
||||
playerStatsManager.updateStatValue (statName, currentMoneyAmount);
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public float getCurrentMoneyAmount ()
|
||||
{
|
||||
// print (currentMoneyAmount);
|
||||
|
||||
return (float)currentMoneyAmount;
|
||||
}
|
||||
|
||||
public bool canSpendMoneyAmount (float amountToSpend)
|
||||
{
|
||||
return currentMoneyAmount >= (int)amountToSpend;
|
||||
}
|
||||
|
||||
public void showTotalMoneyAmountPanel ()
|
||||
{
|
||||
stopShowTotalMoneyAmountPanelCoroutine ();
|
||||
|
||||
showTotalMoneyCoroutine = StartCoroutine (showTotalMoneyAmountPanelCoroutine ());
|
||||
}
|
||||
|
||||
public void stopShowTotalMoneyAmountPanelCoroutine ()
|
||||
{
|
||||
if (showTotalMoneyCoroutine != null) {
|
||||
StopCoroutine (showTotalMoneyCoroutine);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator showTotalMoneyAmountPanelCoroutine ()
|
||||
{
|
||||
if (totalMoneyAmountPanel.activeSelf == false) {
|
||||
totalMoneyAmountPanel.SetActive (true);
|
||||
}
|
||||
|
||||
if (!firstAmountAssigned) {
|
||||
updateTotayMoneyAmountText (previousMoneyAmount.ToString ());
|
||||
|
||||
firstAmountAssigned = true;
|
||||
}
|
||||
|
||||
if (increaseMoneyTextSmoothly) {
|
||||
|
||||
if (!previousMoneyToAddChecked) {
|
||||
yield return new WaitForSeconds (delayToStartIncreasMoneyText);
|
||||
|
||||
previousMoneyToAddChecked = true;
|
||||
}
|
||||
|
||||
int moneyIncreaseAmount = 1;
|
||||
|
||||
if (!lastAmountAddedIsPositive) {
|
||||
moneyToAdd = Mathf.Abs (moneyToAdd);
|
||||
}
|
||||
|
||||
if (moneyToAdd > 900) {
|
||||
int extraIncreaseAmount = moneyToAdd / 900;
|
||||
|
||||
if (customMoneyChangeSpeed != 0) {
|
||||
moneyIncreaseAmount += extraIncreaseAmount + (int)customMoneyChangeSpeed;
|
||||
} else {
|
||||
moneyIncreaseAmount += extraIncreaseAmount + 12;
|
||||
}
|
||||
}
|
||||
|
||||
while (moneyToAdd > 0) {
|
||||
if (lastAmountAddedIsPositive) {
|
||||
previousMoneyAmount += moneyIncreaseAmount;
|
||||
} else {
|
||||
previousMoneyAmount -= moneyIncreaseAmount;
|
||||
}
|
||||
|
||||
updateTotayMoneyAmountText (previousMoneyAmount.ToString ());
|
||||
|
||||
moneyToAdd -= moneyIncreaseAmount;
|
||||
|
||||
yield return new WaitForSeconds (increaseMoneyTextRate);
|
||||
}
|
||||
|
||||
updateTotayMoneyAmountText (currentMoneyAmount.ToString ());
|
||||
} else {
|
||||
updateTotayMoneyAmountText (currentMoneyAmount.ToString ());
|
||||
}
|
||||
|
||||
lastAmountAddedIsPositive = true;
|
||||
|
||||
customMoneyChangeSpeed = 0;
|
||||
|
||||
yield return new WaitForSeconds (timeToShowTotalMoneyAmount);
|
||||
|
||||
if (hideTotalAmountMoneyPAnelAfterDelay) {
|
||||
totalMoneyAmountPanel.SetActive (false);
|
||||
}
|
||||
}
|
||||
|
||||
void updateTotayMoneyAmountText (string newText)
|
||||
{
|
||||
totalMoneyAmountText.text = newText + " " + extraStringContent;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9c29b2fb4b5346246878ab536c748563
|
||||
timeCreated: 1564736041
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/currencySystem.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,137 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class generalItemOnInventory : objectOnInventory
|
||||
{
|
||||
[Header ("Custom Settings")]
|
||||
[Space]
|
||||
|
||||
public List<statInfo> statInfoList = new List<statInfo> ();
|
||||
|
||||
[Space]
|
||||
[Header ("Debug")]
|
||||
[Space]
|
||||
|
||||
public bool showDebugPrint;
|
||||
|
||||
public override void activateUseObjectActionOnInventoryWithExternalCharacter (GameObject currentPlayer, GameObject currentExternalCharacterForInventoryUsage, int amountToUse)
|
||||
{
|
||||
useObject (currentPlayer, currentExternalCharacterForInventoryUsage, amountToUse);
|
||||
}
|
||||
|
||||
public override void activateUseObjectActionOnInventory (GameObject currentPlayer, int amountToUse)
|
||||
{
|
||||
useObject (currentPlayer, currentPlayer, amountToUse);
|
||||
}
|
||||
|
||||
void useObject (GameObject characterInventoryOwner, GameObject characterToReceiveObjectEffect, int amountToUse)
|
||||
{
|
||||
playerComponentsManager currentPlayerComponetsManager = characterToReceiveObjectEffect.GetComponent<playerComponentsManager> ();
|
||||
|
||||
if (currentPlayerComponetsManager != null) {
|
||||
|
||||
playerStatsSystem currentPlayerStatsSystem = currentPlayerComponetsManager.getPlayerStatsSystem ();
|
||||
|
||||
remoteEventSystem currentRemoteEventSystem = currentPlayerComponetsManager.getRemoteEventSystem ();
|
||||
|
||||
inventoryManager currentInventoryManager = GKC_Utils.getInventoryManagerFromCharacter (characterInventoryOwner);
|
||||
|
||||
bool checkConditionsResult = checkConditions (characterToReceiveObjectEffect);
|
||||
|
||||
if (showDebugPrint) {
|
||||
print (checkConditionsResult);
|
||||
}
|
||||
|
||||
if (checkConditionsResult) {
|
||||
if (currentPlayerStatsSystem != null) {
|
||||
bool canUseStats = true;
|
||||
|
||||
if (useOnlyAmountNeeded) {
|
||||
for (int k = 0; k < statInfoList.Count; k++) {
|
||||
if (canUseStats && currentPlayerStatsSystem.isStatOnMaxAmount (statInfoList [k].Name)) {
|
||||
canUseStats = false;
|
||||
|
||||
amountToUse = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (canUseStats) {
|
||||
for (int k = 0; k < statInfoList.Count; k++) {
|
||||
currentPlayerStatsSystem.addOrRemovePlayerStatAmount (statInfoList [k].Name, statInfoList [k].amountToAdd);
|
||||
|
||||
if (statInfoList [k].useRemoteEvent) {
|
||||
if (currentRemoteEventSystem != null) {
|
||||
for (int i = 0; i < statInfoList [k].remoteEventList.Count; i++) {
|
||||
|
||||
currentRemoteEventSystem.callRemoteEvent (statInfoList [k].remoteEventList [i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (currentInventoryManager != null) {
|
||||
if (amountToUse > 0) {
|
||||
if (activateAbilityOnUseInventoryObject && checkIfAbilityIsNotActiveOrOnCoolDown) {
|
||||
if (checkIfAbilitiesOnUseOrCooldown (characterToReceiveObjectEffect)) {
|
||||
|
||||
amountToUse = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
currentInventoryManager.setUseObjectWithNewBehaviorResult (amountToUse);
|
||||
|
||||
if (amountToUse > 0) {
|
||||
if (closeInventoryOnObjectUsed) {
|
||||
if (currentInventoryManager.isInventoryMenuOpened ()) {
|
||||
currentInventoryManager.openOrCloseInventory (false);
|
||||
}
|
||||
}
|
||||
|
||||
checkExternalElementsOnUseInventoryObject (characterToReceiveObjectEffect);
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("Using Inventory Object " + mainInventoryObject.inventoryObjectInfo.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (currentInventoryManager != null) {
|
||||
if (useCustomMessageOnConditionFailed) {
|
||||
currentInventoryManager.setCustomMessageOnConditionFailedOnUseObjectWithNewBehavior (customMessageOnConditionFailed, true);
|
||||
}
|
||||
|
||||
currentInventoryManager.setUseObjectWithNewBehaviorResult (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool setObjectEquippedStateOnInventory (GameObject currentPlayer, bool state)
|
||||
{
|
||||
checkRemoteEvents (currentPlayer);
|
||||
|
||||
checkRemoteEventsOnSetObjectEquipState (currentPlayer, state);
|
||||
|
||||
checkIfEnableAbilitiesOnEquipInventoryObject (currentPlayer, state);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class statInfo
|
||||
{
|
||||
public string Name;
|
||||
public float amountToAdd;
|
||||
|
||||
[Space]
|
||||
|
||||
public bool useRemoteEvent;
|
||||
|
||||
public List<string> remoteEventList = new List<string> ();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ddc01c2792fc6c443bc6ef75d66a8794
|
||||
timeCreated: 1581134265
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/generalItemOnInventory.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,169 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class getInventoryObjectSystem : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public string inventoryObjectName;
|
||||
public int objectAmount;
|
||||
|
||||
public bool onlyRefillCertainAmountOfInventoryObjectAmount;
|
||||
|
||||
[Space]
|
||||
|
||||
public bool giveInventoryObjectList;
|
||||
public List<inventoryElementInfo> inventoryElementInfoList = new List<inventoryElementInfo> ();
|
||||
|
||||
[Space]
|
||||
[Header ("Other Settings")]
|
||||
[Space]
|
||||
|
||||
public bool spawnObjectIfNotEnoughSpaceOnInventory = true;
|
||||
|
||||
public float maxRadiusToInstantiate;
|
||||
public float forceAmount;
|
||||
public float forceRadius;
|
||||
public ForceMode inventoryObjectForceMode;
|
||||
|
||||
public bool spawnAllInventoryObjects;
|
||||
|
||||
public bool disableGetObjectAfterObtained;
|
||||
|
||||
[Space]
|
||||
[Header ("Debug")]
|
||||
[Space]
|
||||
|
||||
public bool objectObtained;
|
||||
|
||||
[Space]
|
||||
[Header ("Events Settings")]
|
||||
[Space]
|
||||
|
||||
public bool useEventIfObjectStored;
|
||||
public UnityEvent eventIfObjectStored;
|
||||
|
||||
[Space]
|
||||
[Header ("Player Manual Settings")]
|
||||
[Space]
|
||||
|
||||
public bool setPlayerManually;
|
||||
public bool sendAlwaysToMainPlayer;
|
||||
public bool searchPlayerByTagIfNotAssigned = true;
|
||||
public GameObject playerToConfigure;
|
||||
|
||||
[Space]
|
||||
[Header ("Components")]
|
||||
[Space]
|
||||
|
||||
public GameObject currentPlayer;
|
||||
|
||||
public Transform positionToPlaceInventoryObject;
|
||||
|
||||
|
||||
public void removeCurrentPlayer (GameObject player)
|
||||
{
|
||||
if (currentPlayer == player) {
|
||||
currentPlayer = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void getCurrentPlayer (GameObject player)
|
||||
{
|
||||
currentPlayer = player;
|
||||
}
|
||||
|
||||
public void giveObjectToPlayer ()
|
||||
{
|
||||
if (disableGetObjectAfterObtained) {
|
||||
if (objectObtained) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (setPlayerManually) {
|
||||
currentPlayer = playerToConfigure;
|
||||
}
|
||||
|
||||
if (sendAlwaysToMainPlayer) {
|
||||
currentPlayer = GKC_Utils.findMainPlayerOnScene ();
|
||||
}
|
||||
|
||||
if (currentPlayer == null) {
|
||||
bool playerNotFoundResult = true;
|
||||
|
||||
if (searchPlayerByTagIfNotAssigned) {
|
||||
|
||||
currentPlayer = GKC_Utils.findMainPlayerOnScene ();
|
||||
|
||||
if (currentPlayer != null) {
|
||||
playerNotFoundResult = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (playerNotFoundResult) {
|
||||
print ("WARNING: Make sure to configure a player or configure the events to send the player gameObject, so he can receive the object");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (inventoryObjectName.Equals ("")) {
|
||||
print ("WARNING: Make sure to configure an inventory object name in order to find its info on the inventory list manager");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (positionToPlaceInventoryObject == null) {
|
||||
positionToPlaceInventoryObject = transform;
|
||||
}
|
||||
|
||||
if (giveInventoryObjectList) {
|
||||
for (int i = 0; i < inventoryElementInfoList.Count; i++) {
|
||||
if (applyDamage.giveInventoryObjectToCharacter (currentPlayer,
|
||||
inventoryElementInfoList [i].Name,
|
||||
inventoryElementInfoList [i].inventoryObjectAmount,
|
||||
positionToPlaceInventoryObject, forceAmount, maxRadiusToInstantiate,
|
||||
inventoryObjectForceMode, forceRadius, spawnAllInventoryObjects,
|
||||
inventoryElementInfoList [i].onlyRefillCertainAmountOfInventoryObjectAmount,
|
||||
spawnObjectIfNotEnoughSpaceOnInventory)) {
|
||||
|
||||
if (inventoryElementInfoList [i].useEventIfObjectStored) {
|
||||
inventoryElementInfoList [i].eventIfObjectStored.Invoke ();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (applyDamage.giveInventoryObjectToCharacter (currentPlayer, inventoryObjectName,
|
||||
objectAmount, positionToPlaceInventoryObject,
|
||||
forceAmount, maxRadiusToInstantiate,
|
||||
inventoryObjectForceMode, forceRadius, spawnAllInventoryObjects,
|
||||
onlyRefillCertainAmountOfInventoryObjectAmount,
|
||||
spawnObjectIfNotEnoughSpaceOnInventory)) {
|
||||
|
||||
if (useEventIfObjectStored) {
|
||||
eventIfObjectStored.Invoke ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
objectObtained = true;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class inventoryElementInfo
|
||||
{
|
||||
public string Name;
|
||||
public int inventoryObjectAmount;
|
||||
|
||||
public bool onlyRefillCertainAmountOfInventoryObjectAmount;
|
||||
|
||||
[Space]
|
||||
|
||||
public bool useEventIfObjectStored;
|
||||
public UnityEvent eventIfObjectStored;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57ceeaadb9d9e0047b58b4aa4bff691d
|
||||
timeCreated: 1535094361
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/getInventoryObjectSystem.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,188 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class getObjectFromInventorySystem : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public string inventoryObjectName;
|
||||
|
||||
public bool useInfiniteObjects;
|
||||
|
||||
public bool checkInventoryManager = true;
|
||||
|
||||
[Space]
|
||||
[Header ("Debug")]
|
||||
[Space]
|
||||
|
||||
public bool showDebugPrint;
|
||||
|
||||
public int extraInventoryObjectAmount;
|
||||
|
||||
[Space]
|
||||
[Header ("Events Settings")]
|
||||
[Space]
|
||||
|
||||
public UnityEvent eventOnObjectFoundOnInventory;
|
||||
public UnityEvent eventOnObjectNotFoundOnInventory;
|
||||
|
||||
public UnityEvent eventOnAmountAvailable;
|
||||
public UnityEvent eventOnAmountNotAvailable;
|
||||
|
||||
public inventoryManager mainInventoryManager;
|
||||
|
||||
public void addExtraInventoryObjectAmount (int extraAmount)
|
||||
{
|
||||
extraInventoryObjectAmount += extraAmount;
|
||||
|
||||
if (extraInventoryObjectAmount < 0) {
|
||||
extraInventoryObjectAmount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void checkIfObjectFoundOnInventory ()
|
||||
{
|
||||
if (mainInventoryManager == null && checkInventoryManager) {
|
||||
return;
|
||||
}
|
||||
|
||||
int remainAmount = 0;
|
||||
|
||||
if (checkInventoryManager) {
|
||||
remainAmount = mainInventoryManager.getInventoryObjectAmountByName (inventoryObjectName);
|
||||
}
|
||||
|
||||
if (remainAmount < 0) {
|
||||
remainAmount = 0;
|
||||
}
|
||||
|
||||
if (useInfiniteObjects) {
|
||||
remainAmount = 1;
|
||||
}
|
||||
|
||||
remainAmount += extraInventoryObjectAmount;
|
||||
|
||||
if (remainAmount > 0) {
|
||||
eventOnObjectFoundOnInventory.Invoke ();
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("using event on object found");
|
||||
}
|
||||
} else {
|
||||
eventOnObjectNotFoundOnInventory.Invoke ();
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("using event on object not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void useInventoryObject (int amountToUse)
|
||||
{
|
||||
if (mainInventoryManager == null && checkInventoryManager) {
|
||||
return;
|
||||
}
|
||||
|
||||
int remainAmount = 0;
|
||||
|
||||
if (checkInventoryManager) {
|
||||
remainAmount = mainInventoryManager.getInventoryObjectAmountByName (inventoryObjectName);
|
||||
}
|
||||
|
||||
if (remainAmount < 0) {
|
||||
remainAmount = 0;
|
||||
}
|
||||
|
||||
if (useInfiniteObjects) {
|
||||
remainAmount = 1;
|
||||
}
|
||||
|
||||
remainAmount += extraInventoryObjectAmount;
|
||||
|
||||
if (remainAmount >= amountToUse) {
|
||||
if (checkInventoryManager) {
|
||||
if (extraInventoryObjectAmount == 0) {
|
||||
mainInventoryManager.removeObjectAmountFromInventoryByName (inventoryObjectName, amountToUse);
|
||||
}
|
||||
}
|
||||
|
||||
eventOnAmountAvailable.Invoke ();
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("using event on amount available");
|
||||
}
|
||||
} else {
|
||||
eventOnAmountNotAvailable.Invoke ();
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("using event on amount not available");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool useInventoryObjectAndGetResult (int amountToUse)
|
||||
{
|
||||
if (mainInventoryManager == null && checkInventoryManager) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int remainAmount = 0;
|
||||
|
||||
if (checkInventoryManager) {
|
||||
remainAmount = mainInventoryManager.getInventoryObjectAmountByName (inventoryObjectName);
|
||||
}
|
||||
|
||||
if (remainAmount < 0) {
|
||||
remainAmount = 0;
|
||||
}
|
||||
|
||||
if (useInfiniteObjects) {
|
||||
remainAmount = 1;
|
||||
}
|
||||
|
||||
remainAmount += extraInventoryObjectAmount;
|
||||
|
||||
if (remainAmount >= amountToUse) {
|
||||
if (checkInventoryManager) {
|
||||
if (extraInventoryObjectAmount == 0) {
|
||||
mainInventoryManager.removeObjectAmountFromInventoryByName (inventoryObjectName, amountToUse);
|
||||
}
|
||||
}
|
||||
|
||||
eventOnAmountAvailable.Invoke ();
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("using event on amount available");
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
eventOnAmountNotAvailable.Invoke ();
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("using event on amount not available");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setCurrentPlayer (GameObject newPlayer)
|
||||
{
|
||||
if (newPlayer != null) {
|
||||
playerComponentsManager currentPlayerComponentsManager = newPlayer.GetComponent<playerComponentsManager> ();
|
||||
|
||||
if (currentPlayerComponentsManager != null) {
|
||||
mainInventoryManager = currentPlayerComponentsManager.getInventoryManager ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setNewInventoryObjectName (string newName)
|
||||
{
|
||||
inventoryObjectName = newName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3441f3b0e466fc141bb4ce4b8291617e
|
||||
timeCreated: 1582058013
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/getObjectFromInventorySystem.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,197 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class inventoryBankManager : MonoBehaviour
|
||||
{
|
||||
public List<inventoryListElement> inventoryListManagerList = new List<inventoryListElement> ();
|
||||
public List<inventoryInfo> bankInventoryList = new List<inventoryInfo> ();
|
||||
|
||||
public string[] inventoryManagerListString;
|
||||
public List<inventoryManagerStringInfo> inventoryManagerStringInfoList = new List<inventoryManagerStringInfo> ();
|
||||
|
||||
public bool loadCurrentBankInventoryFromSaveFile;
|
||||
public bool saveCurrentBankInventoryToSaveFile;
|
||||
|
||||
public inventoryListManager mainInventoryManager;
|
||||
|
||||
public gameManager gameSystemManager;
|
||||
|
||||
public bool useMaxInventoryBankSlotsAmount;
|
||||
public int maxInventoryBankSlotsAmount;
|
||||
|
||||
public void setNewInventoryListManagerList (List<inventoryListElement> newList)
|
||||
{
|
||||
inventoryListManagerList = newList;
|
||||
}
|
||||
|
||||
void Start ()
|
||||
{
|
||||
setInventoryFromInventoryListManager ();
|
||||
}
|
||||
|
||||
public void setInventoryFromInventoryListManager ()
|
||||
{
|
||||
int inventoryListManagerListCount = inventoryListManagerList.Count;
|
||||
|
||||
List<inventoryCategoryInfo> inventoryCategoryInfoList = mainInventoryManager.inventoryCategoryInfoList;
|
||||
|
||||
for (int i = 0; i < inventoryListManagerListCount; i++) {
|
||||
inventoryListElement currentElement = inventoryListManagerList [i];
|
||||
|
||||
inventoryInfo currentInventoryInfo = inventoryCategoryInfoList [currentElement.categoryIndex].inventoryList [currentElement.elementIndex];
|
||||
|
||||
if (currentInventoryInfo != null) {
|
||||
inventoryInfo newInventoryInfo = new inventoryInfo (currentInventoryInfo);
|
||||
newInventoryInfo.Name = currentInventoryInfo.Name;
|
||||
newInventoryInfo.amount = currentElement.amount;
|
||||
|
||||
bankInventoryList.Add (newInventoryInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<inventoryInfo> getBankInventoryList ()
|
||||
{
|
||||
return bankInventoryList;
|
||||
}
|
||||
|
||||
public void addInventoryObjectByName (string objectName, int amountToAdd)
|
||||
{
|
||||
int inventoryListCount = bankInventoryList.Count;
|
||||
|
||||
for (int i = 0; i < inventoryListCount; i++) {
|
||||
inventoryInfo currentInventoryInfo = bankInventoryList [i];
|
||||
|
||||
if (currentInventoryInfo.Name.Equals (objectName)) {
|
||||
|
||||
currentInventoryInfo.amount += amountToAdd;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
inventoryInfo inventoryInfoToCheck = mainInventoryManager.getInventoryInfoFromName (objectName);
|
||||
|
||||
if (inventoryInfoToCheck != null) {
|
||||
inventoryInfo newObjectToAdd = new inventoryInfo (inventoryInfoToCheck);
|
||||
newObjectToAdd.amount = amountToAdd;
|
||||
|
||||
bankInventoryList.Add (newObjectToAdd);
|
||||
}
|
||||
}
|
||||
|
||||
public int getInventoryObjectAmountByName (string inventoryObjectName)
|
||||
{
|
||||
int totalAmount = 0;
|
||||
|
||||
int inventoryListCount = bankInventoryList.Count;
|
||||
|
||||
for (int i = 0; i < inventoryListCount; i++) {
|
||||
inventoryInfo currentInventoryInfo = bankInventoryList [i];
|
||||
|
||||
if (currentInventoryInfo.Name.Equals (inventoryObjectName)) {
|
||||
totalAmount += currentInventoryInfo.amount;
|
||||
}
|
||||
}
|
||||
|
||||
if (totalAmount > 0) {
|
||||
return totalAmount;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void removeObjectAmountFromInventory (string objectName, int amountToRemove)
|
||||
{
|
||||
int inventoryListCount = bankInventoryList.Count;
|
||||
|
||||
for (int i = 0; i < inventoryListCount; i++) {
|
||||
if (bankInventoryList [i].Name.Equals (objectName)) {
|
||||
bankInventoryList [i].amount -= amountToRemove;
|
||||
|
||||
if (bankInventoryList [i].amount <= 0) {
|
||||
bankInventoryList.RemoveAt (i);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//EDITOR FUNCTIONS
|
||||
public void getInventoryListManagerList ()
|
||||
{
|
||||
inventoryManagerListString = new string[mainInventoryManager.inventoryCategoryInfoList.Count];
|
||||
|
||||
for (int i = 0; i < inventoryManagerListString.Length; i++) {
|
||||
inventoryManagerListString [i] = mainInventoryManager.inventoryCategoryInfoList [i].Name;
|
||||
}
|
||||
|
||||
inventoryManagerStringInfoList.Clear ();
|
||||
|
||||
for (int i = 0; i < mainInventoryManager.inventoryCategoryInfoList.Count; i++) {
|
||||
|
||||
inventoryManagerStringInfo newInventoryManagerStringInfoo = new inventoryManagerStringInfo ();
|
||||
newInventoryManagerStringInfoo.Name = mainInventoryManager.inventoryCategoryInfoList [i].Name;
|
||||
|
||||
newInventoryManagerStringInfoo.inventoryManagerListString = new string[mainInventoryManager.inventoryCategoryInfoList [i].inventoryList.Count];
|
||||
|
||||
for (int j = 0; j < mainInventoryManager.inventoryCategoryInfoList [i].inventoryList.Count; j++) {
|
||||
string newName = mainInventoryManager.inventoryCategoryInfoList [i].inventoryList [j].Name;
|
||||
newInventoryManagerStringInfoo.inventoryManagerListString [j] = newName;
|
||||
}
|
||||
|
||||
inventoryManagerStringInfoList.Add (newInventoryManagerStringInfoo);
|
||||
}
|
||||
|
||||
updateComponent ();
|
||||
}
|
||||
|
||||
public void setInventoryObjectListNames ()
|
||||
{
|
||||
for (int i = 0; i < inventoryListManagerList.Count; i++) {
|
||||
inventoryListManagerList [i].Name = inventoryListManagerList [i].inventoryObjectName;
|
||||
}
|
||||
|
||||
updateComponent ();
|
||||
}
|
||||
|
||||
public void addNewInventoryObjectToInventoryListManagerList ()
|
||||
{
|
||||
inventoryListElement newInventoryListElement = new inventoryListElement ();
|
||||
newInventoryListElement.Name = "New Object";
|
||||
inventoryListManagerList.Add (newInventoryListElement);
|
||||
|
||||
updateComponent ();
|
||||
}
|
||||
|
||||
public void saveCurrentInventoryListToFile ()
|
||||
{
|
||||
if (gameSystemManager == null) {
|
||||
gameSystemManager = FindObjectOfType<gameManager> ();
|
||||
}
|
||||
|
||||
if (gameSystemManager != null) {
|
||||
gameSystemManager.saveGameInfoFromEditor ("Inventory Bank");
|
||||
|
||||
print ("Inventory Bank List saved");
|
||||
|
||||
updateComponent ();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateComponent ()
|
||||
{
|
||||
GKC_Utils.updateComponent (this);
|
||||
|
||||
GKC_Utils.updateDirtyScene ("Updating main inventory bank manager ", gameObject);
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class inventoryManagerStringInfo
|
||||
{
|
||||
public string Name;
|
||||
public string[] inventoryManagerListString;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d0d231ee36e89d47b4948d531a2ac71
|
||||
timeCreated: 1523328683
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventoryBankManager.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,619 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
using System.IO;
|
||||
using System;
|
||||
using GameKitController.Audio;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class inventoryBankSystem : MonoBehaviour
|
||||
{
|
||||
public bool usingInventoryBank;
|
||||
|
||||
public float openBankDelay;
|
||||
|
||||
public string animationName;
|
||||
public AudioClip openSound;
|
||||
public AudioElement openAudioElement;
|
||||
public AudioClip closeSound;
|
||||
public AudioElement closeAudioElement;
|
||||
|
||||
public List<inventoryListElement> inventoryListManagerList = new List<inventoryListElement> ();
|
||||
public List<inventoryInfo> bankInventoryList = new List<inventoryInfo> ();
|
||||
|
||||
public string[] inventoryManagerListString;
|
||||
public List<inventoryManagerStringInfo> inventoryManagerStringInfoList = new List<inventoryManagerStringInfo> ();
|
||||
|
||||
public bool useInventoryFromThisBank;
|
||||
|
||||
public bool useAsVendorSystem;
|
||||
|
||||
public bool useGeneralBuyPriceMultiplier;
|
||||
public float generalBuyPriceMultiplayerPercentage;
|
||||
|
||||
public bool useGeneralSellPriceMultiplier;
|
||||
public float generalSellPriceMultiplayerPercentage;
|
||||
|
||||
public bool infiniteVendorAmountAvailable;
|
||||
|
||||
public bool attachToTransformActive;
|
||||
public Transform transformToAttach;
|
||||
public Vector3 localOffset;
|
||||
|
||||
public Transform positionToSpawnObjects;
|
||||
|
||||
public bool useEventOnInventoryEmpty;
|
||||
public UnityEvent eventOnInventoryEmpty;
|
||||
public bool repeatEventOnInventoryEmpty;
|
||||
bool eventOnInventoryEmptyActivated;
|
||||
|
||||
public Animation mainAnimation;
|
||||
public AudioSource mainAudioSource;
|
||||
|
||||
public inventoryListManager mainInventoryListManager;
|
||||
|
||||
public inventoryBankManager mainInventoryBankManager;
|
||||
|
||||
public spawnObject mainSpawnObject;
|
||||
|
||||
public bool useMaxInventoryBankSlotsAmount;
|
||||
public int maxInventoryBankSlotsAmount;
|
||||
|
||||
public playerController playerControllerManager;
|
||||
|
||||
public string mainInventoryManagerName = "Main Inventory Manager";
|
||||
|
||||
bool mainInventoryManagerLocated;
|
||||
|
||||
GameObject currentPlayer;
|
||||
|
||||
inventoryManager currentPlayerInventoryManager;
|
||||
|
||||
vendorUISystem currentPlayerVendorUISystem;
|
||||
|
||||
Coroutine openCoroutine;
|
||||
bool firstAnimationPlay = true;
|
||||
|
||||
usingDevicesSystem usingDevicesManager;
|
||||
|
||||
playerComponentsManager mainPlayerComponentsManager;
|
||||
|
||||
private void InitializeAudioElements ()
|
||||
{
|
||||
if (mainAudioSource == null) {
|
||||
mainAudioSource = GetComponent<AudioSource> ();
|
||||
}
|
||||
|
||||
if (mainAudioSource != null) {
|
||||
openAudioElement.audioSource = mainAudioSource;
|
||||
closeAudioElement.audioSource = mainAudioSource;
|
||||
}
|
||||
|
||||
if (openSound != null) {
|
||||
openAudioElement.clip = openSound;
|
||||
}
|
||||
|
||||
if (closeSound != null) {
|
||||
closeAudioElement.clip = closeSound;
|
||||
}
|
||||
}
|
||||
|
||||
void Start ()
|
||||
{
|
||||
if (mainAnimation == null) {
|
||||
mainAnimation = GetComponent<Animation> ();
|
||||
}
|
||||
|
||||
InitializeAudioElements ();
|
||||
|
||||
checkGetMainInventoryManager ();
|
||||
|
||||
setInventoryFromInventoryListManager ();
|
||||
|
||||
if (attachToTransformActive && transformToAttach != null) {
|
||||
transform.SetParent (transformToAttach);
|
||||
transform.localPosition = Vector3.zero + localOffset;
|
||||
}
|
||||
}
|
||||
|
||||
public void spawnRandomObjectFromInventoryBank ()
|
||||
{
|
||||
if (mainSpawnObject != null) {
|
||||
GameObject randomInventoryObject = null;
|
||||
|
||||
if (useInventoryFromThisBank) {
|
||||
int bankInventoryListCount = bankInventoryList.Count;
|
||||
|
||||
if (bankInventoryListCount > 0) {
|
||||
int randomIndex = UnityEngine.Random.Range (0, bankInventoryListCount);
|
||||
|
||||
inventoryInfo currentInventoryInfo = bankInventoryList [randomIndex];
|
||||
|
||||
randomInventoryObject = currentInventoryInfo.inventoryObjectPrefab;
|
||||
|
||||
removeObjectAmountFromInventory (currentInventoryInfo.Name, 1);
|
||||
}
|
||||
} else {
|
||||
checkGetMainInventoryBankManager ();
|
||||
|
||||
if (mainInventoryBankManager != null) {
|
||||
List<inventoryInfo> temporalBankInventoryList = mainInventoryBankManager.getBankInventoryList ();
|
||||
|
||||
int bankInventoryListCount = temporalBankInventoryList.Count;
|
||||
|
||||
if (bankInventoryListCount > 0) {
|
||||
int randomIndex = UnityEngine.Random.Range (0, bankInventoryListCount);
|
||||
|
||||
inventoryInfo currentInventoryInfo = temporalBankInventoryList [randomIndex];
|
||||
|
||||
randomInventoryObject = currentInventoryInfo.inventoryObjectPrefab;
|
||||
|
||||
removeObjectAmountFromInventory (currentInventoryInfo.Name, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (randomInventoryObject != null) {
|
||||
mainSpawnObject.createObject (randomInventoryObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setUsingInventoryBankState (bool state)
|
||||
{
|
||||
usingInventoryBank = state;
|
||||
|
||||
if (!usingInventoryBank) {
|
||||
checkEventOnInventoryEmpty ();
|
||||
}
|
||||
}
|
||||
|
||||
public void activateInventoryBank ()
|
||||
{
|
||||
if (openCoroutine != null) {
|
||||
StopCoroutine (openCoroutine);
|
||||
}
|
||||
|
||||
openCoroutine = StartCoroutine (openOrCloseInventoryBank ());
|
||||
}
|
||||
|
||||
IEnumerator openOrCloseInventoryBank ()
|
||||
{
|
||||
usingInventoryBank = !usingInventoryBank;
|
||||
|
||||
playAnimation (usingInventoryBank);
|
||||
|
||||
playSound (usingInventoryBank);
|
||||
|
||||
playerControllerManager.setUsingDeviceState (usingInventoryBank);
|
||||
|
||||
if (usingInventoryBank) {
|
||||
yield return new WaitForSeconds (openBankDelay);
|
||||
}
|
||||
|
||||
if (useAsVendorSystem) {
|
||||
bool cancelOpenVendorMenu = false;
|
||||
|
||||
if (usingInventoryBank) {
|
||||
currentPlayerInventoryManager.setCurrentVendorObject (gameObject);
|
||||
|
||||
currentPlayerInventoryManager.setCurrentVendorSystem (gameObject);
|
||||
|
||||
if (usingDevicesManager != null) {
|
||||
if (!usingDevicesManager.existInDeviceList (gameObject)) {
|
||||
activateInventoryBank ();
|
||||
cancelOpenVendorMenu = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!cancelOpenVendorMenu) {
|
||||
currentPlayerVendorUISystem.openOrCloseVendorMenu (usingInventoryBank);
|
||||
}
|
||||
} else {
|
||||
bool cancelOpenInventoryBank = false;
|
||||
|
||||
if (usingInventoryBank) {
|
||||
currentPlayerInventoryManager.setCurrentInventoryBankObject (gameObject);
|
||||
|
||||
currentPlayerInventoryManager.setCurrentInventoryBankSystem (gameObject);
|
||||
|
||||
if (usingDevicesManager != null) {
|
||||
if (!usingDevicesManager.existInDeviceList (gameObject)) {
|
||||
activateInventoryBank ();
|
||||
cancelOpenInventoryBank = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!cancelOpenInventoryBank) {
|
||||
currentPlayerInventoryManager.openOrCloseInventoryBankMenu (usingInventoryBank);
|
||||
}
|
||||
}
|
||||
|
||||
if (!usingInventoryBank) {
|
||||
checkEventOnInventoryEmpty ();
|
||||
}
|
||||
}
|
||||
|
||||
public void checkEventOnInventoryEmpty ()
|
||||
{
|
||||
if (useEventOnInventoryEmpty) {
|
||||
if (!eventOnInventoryEmptyActivated || repeatEventOnInventoryEmpty) {
|
||||
if (bankInventoryList.Count == 0) {
|
||||
eventOnInventoryEmpty.Invoke ();
|
||||
|
||||
eventOnInventoryEmptyActivated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void playAnimation (bool playForward)
|
||||
{
|
||||
if (mainAnimation != null) {
|
||||
if (playForward) {
|
||||
if (!mainAnimation.IsPlaying (animationName)) {
|
||||
mainAnimation [animationName].normalizedTime = 0;
|
||||
}
|
||||
|
||||
mainAnimation [animationName].speed = 1;
|
||||
} else {
|
||||
if (!mainAnimation.IsPlaying (animationName)) {
|
||||
mainAnimation [animationName].normalizedTime = 1;
|
||||
}
|
||||
|
||||
mainAnimation [animationName].speed = -1;
|
||||
}
|
||||
|
||||
if (firstAnimationPlay) {
|
||||
mainAnimation.Play (animationName);
|
||||
firstAnimationPlay = false;
|
||||
} else {
|
||||
mainAnimation.CrossFade (animationName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void playSound (bool state)
|
||||
{
|
||||
if (mainAudioSource != null) {
|
||||
GKC_Utils.checkAudioSourcePitch (mainAudioSource);
|
||||
}
|
||||
|
||||
if (state) {
|
||||
AudioPlayer.PlayOneShot (openAudioElement, gameObject);
|
||||
} else {
|
||||
AudioPlayer.PlayOneShot (closeAudioElement, gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public void setCurrentPlayer (GameObject player)
|
||||
{
|
||||
currentPlayer = player;
|
||||
|
||||
if (currentPlayer != null) {
|
||||
|
||||
mainPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
|
||||
|
||||
currentPlayerInventoryManager = mainPlayerComponentsManager.getInventoryManager ();
|
||||
|
||||
playerControllerManager = mainPlayerComponentsManager.getPlayerController ();
|
||||
|
||||
usingDevicesManager = mainPlayerComponentsManager.getUsingDevicesSystem ();
|
||||
|
||||
currentPlayerVendorUISystem = mainPlayerComponentsManager.getVendorUISystem ();
|
||||
}
|
||||
}
|
||||
|
||||
public void setInventoryFromInventoryListManager ()
|
||||
{
|
||||
if (mainInventoryListManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int inventoryListManagerListCount = inventoryListManagerList.Count;
|
||||
|
||||
List<inventoryCategoryInfo> inventoryCategoryInfoList = mainInventoryListManager.inventoryCategoryInfoList;
|
||||
|
||||
int inventoryCategoryInfoListCount = inventoryCategoryInfoList.Count;
|
||||
|
||||
for (int i = 0; i < inventoryListManagerListCount; i++) {
|
||||
|
||||
inventoryListElement currentElement = inventoryListManagerList [i];
|
||||
|
||||
if (currentElement.addObjectToList) {
|
||||
|
||||
bool inventoryInfoLocated = false;
|
||||
|
||||
if (inventoryCategoryInfoListCount > currentElement.categoryIndex) {
|
||||
|
||||
inventoryCategoryInfo currentCategoryInfo = inventoryCategoryInfoList [currentElement.categoryIndex];
|
||||
|
||||
if (currentCategoryInfo.inventoryList.Count > currentElement.elementIndex) {
|
||||
|
||||
inventoryInfo currentInventoryInfo = currentCategoryInfo.inventoryList [currentElement.elementIndex];
|
||||
|
||||
if (currentInventoryInfo != null) {
|
||||
inventoryInfo newInventoryInfo = new inventoryInfo (currentInventoryInfo);
|
||||
newInventoryInfo.Name = currentInventoryInfo.Name;
|
||||
newInventoryInfo.amount = currentElement.amount;
|
||||
|
||||
if (useAsVendorSystem) {
|
||||
float buyPrice = currentElement.vendorPrice;
|
||||
|
||||
if (useGeneralBuyPriceMultiplier) {
|
||||
buyPrice = currentInventoryInfo.vendorPrice * generalBuyPriceMultiplayerPercentage;
|
||||
}
|
||||
newInventoryInfo.vendorPrice = buyPrice;
|
||||
|
||||
float sellPrice = currentElement.sellPrice;
|
||||
|
||||
if (useGeneralBuyPriceMultiplier) {
|
||||
sellPrice = currentInventoryInfo.sellPrice * generalSellPriceMultiplayerPercentage;
|
||||
}
|
||||
newInventoryInfo.sellPrice = sellPrice;
|
||||
|
||||
newInventoryInfo.infiniteVendorAmountAvailable = infiniteVendorAmountAvailable || currentElement.infiniteAmount;
|
||||
|
||||
if (currentElement.useMinLevelToBuy) {
|
||||
newInventoryInfo.useMinLevelToBuy = true;
|
||||
newInventoryInfo.minLevelToBuy = currentElement.minLevelToBuy;
|
||||
}
|
||||
|
||||
newInventoryInfo.spawnObject = currentElement.spawnObject;
|
||||
}
|
||||
|
||||
bankInventoryList.Add (newInventoryInfo);
|
||||
}
|
||||
|
||||
inventoryInfoLocated = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!inventoryInfoLocated) {
|
||||
print ("WARNING: The inventory bank system configured on the object " + gameObject.name + " hasn't the proper inventory objects to pick by the player properly configured. " +
|
||||
"Make sure the inventory list on this component has the correct fields ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void checkGetMainInventoryManager ()
|
||||
{
|
||||
if (!mainInventoryManagerLocated) {
|
||||
mainInventoryManagerLocated = mainInventoryListManager != null;
|
||||
|
||||
if (!mainInventoryManagerLocated) {
|
||||
mainInventoryListManager = inventoryListManager.Instance;
|
||||
|
||||
mainInventoryManagerLocated = mainInventoryListManager != null;
|
||||
}
|
||||
|
||||
if (!mainInventoryManagerLocated) {
|
||||
GKC_Utils.instantiateMainManagerOnSceneWithTypeOnApplicationPlaying (inventoryListManager.getMainManagerName (), typeof(inventoryListManager), true);
|
||||
|
||||
mainInventoryListManager = inventoryListManager.Instance;
|
||||
|
||||
mainInventoryManagerLocated = (mainInventoryListManager != null);
|
||||
}
|
||||
|
||||
if (!mainInventoryManagerLocated) {
|
||||
mainInventoryListManager = FindObjectOfType<inventoryListManager> ();
|
||||
|
||||
mainInventoryManagerLocated = mainInventoryListManager != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void getInventoryListManagerList ()
|
||||
{
|
||||
checkGetMainInventoryManager ();
|
||||
|
||||
if (mainInventoryListManager != null) {
|
||||
inventoryManagerListString = new string[mainInventoryListManager.inventoryCategoryInfoList.Count];
|
||||
|
||||
for (int i = 0; i < inventoryManagerListString.Length; i++) {
|
||||
inventoryManagerListString [i] = mainInventoryListManager.inventoryCategoryInfoList [i].Name;
|
||||
}
|
||||
|
||||
inventoryManagerStringInfoList.Clear ();
|
||||
|
||||
for (int i = 0; i < mainInventoryListManager.inventoryCategoryInfoList.Count; i++) {
|
||||
|
||||
inventoryManagerStringInfo newInventoryManagerStringInfoo = new inventoryManagerStringInfo ();
|
||||
newInventoryManagerStringInfoo.Name = mainInventoryListManager.inventoryCategoryInfoList [i].Name;
|
||||
|
||||
newInventoryManagerStringInfoo.inventoryManagerListString = new string[mainInventoryListManager.inventoryCategoryInfoList [i].inventoryList.Count];
|
||||
|
||||
for (int j = 0; j < mainInventoryListManager.inventoryCategoryInfoList [i].inventoryList.Count; j++) {
|
||||
string newName = mainInventoryListManager.inventoryCategoryInfoList [i].inventoryList [j].Name;
|
||||
newInventoryManagerStringInfoo.inventoryManagerListString [j] = newName;
|
||||
}
|
||||
|
||||
inventoryManagerStringInfoList.Add (newInventoryManagerStringInfoo);
|
||||
}
|
||||
|
||||
updateComponent ();
|
||||
}
|
||||
}
|
||||
|
||||
public void setInventoryObjectListNames ()
|
||||
{
|
||||
for (int i = 0; i < inventoryListManagerList.Count; i++) {
|
||||
inventoryListManagerList [i].Name = inventoryListManagerList [i].inventoryObjectName;
|
||||
}
|
||||
|
||||
updateComponent ();
|
||||
}
|
||||
|
||||
public void addNewInventoryObjectToInventoryListManagerList ()
|
||||
{
|
||||
inventoryListElement newInventoryListElement = new inventoryListElement ();
|
||||
|
||||
newInventoryListElement.Name = "New Object";
|
||||
|
||||
inventoryListManagerList.Add (newInventoryListElement);
|
||||
|
||||
updateComponent ();
|
||||
}
|
||||
|
||||
public Transform getPositionToSpawnObjects ()
|
||||
{
|
||||
return positionToSpawnObjects;
|
||||
}
|
||||
|
||||
public List<inventoryInfo> getBankInventoryList ()
|
||||
{
|
||||
return bankInventoryList;
|
||||
}
|
||||
|
||||
public List<inventoryInfo> getBankInventoryListFromFullBank ()
|
||||
{
|
||||
if (useInventoryFromThisBank) {
|
||||
return bankInventoryList;
|
||||
} else {
|
||||
checkGetMainInventoryBankManager ();
|
||||
|
||||
if (mainInventoryBankManager != null) {
|
||||
return mainInventoryBankManager.getBankInventoryList ();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addInventoryObjectByName (string objectName, int amountToAdd)
|
||||
{
|
||||
if (useInventoryFromThisBank) {
|
||||
int inventoryListCount = bankInventoryList.Count;
|
||||
|
||||
for (int i = 0; i < inventoryListCount; i++) {
|
||||
inventoryInfo currentInventoryInfo = bankInventoryList [i];
|
||||
|
||||
if (currentInventoryInfo.Name.Equals (objectName)) {
|
||||
|
||||
currentInventoryInfo.amount += amountToAdd;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
inventoryInfo inventoryInfoToCheck = mainInventoryListManager.getInventoryInfoFromName (objectName);
|
||||
|
||||
if (inventoryInfoToCheck != null) {
|
||||
inventoryInfo newObjectToAdd = new inventoryInfo (inventoryInfoToCheck);
|
||||
newObjectToAdd.amount = amountToAdd;
|
||||
|
||||
bankInventoryList.Add (newObjectToAdd);
|
||||
}
|
||||
} else {
|
||||
checkGetMainInventoryBankManager ();
|
||||
|
||||
if (mainInventoryBankManager != null) {
|
||||
mainInventoryBankManager.addInventoryObjectByName (objectName, amountToAdd);
|
||||
} else {
|
||||
print ("WARNING: No Inventory Bank Manager found in the scene, make sure to add the Main Inventory Manager prefab to the scene");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getInventoryObjectAmountByName (string inventoryObjectName)
|
||||
{
|
||||
int totalAmount = 0;
|
||||
|
||||
if (useInventoryFromThisBank) {
|
||||
int inventoryListCount = bankInventoryList.Count;
|
||||
|
||||
for (int i = 0; i < inventoryListCount; i++) {
|
||||
inventoryInfo currentInventoryInfo = bankInventoryList [i];
|
||||
|
||||
if (currentInventoryInfo.Name.Equals (inventoryObjectName)) {
|
||||
totalAmount += currentInventoryInfo.amount;
|
||||
}
|
||||
}
|
||||
|
||||
if (totalAmount > 0) {
|
||||
return totalAmount;
|
||||
}
|
||||
} else {
|
||||
checkGetMainInventoryBankManager ();
|
||||
|
||||
if (mainInventoryBankManager != null) {
|
||||
return mainInventoryBankManager.getInventoryObjectAmountByName (inventoryObjectName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void removeObjectAmountFromInventory (string objectName, int amountToRemove)
|
||||
{
|
||||
if (useInventoryFromThisBank) {
|
||||
int inventoryListCount = bankInventoryList.Count;
|
||||
|
||||
for (int i = 0; i < inventoryListCount; i++) {
|
||||
if (bankInventoryList [i].Name.Equals (objectName)) {
|
||||
bankInventoryList [i].amount -= amountToRemove;
|
||||
|
||||
if (bankInventoryList [i].amount <= 0) {
|
||||
bankInventoryList.RemoveAt (i);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
checkGetMainInventoryBankManager ();
|
||||
|
||||
if (mainInventoryBankManager != null) {
|
||||
mainInventoryBankManager.removeObjectAmountFromInventory (objectName, amountToRemove);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void checkGetMainInventoryBankManager ()
|
||||
{
|
||||
if (mainInventoryBankManager == null) {
|
||||
mainInventoryListManager = inventoryListManager.Instance;
|
||||
|
||||
bool mainInventoryManagerLocated = mainInventoryListManager != null;
|
||||
|
||||
if (!mainInventoryManagerLocated) {
|
||||
GKC_Utils.instantiateMainManagerOnSceneWithTypeOnApplicationPlaying (inventoryListManager.getMainManagerName (), typeof(inventoryListManager), true);
|
||||
|
||||
mainInventoryListManager = inventoryListManager.Instance;
|
||||
|
||||
mainInventoryManagerLocated = (mainInventoryListManager != null);
|
||||
}
|
||||
|
||||
if (!mainInventoryManagerLocated) {
|
||||
mainInventoryListManager = FindObjectOfType<inventoryListManager> ();
|
||||
|
||||
mainInventoryManagerLocated = mainInventoryListManager != null;
|
||||
}
|
||||
|
||||
if (mainInventoryManagerLocated) {
|
||||
mainInventoryBankManager = mainInventoryListManager.getMainInventoryBankManager ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateComponent ()
|
||||
{
|
||||
GKC_Utils.updateComponent (this);
|
||||
|
||||
GKC_Utils.updateDirtyScene ("Update Inventory Bank Info", gameObject);
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class inventoryManagerStringInfo
|
||||
{
|
||||
public string Name;
|
||||
public string[] inventoryManagerListString;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cee23d237b2f8d247a437b997734b5d3
|
||||
timeCreated: 1523326562
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventoryBankSystem.cs
|
||||
uploadId: 814740
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3040ebef4b5206f46a83338b9235797e
|
||||
timeCreated: 1576349359
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventoryBankUISystem.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,353 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
|
||||
using UnityEditor.SceneManagement;
|
||||
|
||||
public class inventoryCaptureManager : EditorWindow
|
||||
{
|
||||
public Vector2 captureResolution = new Vector2 (512, 512);
|
||||
public Vector3 rotationOffset;
|
||||
public Vector3 positionOffset;
|
||||
public string fileName = "New Capture";
|
||||
|
||||
public string inventoryLayerName = "inventory";
|
||||
|
||||
public string mainInventoryManagerName = "Main Inventory Manager";
|
||||
|
||||
bool checkCapturePath;
|
||||
string currentSaveDataPath;
|
||||
|
||||
public inventoryListManager mainInventoryListManager;
|
||||
|
||||
Camera inventoryCamera;
|
||||
static inventoryCaptureManager window;
|
||||
inventoryInfo currentInventoryInfo;
|
||||
GameObject currentInventoryObjectMesh;
|
||||
|
||||
Rect positionRect;
|
||||
|
||||
Rect renderRect;
|
||||
Transform inventoryLookObjectTransform;
|
||||
RenderTexture originalRenderTexture;
|
||||
Texture2D captureFile;
|
||||
|
||||
GUISkin guiSkin;
|
||||
Rect windowRect = new Rect ();
|
||||
|
||||
GameObject inventoryCameraParentGameObject;
|
||||
|
||||
Color backGroundColor = Color.white;
|
||||
Color originalBackGroundColor;
|
||||
float cameraFov;
|
||||
float originalCameraFov;
|
||||
|
||||
bool objectMeshLayerAssignedProperly;
|
||||
|
||||
Vector2 rectSize = new Vector2 (550, 720);
|
||||
|
||||
GUIStyle style = new GUIStyle ();
|
||||
|
||||
Vector2 screenResolution;
|
||||
|
||||
float windowHeightPercentage = 0.65f;
|
||||
|
||||
float maxLayoutWidht = 180;
|
||||
|
||||
Vector2 scrollPos1;
|
||||
|
||||
static void ShowWindow ()
|
||||
{
|
||||
window = (inventoryCaptureManager)EditorWindow.GetWindow (typeof(inventoryCaptureManager));
|
||||
window.init ();
|
||||
}
|
||||
|
||||
public void init ()
|
||||
{
|
||||
screenResolution = new Vector2 (Screen.currentResolution.width, Screen.currentResolution.height);
|
||||
|
||||
float windowHeight = screenResolution.y * windowHeightPercentage;
|
||||
|
||||
windowHeight = Mathf.Clamp (windowHeight, 500, 800);
|
||||
|
||||
rectSize = new Vector2 (550, windowHeight);
|
||||
|
||||
GKC_Utils.instantiateMainManagerOnSceneWithType (mainInventoryManagerName, typeof(inventoryListManager));
|
||||
|
||||
mainInventoryListManager = FindObjectOfType<inventoryListManager> ();
|
||||
|
||||
inventoryCamera = mainInventoryListManager.inventoryCamera;
|
||||
|
||||
inventoryCamera.enabled = true;
|
||||
|
||||
inventoryCameraParentGameObject = mainInventoryListManager.inventoryCameraParentGameObject;
|
||||
|
||||
if (inventoryCameraParentGameObject != null) {
|
||||
inventoryCameraParentGameObject.SetActive (true);
|
||||
}
|
||||
|
||||
inventoryLookObjectTransform = mainInventoryListManager.lookObjectsPosition;
|
||||
captureFile = null;
|
||||
checkCapturePath = false;
|
||||
|
||||
originalBackGroundColor = Color.white;
|
||||
originalCameraFov = inventoryCamera.fieldOfView;
|
||||
cameraFov = originalCameraFov;
|
||||
|
||||
mainInventoryListManager.setInventoryCaptureToolOpenState (true);
|
||||
}
|
||||
|
||||
public void OnDisable ()
|
||||
{
|
||||
if (currentInventoryObjectMesh != null) {
|
||||
destroyAuxObjects ();
|
||||
}
|
||||
|
||||
if (inventoryCamera != null) {
|
||||
inventoryCamera.backgroundColor = originalBackGroundColor;
|
||||
inventoryCamera.fieldOfView = originalCameraFov;
|
||||
|
||||
inventoryCamera.enabled = false;
|
||||
}
|
||||
|
||||
if (mainInventoryListManager != null) {
|
||||
mainInventoryListManager.setInventoryCaptureToolOpenState (false);
|
||||
}
|
||||
|
||||
if (inventoryCameraParentGameObject != null) {
|
||||
inventoryCameraParentGameObject.SetActive (false);
|
||||
}
|
||||
}
|
||||
|
||||
void OnGUI ()
|
||||
{
|
||||
if (window == null) {
|
||||
window = (inventoryCaptureManager)EditorWindow.GetWindow (typeof(inventoryCaptureManager));
|
||||
}
|
||||
|
||||
if (!guiSkin) {
|
||||
guiSkin = Resources.Load ("GUI") as GUISkin;
|
||||
}
|
||||
GUI.skin = guiSkin;
|
||||
|
||||
this.minSize = rectSize;
|
||||
|
||||
this.titleContent = new GUIContent ("Inventory Object Capture Tool", null, "You can create inventory objects prefabs with this tool");
|
||||
|
||||
GUILayout.BeginVertical ("Inventory Object Capture Tool", "window", GUILayout.Width (530));
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
EditorGUILayout.Space ();
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
GUILayout.BeginVertical ("box");
|
||||
|
||||
scrollPos1 = EditorGUILayout.BeginScrollView (scrollPos1, false, false);
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
GUILayout.BeginHorizontal ();
|
||||
GUILayout.Label ("Capture Resolution", EditorStyles.boldLabel, GUILayout.MaxWidth (maxLayoutWidht));
|
||||
captureResolution = EditorGUILayout.Vector2Field ("", captureResolution);
|
||||
GUILayout.EndHorizontal ();
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
GUILayout.BeginHorizontal ();
|
||||
GUILayout.Label ("File Name", EditorStyles.boldLabel, GUILayout.MaxWidth (maxLayoutWidht));
|
||||
fileName = EditorGUILayout.TextField (fileName, GUILayout.ExpandWidth (true));
|
||||
GUILayout.EndHorizontal ();
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
GUILayout.Label ("Rotation Offset", EditorStyles.boldLabel);
|
||||
rotationOffset.x = EditorGUILayout.Slider (rotationOffset.x, -360, 360);
|
||||
rotationOffset.y = EditorGUILayout.Slider (rotationOffset.y, -360, 360);
|
||||
rotationOffset.z = EditorGUILayout.Slider (rotationOffset.z, -360, 360);
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
GUILayout.Label ("Position Offset", EditorStyles.boldLabel);
|
||||
positionOffset.x = EditorGUILayout.Slider (positionOffset.x, -5, 5);
|
||||
positionOffset.y = EditorGUILayout.Slider (positionOffset.y, -5, 5);
|
||||
positionOffset.z = EditorGUILayout.Slider (positionOffset.z, -5, 5);
|
||||
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
GUILayout.BeginHorizontal ();
|
||||
backGroundColor = EditorGUILayout.ColorField ("Background Color", backGroundColor);
|
||||
inventoryCamera.backgroundColor = backGroundColor;
|
||||
|
||||
cameraFov = EditorGUILayout.FloatField ("Camera FOV", cameraFov);
|
||||
inventoryCamera.fieldOfView = cameraFov;
|
||||
GUILayout.EndHorizontal ();
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
GUILayout.BeginHorizontal ();
|
||||
if (GUILayout.Button ("Cancel")) {
|
||||
this.Close ();
|
||||
}
|
||||
|
||||
if (GUILayout.Button ("Reset View")) {
|
||||
rotationOffset = Vector3.zero;
|
||||
positionOffset = Vector3.zero;
|
||||
|
||||
cameraFov = originalCameraFov;
|
||||
backGroundColor = originalBackGroundColor;
|
||||
}
|
||||
|
||||
if (GUILayout.Button ("Get Capture")) {
|
||||
getCapture ();
|
||||
}
|
||||
GUILayout.EndHorizontal ();
|
||||
|
||||
EditorGUILayout.EndScrollView ();
|
||||
|
||||
positionRect = position;
|
||||
|
||||
windowRect = GUILayoutUtility.GetLastRect ();
|
||||
// windowRect.position = new Vector2 (0, windowRect.position.y);
|
||||
windowRect.width = this.maxSize.x;
|
||||
|
||||
GUILayout.FlexibleSpace ();
|
||||
|
||||
if (currentInventoryObjectMesh != null) {
|
||||
|
||||
if (currentInventoryObjectMesh != null) {
|
||||
currentInventoryObjectMesh.transform.localRotation = Quaternion.Euler (rotationOffset);
|
||||
currentInventoryObjectMesh.transform.localPosition = positionOffset;
|
||||
}
|
||||
|
||||
if (objectMeshLayerAssignedProperly) {
|
||||
if (inventoryCamera != null) {
|
||||
inventoryCamera.Render ();
|
||||
|
||||
renderRect = new Rect (positionRect.width / 4.5f, 370, positionRect.width / 1.9f, positionRect.width / 1.9f);
|
||||
|
||||
GUI.DrawTexture (renderRect, inventoryCamera.targetTexture);
|
||||
}
|
||||
} else {
|
||||
GUILayout.BeginHorizontal ();
|
||||
EditorGUILayout.HelpBox ("", MessageType.Info);
|
||||
|
||||
style = new GUIStyle (EditorStyles.helpBox);
|
||||
style.richText = true;
|
||||
|
||||
style.fontStyle = FontStyle.Bold;
|
||||
style.fontSize = 14;
|
||||
|
||||
EditorGUILayout.LabelField ("WARNING: Object not visible on the icon preview.\n\n" +
|
||||
"The layer of the current object mesh selected is not configured as " + inventoryLayerName + ".\n\n" +
|
||||
"Close this window and make sure to apply that layer to the object mesh and confirm to set it to its childs when unity asks about it.", style);
|
||||
GUILayout.EndHorizontal ();
|
||||
|
||||
if (GUILayout.Button ("Close Window")) {
|
||||
closeWindow ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.FlexibleSpace ();
|
||||
|
||||
GUILayout.EndVertical ();
|
||||
|
||||
GUILayout.EndVertical ();
|
||||
}
|
||||
|
||||
public void getCapture ()
|
||||
{
|
||||
if (currentInventoryObjectMesh == null) {
|
||||
Debug.Log ("Please, close this window, assign the Inventory Object Mesh and open this window again to take the capture");
|
||||
return;
|
||||
}
|
||||
|
||||
if (fileName.Equals ("")) {
|
||||
fileName = currentInventoryInfo.Name;
|
||||
}
|
||||
|
||||
originalRenderTexture = inventoryCamera.targetTexture;
|
||||
inventoryCamera.targetTexture = new RenderTexture ((int)captureResolution.x, (int)captureResolution.y, 24);
|
||||
RenderTexture rendText = RenderTexture.active;
|
||||
RenderTexture.active = inventoryCamera.targetTexture;
|
||||
|
||||
// render the texture
|
||||
inventoryCamera.Render ();
|
||||
|
||||
// create a new Texture2D with the camera's texture, using its height and width
|
||||
Texture2D cameraImage = new Texture2D ((int)captureResolution.x, (int)captureResolution.y, TextureFormat.RGB24, false);
|
||||
cameraImage.ReadPixels (new Rect (0, 0, (int)captureResolution.x, (int)captureResolution.y), 0, 0);
|
||||
|
||||
cameraImage.Apply ();
|
||||
|
||||
RenderTexture.active = rendText;
|
||||
|
||||
// store the texture into a .PNG file
|
||||
#if !UNITY_WEBPLAYER
|
||||
byte[] bytes = cameraImage.EncodeToPNG ();
|
||||
|
||||
// save the encoded image to a file
|
||||
System.IO.File.WriteAllBytes (currentSaveDataPath + (fileName + " (Inventory Capture).png"), bytes);
|
||||
inventoryCamera.targetTexture = originalRenderTexture;
|
||||
#endif
|
||||
|
||||
GKC_Utils.refreshAssetDatabase ();
|
||||
|
||||
checkCapturePath = true;
|
||||
|
||||
inventoryCamera.backgroundColor = originalBackGroundColor;
|
||||
inventoryCamera.fieldOfView = originalCameraFov;
|
||||
|
||||
inventoryCamera.enabled = false;
|
||||
}
|
||||
|
||||
void Update ()
|
||||
{
|
||||
if (checkCapturePath) {
|
||||
captureFile = (Texture2D)AssetDatabase.LoadAssetAtPath ((currentSaveDataPath + fileName + " (Inventory Capture).png"), typeof(Texture2D));
|
||||
|
||||
if (captureFile != null) {
|
||||
mainInventoryListManager.setInventoryCaptureIcon (currentInventoryInfo, captureFile);
|
||||
|
||||
checkCapturePath = false;
|
||||
|
||||
closeWindow ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void closeWindow ()
|
||||
{
|
||||
if (currentInventoryObjectMesh != null) {
|
||||
destroyAuxObjects ();
|
||||
}
|
||||
|
||||
window.Close ();
|
||||
}
|
||||
|
||||
public void destroyAuxObjects ()
|
||||
{
|
||||
DestroyImmediate (currentInventoryObjectMesh);
|
||||
}
|
||||
|
||||
public void setCurrentInventoryObjectInfo (inventoryInfo info, string savePath)
|
||||
{
|
||||
currentInventoryInfo = info;
|
||||
|
||||
if (currentInventoryInfo.inventoryGameObject != null) {
|
||||
currentInventoryObjectMesh = (GameObject)Instantiate (info.inventoryGameObject, inventoryLookObjectTransform.position, Quaternion.identity);
|
||||
currentInventoryObjectMesh.transform.SetParent (inventoryLookObjectTransform);
|
||||
currentSaveDataPath = savePath;
|
||||
|
||||
objectMeshLayerAssignedProperly = (LayerMask.NameToLayer (inventoryLayerName) == currentInventoryObjectMesh.layer);
|
||||
} else {
|
||||
Debug.Log ("Please, assign the Inventory Object Mesh to take the capture");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 71882570b66484945870f08e68ac4436
|
||||
timeCreated: 1485632802
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventoryCaptureManager.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,201 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.IO;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
|
||||
public class inventoryCaptureManagerTransparent : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public string fileName = "New Capture";
|
||||
public string relativePathCaptures = "";
|
||||
|
||||
public string extraName = "(Inventory Capture)";
|
||||
|
||||
public Transform objectToCaptureParent;
|
||||
public bool useObjectName;
|
||||
|
||||
[Space]
|
||||
[Header ("Others")]
|
||||
[Space]
|
||||
|
||||
[TextArea (10, 15)] public string explanation;
|
||||
|
||||
GameObject whiteCamGameObject;
|
||||
Camera whiteCam;
|
||||
GameObject blackCamGameObject;
|
||||
Camera blackCam;
|
||||
Camera mainCam;
|
||||
|
||||
int screenWidth;
|
||||
int screenHeight;
|
||||
|
||||
bool done = false;
|
||||
|
||||
Texture2D textureBlack;
|
||||
Texture2D textureWhite;
|
||||
Texture2D textureTransparentBackground;
|
||||
|
||||
[MenuItem ("Game Kit Controller/Go To Capture Inventory Transparent Icon Manager Scene", false, 23)]
|
||||
static void openInventoryCaptureManager ()
|
||||
{
|
||||
if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo ()) {
|
||||
|
||||
string ransparentInventoryCaptureToolScenePath = pathInfoValues.getTransparentInventoryCaptureToolScenePath ();
|
||||
|
||||
EditorSceneManager.OpenScene (ransparentInventoryCaptureToolScenePath);
|
||||
}
|
||||
}
|
||||
|
||||
public void takeCapture ()
|
||||
{
|
||||
UnityEditor.EditorApplication.isPlaying = true;
|
||||
}
|
||||
|
||||
void Awake ()
|
||||
{
|
||||
if (useObjectName && objectToCaptureParent) {
|
||||
foreach (Transform child in objectToCaptureParent) {
|
||||
if (child.gameObject.activeSelf) {
|
||||
print (child.name);
|
||||
fileName = child.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mainCam = gameObject.GetComponent<Camera> ();
|
||||
|
||||
CreateBlackAndWhiteCameras ();
|
||||
|
||||
CacheAndInitialiseFields ();
|
||||
}
|
||||
|
||||
void LateUpdate ()
|
||||
{
|
||||
if (!done) {
|
||||
StartCoroutine (CaptureFrame ());
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator CaptureFrame ()
|
||||
{
|
||||
yield return new WaitForEndOfFrame ();
|
||||
|
||||
RenderCamToTexture (blackCam, textureBlack);
|
||||
RenderCamToTexture (whiteCam, textureWhite);
|
||||
|
||||
CalculateOutputTexture ();
|
||||
|
||||
SavePng ();
|
||||
|
||||
done = true;
|
||||
|
||||
StopCoroutine ("CaptureFrame");
|
||||
|
||||
GKC_Utils.refreshAssetDatabase ();
|
||||
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
void RenderCamToTexture (Camera cam, Texture2D tex)
|
||||
{
|
||||
cam.enabled = true;
|
||||
|
||||
cam.Render ();
|
||||
|
||||
WriteScreenImageToTexture (tex);
|
||||
|
||||
cam.enabled = false;
|
||||
}
|
||||
|
||||
void CreateBlackAndWhiteCameras ()
|
||||
{
|
||||
whiteCamGameObject = (GameObject)new GameObject ();
|
||||
|
||||
whiteCamGameObject.name = "White Background Camera";
|
||||
|
||||
whiteCam = whiteCamGameObject.AddComponent<Camera> ();
|
||||
|
||||
whiteCam.CopyFrom (mainCam);
|
||||
|
||||
whiteCam.backgroundColor = Color.white;
|
||||
|
||||
whiteCamGameObject.transform.SetParent (gameObject.transform, true);
|
||||
|
||||
blackCamGameObject = (GameObject)new GameObject ();
|
||||
|
||||
blackCamGameObject.name = "Black Background Camera";
|
||||
|
||||
blackCam = blackCamGameObject.AddComponent<Camera> ();
|
||||
|
||||
blackCam.CopyFrom (mainCam);
|
||||
|
||||
blackCam.backgroundColor = Color.black;
|
||||
|
||||
blackCamGameObject.transform.SetParent (gameObject.transform, true);
|
||||
}
|
||||
|
||||
void WriteScreenImageToTexture (Texture2D tex)
|
||||
{
|
||||
tex.ReadPixels (new Rect (0, 0, screenWidth, screenHeight), 0, 0);
|
||||
|
||||
tex.Apply ();
|
||||
}
|
||||
|
||||
void CalculateOutputTexture ()
|
||||
{
|
||||
Color color;
|
||||
|
||||
for (int y = 0; y < textureTransparentBackground.height; ++y) {
|
||||
// each row
|
||||
for (int x = 0; x < textureTransparentBackground.width; ++x) {
|
||||
// each column
|
||||
float alpha = textureWhite.GetPixel (x, y).r - textureBlack.GetPixel (x, y).r;
|
||||
alpha = 1.0f - alpha;
|
||||
|
||||
if (alpha == 0) {
|
||||
color = Color.clear;
|
||||
} else {
|
||||
color = textureBlack.GetPixel (x, y) / alpha;
|
||||
}
|
||||
|
||||
color.a = alpha;
|
||||
|
||||
textureTransparentBackground.SetPixel (x, y, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SavePng ()
|
||||
{
|
||||
relativePathCaptures = pathInfoValues.getInventoryInfoCapturesPath ();
|
||||
|
||||
string name = string.Format ("{0}/{1:D04} ", relativePathCaptures, (fileName + " " + extraName + ".png"));
|
||||
|
||||
var pngShot = textureTransparentBackground.EncodeToPNG ();
|
||||
|
||||
if (Directory.Exists (relativePathCaptures)) {
|
||||
File.WriteAllBytes (name, pngShot);
|
||||
} else {
|
||||
print ("WARNING: The path configured for the capture doesn't exist, make sure the folder is created");
|
||||
}
|
||||
}
|
||||
|
||||
void CacheAndInitialiseFields ()
|
||||
{
|
||||
screenWidth = Screen.width;
|
||||
screenHeight = Screen.height;
|
||||
|
||||
textureBlack = new Texture2D (screenWidth, screenHeight, TextureFormat.RGB24, false);
|
||||
textureWhite = new Texture2D (screenWidth, screenHeight, TextureFormat.RGB24, false);
|
||||
textureTransparentBackground = new Texture2D (screenWidth, screenHeight, TextureFormat.ARGB32, false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cea6a8c8267d41f4986ea9a2564f342d
|
||||
timeCreated: 1527457968
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventoryCaptureManagerTransparent.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
[System.Serializable]
|
||||
public class inventoryCategoryInfo
|
||||
{
|
||||
public string Name;
|
||||
public Texture cateogryTexture;
|
||||
|
||||
public GameObject emptyInventoryPrefab;
|
||||
|
||||
public List<inventoryInfo> inventoryList = new List<inventoryInfo> ();
|
||||
|
||||
public inventoryCategoryInfo ()
|
||||
{
|
||||
Name = "New Category";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 717d794b83814bd42b801d5513d59dba
|
||||
timeCreated: 1564910483
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventoryCategoryInfo.cs
|
||||
uploadId: 814740
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7addd79951995db45a5d9d3d493fe277
|
||||
timeCreated: 1638469630
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventoryCharacterCustomizationSystem.cs
|
||||
uploadId: 814740
|
||||
466
Assets/Game Kit Controller/Scripts/Inventory/inventoryInfo.cs
Normal file
466
Assets/Game Kit Controller/Scripts/Inventory/inventoryInfo.cs
Normal file
@@ -0,0 +1,466 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections.Generic;
|
||||
using GameKitController.Audio;
|
||||
|
||||
[System.Serializable]
|
||||
public class inventoryInfo
|
||||
{
|
||||
//Main settings
|
||||
public string Name;
|
||||
public GameObject inventoryGameObject;
|
||||
[TextArea (3, 10)] public string objectInfo;
|
||||
public Texture icon;
|
||||
public int amount;
|
||||
public int amountPerUnit;
|
||||
public bool infiniteAmount;
|
||||
|
||||
public bool storeTotalAmountPerUnit;
|
||||
|
||||
public bool showAmountPerUnitInAmountText;
|
||||
|
||||
|
||||
//Special settings to use, equi, drop, combine, etc...
|
||||
|
||||
public bool canBeUsed;
|
||||
public bool canBeEquiped;
|
||||
public bool canBeDropped;
|
||||
public bool canBeCombined;
|
||||
|
||||
public bool canBeExamined = true;
|
||||
|
||||
public bool canBeDiscarded;
|
||||
|
||||
public bool hideSlotOnMenu;
|
||||
|
||||
|
||||
//Behavior elements
|
||||
|
||||
public bool useNewBehaviorOnUse;
|
||||
[TextArea (3, 10)] public string newBehaviorOnUseMessage;
|
||||
[TextArea (3, 10)] public string newBehaviorOnUnableToUseMessage;
|
||||
|
||||
public bool useNewBehaviorOnCombine;
|
||||
[TextArea (3, 10)] public string newBehaviorOnCombineMessage;
|
||||
|
||||
public bool useOneUnitOnNewBehaviourCombine = true;
|
||||
|
||||
public bool useSoundOnUseObject;
|
||||
public AudioClip soundOnUseObject;
|
||||
public AudioElement onUseObjectAudioElement;
|
||||
|
||||
|
||||
//States
|
||||
|
||||
public bool isEquipped;
|
||||
|
||||
public int quickAccessSlotIndex = -1;
|
||||
|
||||
|
||||
public bool useDurability;
|
||||
public float durabilityAmount = 100;
|
||||
|
||||
public float maxDurabilityAmount = 100;
|
||||
|
||||
public bool objectIsBroken;
|
||||
|
||||
public float sellMultiplierIfObjectIsBroken = 1;
|
||||
|
||||
|
||||
//Weapon settings
|
||||
|
||||
public bool isWeapon;
|
||||
public bool isMeleeWeapon;
|
||||
|
||||
public bool isMeleeShield;
|
||||
|
||||
public bool isArmorClothAccessory;
|
||||
|
||||
public int projectilesInMagazine = -1;
|
||||
|
||||
public weaponObjectInfo mainWeaponObjectInfo;
|
||||
|
||||
|
||||
//Combine object settings
|
||||
|
||||
public GameObject objectToCombine;
|
||||
public GameObject combinedObject;
|
||||
[TextArea (3, 10)] public string combinedObjectMessage;
|
||||
|
||||
|
||||
//Vendor settings
|
||||
|
||||
public bool canBeSold = true;
|
||||
|
||||
public float vendorPrice;
|
||||
public bool infiniteVendorAmountAvailable;
|
||||
|
||||
public string categoryName;
|
||||
|
||||
public int categoryIndex;
|
||||
public int elementIndex;
|
||||
|
||||
public float sellPrice;
|
||||
|
||||
public bool useMinLevelToBuy;
|
||||
public float minLevelToBuy;
|
||||
|
||||
|
||||
//Other settings
|
||||
|
||||
public float weight;
|
||||
|
||||
public bool spawnObject;
|
||||
|
||||
public bool useCustomObjectToDrop;
|
||||
public GameObject customObjectToDrop;
|
||||
public Vector3 dropObjectOffset;
|
||||
|
||||
public bool cantBeStoredOnInventory;
|
||||
|
||||
public bool canBeHeld;
|
||||
|
||||
public bool canBePlaceOnQuickAccessSlot;
|
||||
|
||||
public bool canBeSetOnQuickSlots;
|
||||
|
||||
public bool setMaximumAmountPerSlot;
|
||||
public int maximumAmountPerSlot;
|
||||
|
||||
|
||||
//Editor and prefabs settings
|
||||
public Button button;
|
||||
public inventoryMenuIconElement menuIconElement;
|
||||
public GameObject inventoryObjectPrefab;
|
||||
|
||||
public vendorObjectSlotPanelInfo currentVendorObjectSlotPanelInfo;
|
||||
|
||||
public GameObject emptyInventoryPrefab;
|
||||
|
||||
public inventoryInfo (inventoryInfo obj)
|
||||
{
|
||||
Name = obj.Name;
|
||||
inventoryGameObject = obj.inventoryGameObject;
|
||||
objectInfo = obj.objectInfo;
|
||||
icon = obj.icon;
|
||||
amount = obj.amount;
|
||||
amountPerUnit = obj.amountPerUnit;
|
||||
|
||||
infiniteAmount = obj.infiniteAmount;
|
||||
|
||||
storeTotalAmountPerUnit = obj.storeTotalAmountPerUnit;
|
||||
|
||||
showAmountPerUnitInAmountText = obj.showAmountPerUnitInAmountText;
|
||||
|
||||
canBeUsed = obj.canBeUsed;
|
||||
canBeEquiped = obj.canBeEquiped;
|
||||
canBeDropped = obj.canBeDropped;
|
||||
canBeCombined = obj.canBeCombined;
|
||||
|
||||
canBeExamined = obj.canBeExamined;
|
||||
|
||||
hideSlotOnMenu = obj.hideSlotOnMenu;
|
||||
|
||||
useNewBehaviorOnUse = obj.useNewBehaviorOnUse;
|
||||
newBehaviorOnUseMessage = obj.newBehaviorOnUseMessage;
|
||||
newBehaviorOnUnableToUseMessage = obj.newBehaviorOnUnableToUseMessage;
|
||||
|
||||
useOneUnitOnNewBehaviourCombine = obj.useOneUnitOnNewBehaviourCombine;
|
||||
|
||||
useNewBehaviorOnCombine = obj.useNewBehaviorOnCombine;
|
||||
newBehaviorOnCombineMessage = obj.newBehaviorOnCombineMessage;
|
||||
|
||||
useSoundOnUseObject = obj.useSoundOnUseObject;
|
||||
soundOnUseObject = obj.soundOnUseObject;
|
||||
onUseObjectAudioElement = obj.onUseObjectAudioElement;
|
||||
|
||||
canBeDiscarded = obj.canBeDiscarded;
|
||||
|
||||
canBeSold = obj.canBeSold;
|
||||
|
||||
vendorPrice = obj.vendorPrice;
|
||||
infiniteVendorAmountAvailable = obj.infiniteVendorAmountAvailable;
|
||||
|
||||
categoryName = obj.categoryName;
|
||||
|
||||
categoryIndex = obj.categoryIndex;
|
||||
elementIndex = obj.elementIndex;
|
||||
|
||||
sellPrice = obj.sellPrice;
|
||||
|
||||
useMinLevelToBuy = obj.useMinLevelToBuy;
|
||||
minLevelToBuy = obj.minLevelToBuy;
|
||||
|
||||
isEquipped = obj.isEquipped;
|
||||
|
||||
quickAccessSlotIndex = obj.quickAccessSlotIndex;
|
||||
|
||||
useDurability = obj.useDurability;
|
||||
durabilityAmount = obj.durabilityAmount;
|
||||
|
||||
maxDurabilityAmount = obj.maxDurabilityAmount;
|
||||
|
||||
objectIsBroken = obj.objectIsBroken;
|
||||
|
||||
sellMultiplierIfObjectIsBroken = obj.sellMultiplierIfObjectIsBroken;
|
||||
|
||||
|
||||
isWeapon = obj.isWeapon;
|
||||
isMeleeWeapon = obj.isMeleeWeapon;
|
||||
|
||||
isMeleeShield = obj.isMeleeShield;
|
||||
|
||||
isArmorClothAccessory = obj.isArmorClothAccessory;
|
||||
|
||||
projectilesInMagazine = obj.projectilesInMagazine;
|
||||
|
||||
mainWeaponObjectInfo = obj.mainWeaponObjectInfo;
|
||||
|
||||
weight = obj.weight;
|
||||
|
||||
objectToCombine = obj.objectToCombine;
|
||||
combinedObject = obj.combinedObject;
|
||||
combinedObjectMessage = obj.combinedObjectMessage;
|
||||
button = obj.button;
|
||||
|
||||
spawnObject = obj.spawnObject;
|
||||
|
||||
useCustomObjectToDrop = obj.useCustomObjectToDrop;
|
||||
customObjectToDrop = obj.customObjectToDrop;
|
||||
dropObjectOffset = obj.dropObjectOffset;
|
||||
|
||||
cantBeStoredOnInventory = obj.cantBeStoredOnInventory;
|
||||
|
||||
canBeHeld = obj.canBeHeld;
|
||||
|
||||
canBePlaceOnQuickAccessSlot = obj.canBePlaceOnQuickAccessSlot;
|
||||
|
||||
canBeSetOnQuickSlots = obj.canBeSetOnQuickSlots;
|
||||
|
||||
setMaximumAmountPerSlot = obj.setMaximumAmountPerSlot;
|
||||
maximumAmountPerSlot = obj.maximumAmountPerSlot;
|
||||
}
|
||||
|
||||
public inventoryInfo ()
|
||||
{
|
||||
Name = "New Object";
|
||||
objectInfo = "New Description";
|
||||
}
|
||||
|
||||
public void InitializeAudioElements ()
|
||||
{
|
||||
if (soundOnUseObject != null) {
|
||||
onUseObjectAudioElement.clip = soundOnUseObject;
|
||||
}
|
||||
}
|
||||
|
||||
public void setNewName (string newName)
|
||||
{
|
||||
Name = newName;
|
||||
}
|
||||
|
||||
public void resetInventoryInfo ()
|
||||
{
|
||||
Name = "Empty Slot";
|
||||
inventoryGameObject = null;
|
||||
objectInfo = "It is an empty slot";
|
||||
icon = null;
|
||||
amount = 0;
|
||||
amountPerUnit = 0;
|
||||
|
||||
infiniteAmount = false;
|
||||
|
||||
storeTotalAmountPerUnit = false;
|
||||
|
||||
showAmountPerUnitInAmountText = false;
|
||||
|
||||
canBeUsed = false;
|
||||
canBeDropped = false;
|
||||
canBeEquiped = false;
|
||||
canBeCombined = false;
|
||||
|
||||
canBeExamined = false;
|
||||
|
||||
hideSlotOnMenu = false;
|
||||
|
||||
useNewBehaviorOnUse = false;
|
||||
newBehaviorOnUseMessage = "";
|
||||
newBehaviorOnUnableToUseMessage = "";
|
||||
|
||||
useOneUnitOnNewBehaviourCombine = true;
|
||||
|
||||
useNewBehaviorOnCombine = false;
|
||||
newBehaviorOnCombineMessage = "";
|
||||
|
||||
useSoundOnUseObject = false;
|
||||
soundOnUseObject = null;
|
||||
onUseObjectAudioElement = null;
|
||||
|
||||
canBeDiscarded = false;
|
||||
|
||||
canBeSold = true;
|
||||
vendorPrice = 0;
|
||||
|
||||
sellPrice = 0;
|
||||
|
||||
useMinLevelToBuy = false;
|
||||
minLevelToBuy = 0;
|
||||
|
||||
weight = 0;
|
||||
|
||||
infiniteVendorAmountAvailable = false;
|
||||
|
||||
categoryName = "";
|
||||
|
||||
categoryIndex = 0;
|
||||
elementIndex = 0;
|
||||
|
||||
isEquipped = false;
|
||||
|
||||
quickAccessSlotIndex = -1;
|
||||
|
||||
useDurability = false;
|
||||
durabilityAmount = 100;
|
||||
|
||||
maxDurabilityAmount = 100;
|
||||
|
||||
objectIsBroken = false;
|
||||
|
||||
sellMultiplierIfObjectIsBroken = 1;
|
||||
|
||||
isWeapon = false;
|
||||
isMeleeWeapon = false;
|
||||
isMeleeShield = false;
|
||||
|
||||
isArmorClothAccessory = false;
|
||||
|
||||
projectilesInMagazine = -1;
|
||||
|
||||
mainWeaponObjectInfo = null;
|
||||
|
||||
objectToCombine = null;
|
||||
combinedObject = null;
|
||||
combinedObjectMessage = "";
|
||||
|
||||
if (menuIconElement != null) {
|
||||
menuIconElement.icon.texture = null;
|
||||
menuIconElement.iconName.text = "Empty Slot";
|
||||
menuIconElement.amount.text = "0";
|
||||
}
|
||||
|
||||
spawnObject = false;
|
||||
|
||||
useCustomObjectToDrop = false;
|
||||
customObjectToDrop = null;
|
||||
dropObjectOffset = Vector3.zero;
|
||||
|
||||
cantBeStoredOnInventory = false;
|
||||
|
||||
canBeHeld = false;
|
||||
|
||||
canBePlaceOnQuickAccessSlot = false;
|
||||
|
||||
canBeSetOnQuickSlots = false;
|
||||
|
||||
setMaximumAmountPerSlot = false;
|
||||
maximumAmountPerSlot = 0;
|
||||
}
|
||||
|
||||
public inventoryInfo copyInventoryObject (inventoryInfo objectToStore, inventoryInfo objectToCopy)
|
||||
{
|
||||
objectToStore.Name = objectToCopy.Name;
|
||||
objectToStore.inventoryGameObject = objectToCopy.inventoryGameObject;
|
||||
objectToStore.objectInfo = objectToCopy.objectInfo;
|
||||
objectToStore.icon = objectToCopy.icon;
|
||||
|
||||
objectToStore.infiniteAmount = objectToCopy.infiniteAmount;
|
||||
|
||||
objectToStore.storeTotalAmountPerUnit = objectToCopy.storeTotalAmountPerUnit;
|
||||
|
||||
objectToStore.showAmountPerUnitInAmountText = objectToCopy.showAmountPerUnitInAmountText;
|
||||
|
||||
objectToStore.canBeUsed = objectToCopy.canBeUsed;
|
||||
objectToStore.canBeEquiped = objectToCopy.canBeEquiped;
|
||||
objectToStore.canBeDropped = objectToCopy.canBeDropped;
|
||||
objectToStore.canBeCombined = objectToCopy.canBeCombined;
|
||||
|
||||
objectToStore.canBeExamined = objectToCopy.canBeExamined;
|
||||
|
||||
objectToStore.hideSlotOnMenu = objectToCopy.hideSlotOnMenu;
|
||||
|
||||
objectToStore.useNewBehaviorOnUse = objectToCopy.useNewBehaviorOnUse;
|
||||
objectToStore.newBehaviorOnUseMessage = objectToCopy.newBehaviorOnUseMessage;
|
||||
objectToStore.newBehaviorOnUnableToUseMessage = objectToCopy.newBehaviorOnUnableToUseMessage;
|
||||
|
||||
objectToStore.useOneUnitOnNewBehaviourCombine = objectToCopy.useOneUnitOnNewBehaviourCombine;
|
||||
|
||||
objectToStore.useNewBehaviorOnCombine = objectToCopy.useNewBehaviorOnCombine;
|
||||
objectToStore.newBehaviorOnCombineMessage = objectToCopy.newBehaviorOnCombineMessage;
|
||||
|
||||
useSoundOnUseObject = objectToCopy.useSoundOnUseObject;
|
||||
soundOnUseObject = objectToCopy.soundOnUseObject;
|
||||
onUseObjectAudioElement = objectToCopy.onUseObjectAudioElement;
|
||||
|
||||
objectToStore.isEquipped = objectToCopy.isEquipped;
|
||||
|
||||
objectToStore.quickAccessSlotIndex = objectToCopy.quickAccessSlotIndex;
|
||||
|
||||
useDurability = objectToCopy.useDurability;
|
||||
durabilityAmount = objectToCopy.durabilityAmount;
|
||||
|
||||
maxDurabilityAmount = objectToCopy.maxDurabilityAmount;
|
||||
|
||||
objectIsBroken = objectToCopy.objectIsBroken;
|
||||
|
||||
sellMultiplierIfObjectIsBroken = objectToCopy.sellMultiplierIfObjectIsBroken;
|
||||
|
||||
objectToStore.isWeapon = objectToCopy.isWeapon;
|
||||
objectToStore.isMeleeWeapon = objectToCopy.isMeleeWeapon;
|
||||
objectToStore.isMeleeShield = objectToCopy.isMeleeShield;
|
||||
|
||||
objectToStore.isArmorClothAccessory = objectToCopy.isArmorClothAccessory;
|
||||
|
||||
objectToStore.objectToCombine = objectToCopy.objectToCombine;
|
||||
objectToStore.combinedObject = objectToCopy.combinedObject;
|
||||
objectToStore.combinedObjectMessage = objectToCopy.combinedObjectMessage;
|
||||
|
||||
objectToStore.menuIconElement.icon.texture = objectToCopy.icon;
|
||||
|
||||
objectToStore.canBeDiscarded = objectToCopy.canBeDiscarded;
|
||||
|
||||
objectToStore.canBeSold = objectToCopy.canBeSold;
|
||||
objectToStore.vendorPrice = objectToCopy.vendorPrice;
|
||||
objectToStore.infiniteVendorAmountAvailable = objectToCopy.infiniteVendorAmountAvailable;
|
||||
objectToStore.categoryName = objectToCopy.categoryName;
|
||||
|
||||
objectToStore.categoryIndex = objectToCopy.categoryIndex;
|
||||
objectToStore.elementIndex = objectToCopy.elementIndex;
|
||||
|
||||
objectToStore.sellPrice = objectToCopy.sellPrice;
|
||||
|
||||
objectToStore.useMinLevelToBuy = objectToCopy.useMinLevelToBuy;
|
||||
objectToStore.minLevelToBuy = objectToCopy.minLevelToBuy;
|
||||
|
||||
objectToStore.weight = objectToCopy.weight;
|
||||
|
||||
objectToStore.spawnObject = objectToCopy.spawnObject;
|
||||
|
||||
useCustomObjectToDrop = objectToCopy.useCustomObjectToDrop;
|
||||
customObjectToDrop = objectToCopy.customObjectToDrop;
|
||||
dropObjectOffset = objectToCopy.dropObjectOffset;
|
||||
|
||||
objectToStore.cantBeStoredOnInventory = objectToCopy.cantBeStoredOnInventory;
|
||||
|
||||
objectToStore.canBeHeld = objectToCopy.canBeHeld;
|
||||
|
||||
objectToStore.canBePlaceOnQuickAccessSlot = objectToCopy.canBePlaceOnQuickAccessSlot;
|
||||
|
||||
objectToStore.canBeSetOnQuickSlots = objectToCopy.canBeSetOnQuickSlots;
|
||||
|
||||
setMaximumAmountPerSlot = objectToCopy.setMaximumAmountPerSlot;
|
||||
maximumAmountPerSlot = objectToCopy.maximumAmountPerSlot;
|
||||
|
||||
return objectToStore;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 520ad248e932148488ca82de7ee0d91b
|
||||
timeCreated: 1512661917
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventoryInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,46 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEngine.UI;
|
||||
|
||||
[System.Serializable]
|
||||
public class inventoryListElement
|
||||
{
|
||||
public string Name;
|
||||
public int amount;
|
||||
public bool infiniteAmount;
|
||||
|
||||
public string inventoryCategoryName;
|
||||
public string inventoryObjectName;
|
||||
|
||||
public int categoryIndex;
|
||||
public int elementIndex;
|
||||
|
||||
public float vendorPrice;
|
||||
public float sellPrice;
|
||||
|
||||
public bool useMinLevelToBuy;
|
||||
public float minLevelToBuy;
|
||||
|
||||
public bool addObjectToList = true;
|
||||
|
||||
public bool spawnObject;
|
||||
|
||||
public bool infiniteVendorAmountAvailable;
|
||||
|
||||
public bool isEquipped;
|
||||
|
||||
public int quickAccessSlotIndex = -1;
|
||||
|
||||
public bool addInventoryObject = true;
|
||||
|
||||
public bool useDurability;
|
||||
public float durabilityAmount;
|
||||
|
||||
public float maxDurabilityAmount;
|
||||
|
||||
public bool objectIsBroken;
|
||||
|
||||
public bool isWeapon;
|
||||
public bool isMeleeWeapon;
|
||||
public int projectilesInMagazine = -1;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d09558af962f71c46a3e6899a56eb8af
|
||||
timeCreated: 1523327272
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventoryListElement.cs
|
||||
uploadId: 814740
|
||||
1225
Assets/Game Kit Controller/Scripts/Inventory/inventoryListManager.cs
Normal file
1225
Assets/Game Kit Controller/Scripts/Inventory/inventoryListManager.cs
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd23233e7000ef34f92ec1666d635e91
|
||||
timeCreated: 1671036407
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventoryListManager.cs.bak
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b93a5d15e7873349bb1b24bee270b16
|
||||
timeCreated: 1512661873
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventoryListManager.cs
|
||||
uploadId: 814740
|
||||
6699
Assets/Game Kit Controller/Scripts/Inventory/inventoryManager.cs
Normal file
6699
Assets/Game Kit Controller/Scripts/Inventory/inventoryManager.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3718887517e96845ad4916ba794699d
|
||||
timeCreated: 1580457386
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: c15b041dc161ec74eaf647e3fc459f2c, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventoryManager.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,120 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class inventoryManagerInfo : MonoBehaviour
|
||||
{
|
||||
public bool saveCurrentPlayerInventoryToSaveFile = true;
|
||||
public bool loadCurrentPlayerInventoryFromSaveFile = true;
|
||||
|
||||
public bool setInfiniteSlotValuesOnSaveLoad = true;
|
||||
|
||||
public int inventorySlotAmount;
|
||||
|
||||
public bool infiniteSlots;
|
||||
|
||||
public List<inventoryInfo> inventoryList = new List<inventoryInfo> ();
|
||||
|
||||
public bool isLoadingGame;
|
||||
|
||||
public string lastWeaponCarriedOnHandsName = "";
|
||||
|
||||
public bool inventoryWasEmptyWhenSaved;
|
||||
|
||||
|
||||
protected virtual void InitializeAudioElements ()
|
||||
{
|
||||
foreach (var inventoryInfo in inventoryList)
|
||||
inventoryInfo.InitializeAudioElements ();
|
||||
}
|
||||
|
||||
public virtual bool isSaveCurrentPlayerInventoryToSaveFileActive ()
|
||||
{
|
||||
return saveCurrentPlayerInventoryToSaveFile;
|
||||
}
|
||||
|
||||
public virtual bool isLoadCurrentPlayerInventoryFromSaveFileActive ()
|
||||
{
|
||||
return loadCurrentPlayerInventoryFromSaveFile;
|
||||
}
|
||||
|
||||
public virtual void setInventorySlotAmountValue (int newValue)
|
||||
{
|
||||
inventorySlotAmount = newValue;
|
||||
}
|
||||
|
||||
public virtual int getInventorySlotAmount ()
|
||||
{
|
||||
return inventorySlotAmount;
|
||||
}
|
||||
|
||||
public virtual void setInfiniteSlotsState (bool state)
|
||||
{
|
||||
infiniteSlots = state;
|
||||
}
|
||||
|
||||
public virtual bool isSetInfiniteSlotValuesOnSaveLoadActive ()
|
||||
{
|
||||
return setInfiniteSlotValuesOnSaveLoad;
|
||||
}
|
||||
|
||||
public virtual bool isInfiniteSlotsActive ()
|
||||
{
|
||||
return infiniteSlots;
|
||||
}
|
||||
|
||||
public virtual void initializeInventoryValues ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual List<inventoryInfo> getInventoryList ()
|
||||
{
|
||||
return inventoryList;
|
||||
}
|
||||
|
||||
public virtual List<inventoryListElement> getCurrentInventoryListManagerList ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual void setNewInventoryListManagerList (List<inventoryListElement> newList)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void setIsLoadingGameState (bool state)
|
||||
{
|
||||
isLoadingGame = state;
|
||||
}
|
||||
|
||||
public bool isLoadingGameState ()
|
||||
{
|
||||
return isLoadingGame;
|
||||
}
|
||||
|
||||
public virtual void updateDurabilityAmountStateOnAllInventoryObjects ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual string getLastWeaponCarriedOnHandsName ()
|
||||
{
|
||||
return lastWeaponCarriedOnHandsName;
|
||||
}
|
||||
|
||||
public virtual void setLastWeaponCarriedOnHandsName (string objectName)
|
||||
{
|
||||
lastWeaponCarriedOnHandsName = objectName;
|
||||
}
|
||||
|
||||
public virtual void setInventoryWasEmptyWhenSavedState (bool state)
|
||||
{
|
||||
inventoryWasEmptyWhenSaved = state;
|
||||
}
|
||||
|
||||
public virtual bool getInventoryWasEmptyWhenSaved ()
|
||||
{
|
||||
return inventoryWasEmptyWhenSaved;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47d9665cc45548a498f00c956ef9a29e
|
||||
timeCreated: 1640436169
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventoryManagerInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,29 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEngine.UI;
|
||||
|
||||
[System.Serializable]
|
||||
public class inventoryMenuIconElement : MonoBehaviour
|
||||
{
|
||||
public Button button;
|
||||
public Text iconName;
|
||||
public Text amount;
|
||||
public RawImage icon;
|
||||
public GameObject pressedIcon;
|
||||
public GameObject combineIcon;
|
||||
public GameObject equipedIcon;
|
||||
public GameObject activeSlotContent;
|
||||
public GameObject emptySlotContent;
|
||||
|
||||
public GameObject amountPerUnitPanel;
|
||||
public Text amountPerUnitText;
|
||||
|
||||
public GameObject infiniteAmountIcon;
|
||||
|
||||
public RectTransform inventoryOptionsOnSlotPanelPosition;
|
||||
|
||||
public GameObject durabilitySliderGameObject;
|
||||
public Slider durabilitySlider;
|
||||
|
||||
public GameObject objectBrokenIconGameObject;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 42a640b83a3d4364c8658e82d1577116
|
||||
timeCreated: 1484491535
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventoryMenuIconElement.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,139 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class inventoryMenuPanelsSystem : MonoBehaviour
|
||||
{
|
||||
public List<inventoryPanelsInfo> inventoryPanelsInfoList = new List<inventoryPanelsInfo> ();
|
||||
|
||||
public bool setStateOnStart;
|
||||
public string stateOnStart;
|
||||
|
||||
public string currentState;
|
||||
|
||||
inventoryPanelsInfo currentInventoryPanelsInfo;
|
||||
|
||||
inventoryPanelInfo currentInventoryPanelInfo;
|
||||
|
||||
void Start ()
|
||||
{
|
||||
if (setStateOnStart) {
|
||||
setInventoryPanelByName (stateOnStart);
|
||||
}
|
||||
}
|
||||
|
||||
public void setInventoryPanelByName (string panelName)
|
||||
{
|
||||
if (currentState.Equals (panelName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < inventoryPanelsInfoList.Count; i++) {
|
||||
currentInventoryPanelsInfo = inventoryPanelsInfoList [i];
|
||||
|
||||
if (!currentInventoryPanelsInfo.Name.Equals (panelName)) {
|
||||
currentInventoryPanelsInfo.isCurrentState = false;
|
||||
|
||||
for (int j = 0; j < currentInventoryPanelsInfo.extraElementList.Count; j++) {
|
||||
if (currentInventoryPanelsInfo.extraElementList [j].activeSelf) {
|
||||
currentInventoryPanelsInfo.extraElementList [j].SetActive (false);
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < currentInventoryPanelsInfo.inventoryPanelInfoList.Count; j++) {
|
||||
currentInventoryPanelsInfo.inventoryPanelInfoList [j].inventoryPanel.transform.localScale = Vector3.one;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < inventoryPanelsInfoList.Count; i++) {
|
||||
currentInventoryPanelsInfo = inventoryPanelsInfoList [i];
|
||||
|
||||
if (currentInventoryPanelsInfo.Name.Equals (panelName)) {
|
||||
|
||||
currentState = panelName;
|
||||
|
||||
currentInventoryPanelsInfo.isCurrentState = true;
|
||||
|
||||
if (currentInventoryPanelsInfo.useEventOnPanel) {
|
||||
currentInventoryPanelsInfo.eventOnPanel.Invoke ();
|
||||
}
|
||||
|
||||
for (int j = 0; j < currentInventoryPanelsInfo.inventoryPanelInfoList.Count; j++) {
|
||||
|
||||
currentInventoryPanelInfo = currentInventoryPanelsInfo.inventoryPanelInfoList [j];
|
||||
|
||||
if (currentInventoryPanelInfo.inventoryPanel.gameObject.activeSelf != currentInventoryPanelInfo.isActive) {
|
||||
currentInventoryPanelInfo.inventoryPanel.gameObject.SetActive (currentInventoryPanelInfo.isActive);
|
||||
}
|
||||
|
||||
if (currentInventoryPanelInfo.setParentOnOtherPanelBeforeAdjust) {
|
||||
currentInventoryPanelInfo.inventoryPanel.SetParent (currentInventoryPanelInfo.otherPanelBeforeAdjust);
|
||||
}
|
||||
|
||||
if (currentInventoryPanelInfo.adjustPanelToRectTransform) {
|
||||
|
||||
currentInventoryPanelInfo.inventoryPanel.anchorMin = currentInventoryPanelInfo.rectTransformToAdjust.anchorMin;
|
||||
currentInventoryPanelInfo.inventoryPanel.anchorMax = currentInventoryPanelInfo.rectTransformToAdjust.anchorMax;
|
||||
|
||||
currentInventoryPanelInfo.inventoryPanel.anchoredPosition = currentInventoryPanelInfo.rectTransformToAdjust.anchoredPosition;
|
||||
|
||||
currentInventoryPanelInfo.inventoryPanel.sizeDelta = currentInventoryPanelInfo.rectTransformToAdjust.sizeDelta;
|
||||
}
|
||||
|
||||
if (currentInventoryPanelInfo.setPanelParent) {
|
||||
currentInventoryPanelInfo.inventoryPanel.SetParent (currentInventoryPanelInfo.panelParent);
|
||||
}
|
||||
|
||||
if (currentInventoryPanelInfo.setNewScale) {
|
||||
currentInventoryPanelInfo.inventoryPanel.transform.localScale =
|
||||
new Vector3 (currentInventoryPanelInfo.newScale.x, currentInventoryPanelInfo.newScale.y, 1);
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < currentInventoryPanelsInfo.extraElementList.Count; j++) {
|
||||
if (!currentInventoryPanelsInfo.extraElementList [j].activeSelf) {
|
||||
currentInventoryPanelsInfo.extraElementList [j].SetActive (true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class inventoryPanelsInfo
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public bool isCurrentState;
|
||||
|
||||
public List<inventoryPanelInfo> inventoryPanelInfoList = new List<inventoryPanelInfo> ();
|
||||
|
||||
public List<GameObject> extraElementList = new List<GameObject> ();
|
||||
|
||||
public bool useEventOnPanel;
|
||||
public UnityEvent eventOnPanel;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class inventoryPanelInfo
|
||||
{
|
||||
public string Name;
|
||||
public RectTransform inventoryPanel;
|
||||
public bool isActive;
|
||||
|
||||
public bool adjustPanelToRectTransform;
|
||||
public RectTransform rectTransformToAdjust;
|
||||
|
||||
public bool setPanelParent;
|
||||
public RectTransform panelParent;
|
||||
|
||||
public bool setParentOnOtherPanelBeforeAdjust;
|
||||
public RectTransform otherPanelBeforeAdjust;
|
||||
|
||||
public bool setNewScale;
|
||||
public Vector2 newScale;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0104b30ebe7b61642b0fb704abdfe36e
|
||||
timeCreated: 1577307117
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventoryMenuPanelsSystem.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,86 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class inventoryObject : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public inventoryInfo inventoryObjectInfo;
|
||||
|
||||
[Space]
|
||||
[Header ("Main Inventory Object Settings")]
|
||||
[Space]
|
||||
|
||||
public objectOnInventory mainObjectOnInventory;
|
||||
|
||||
[Space]
|
||||
[Header ("Inventory Settings")]
|
||||
[Space]
|
||||
|
||||
public bool useZoomRange = true;
|
||||
public float maxZoom = 30;
|
||||
public float minZoom = 100;
|
||||
public float initialZoom = 46;
|
||||
|
||||
[Space]
|
||||
|
||||
public Vector3 meshPositionOffset;
|
||||
public Vector3 meshRotationOffset;
|
||||
|
||||
private void Start ()
|
||||
{
|
||||
inventoryObjectInfo.InitializeAudioElements ();
|
||||
}
|
||||
|
||||
public void useObjectOnNewBehavior (GameObject currentPlayer, int amountToUse)
|
||||
{
|
||||
if (mainObjectOnInventory != null) {
|
||||
mainObjectOnInventory.activateUseObjectActionOnInventory (currentPlayer, amountToUse);
|
||||
}
|
||||
}
|
||||
|
||||
public void useObjectOnNewBehaviorWithExternalCharacter (GameObject currentPlayer, GameObject currentExternalCharacterForInventoryUsage, int amountToUse)
|
||||
{
|
||||
if (mainObjectOnInventory != null) {
|
||||
mainObjectOnInventory.activateUseObjectActionOnInventoryWithExternalCharacter (currentPlayer, currentExternalCharacterForInventoryUsage, amountToUse);
|
||||
}
|
||||
}
|
||||
|
||||
public void combineObjectsOnNewBehavior (GameObject currentPlayer, inventoryInfo inventoryInfoToUse)
|
||||
{
|
||||
if (mainObjectOnInventory != null) {
|
||||
mainObjectOnInventory.activateCombineObjectActionOnInventory (currentPlayer, inventoryInfoToUse);
|
||||
}
|
||||
}
|
||||
|
||||
public void carryPhysicalObjectFromInventory (GameObject currentPlayer)
|
||||
{
|
||||
if (mainObjectOnInventory != null) {
|
||||
mainObjectOnInventory.carryPhysicalObjectFromInventory (currentPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public void eventOnPickObjectNewBehaviour (GameObject currentPlayer)
|
||||
{
|
||||
if (mainObjectOnInventory != null) {
|
||||
mainObjectOnInventory.eventOnPickObject (currentPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public void eventOnDropObjectNewBehaviour (GameObject currentPlayer)
|
||||
{
|
||||
if (mainObjectOnInventory != null) {
|
||||
mainObjectOnInventory.eventOnDropObject (currentPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public bool setObjectEquippedStateOnInventoryOnNewBehavior (GameObject currentPlayer, bool state)
|
||||
{
|
||||
if (mainObjectOnInventory != null) {
|
||||
return mainObjectOnInventory.setObjectEquippedStateOnInventory (currentPlayer, state);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b46a5536ebaad7a4b94ddccdce973ccd
|
||||
timeCreated: 1466294018
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventoryObject.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class inventoryObjectToEquipInfo : MonoBehaviour
|
||||
{
|
||||
public virtual bool setObjectEquippedState (bool state)
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool isObjectEquipped ()
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void updateObjectState ()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6468fb1242c946d4a9d333e3742b3ca0
|
||||
timeCreated: 1611212608
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventoryObjectToEquipInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,11 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class inventoryPrefabCreationSystem : MonoBehaviour
|
||||
{
|
||||
public virtual void createInventoryPrefabObject ()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5200694a5147c9147a71db596791e533
|
||||
timeCreated: 1576297665
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventoryPrefabCreationSystem.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,197 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class inventorySlotOptionsButtons : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public int buttonHeight;
|
||||
|
||||
public int extraHeight;
|
||||
|
||||
public int panelBackgroundOffset;
|
||||
|
||||
[Space]
|
||||
[Header ("Show Buttons Settings")]
|
||||
[Space]
|
||||
|
||||
public bool useButtonEnabled = true;
|
||||
public bool equipButtonEnabled = true;
|
||||
public bool unEquipButtonEnabled = true;
|
||||
public bool dropButtonEnabled = true;
|
||||
public bool combineButtonEnabled = true;
|
||||
public bool examineButtonEnabled = true;
|
||||
public bool holdButtonEnabled = true;
|
||||
public bool discardButtonEnabled = true;
|
||||
public bool setOnQuickSlotsButtonEnabled = true;
|
||||
public bool repairButtonEnabled = true;
|
||||
|
||||
[Space]
|
||||
[Header ("UI Components Settings")]
|
||||
[Space]
|
||||
|
||||
public GameObject useButton;
|
||||
public GameObject equipButton;
|
||||
public GameObject unEquipButton;
|
||||
public GameObject dropButton;
|
||||
public GameObject combineButton;
|
||||
public GameObject examineButton;
|
||||
public GameObject holdButton;
|
||||
public GameObject discardButton;
|
||||
public GameObject setOnQuickSlotsButton;
|
||||
public GameObject repairButton;
|
||||
|
||||
[Space]
|
||||
|
||||
public RectTransform optionsPanel;
|
||||
|
||||
public RectTransform panelBackground;
|
||||
|
||||
|
||||
int numberOfOptionsEnabled;
|
||||
|
||||
|
||||
public void setButtonsState (bool useState, bool equipState, bool unEquipState, bool dropState,
|
||||
bool combineState, bool examineState, bool holdState, bool discardState,
|
||||
bool setOnQuickSlotsState, bool repairState)
|
||||
{
|
||||
if (!useButtonEnabled) {
|
||||
useState = false;
|
||||
}
|
||||
|
||||
if (!equipButtonEnabled) {
|
||||
equipState = false;
|
||||
}
|
||||
|
||||
if (!unEquipButtonEnabled) {
|
||||
unEquipState = false;
|
||||
}
|
||||
|
||||
if (!dropButtonEnabled) {
|
||||
dropState = false;
|
||||
}
|
||||
|
||||
if (!combineButtonEnabled) {
|
||||
combineState = false;
|
||||
}
|
||||
|
||||
if (!examineButtonEnabled) {
|
||||
examineState = false;
|
||||
}
|
||||
|
||||
if (!holdButtonEnabled) {
|
||||
holdState = false;
|
||||
}
|
||||
|
||||
if (!discardButtonEnabled) {
|
||||
discardState = false;
|
||||
}
|
||||
|
||||
if (!setOnQuickSlotsButtonEnabled) {
|
||||
setOnQuickSlotsState = false;
|
||||
}
|
||||
|
||||
if (!repairButtonEnabled) {
|
||||
repairState = false;
|
||||
}
|
||||
|
||||
if (useButton != null && useButton.activeSelf != useState) {
|
||||
useButton.SetActive (useState);
|
||||
}
|
||||
|
||||
if (equipButton != null && equipButton.activeSelf != equipState) {
|
||||
equipButton.SetActive (equipState);
|
||||
}
|
||||
|
||||
if (unEquipButton != null && unEquipButton.activeSelf != unEquipState) {
|
||||
unEquipButton.SetActive (unEquipState);
|
||||
}
|
||||
|
||||
if (dropButton != null && dropButton.activeSelf != dropState) {
|
||||
dropButton.SetActive (dropState);
|
||||
}
|
||||
|
||||
if (combineButton != null && combineButton.activeSelf != combineState) {
|
||||
combineButton.SetActive (combineState);
|
||||
}
|
||||
|
||||
if (examineButton != null && examineButton.activeSelf != examineState) {
|
||||
examineButton.SetActive (examineState);
|
||||
}
|
||||
|
||||
if (holdButton != null && holdButton.activeSelf != holdState) {
|
||||
holdButton.SetActive (holdState);
|
||||
}
|
||||
|
||||
if (discardButton != null && discardButton.activeSelf != discardState) {
|
||||
discardButton.SetActive (discardState);
|
||||
}
|
||||
|
||||
if (setOnQuickSlotsButton != null && setOnQuickSlotsButton.activeSelf != setOnQuickSlotsState) {
|
||||
setOnQuickSlotsButton.SetActive (setOnQuickSlotsState);
|
||||
}
|
||||
|
||||
if (repairButton != null && repairButton.activeSelf != repairState) {
|
||||
repairButton.SetActive (repairState);
|
||||
}
|
||||
|
||||
numberOfOptionsEnabled = 0;
|
||||
|
||||
if (useState) {
|
||||
numberOfOptionsEnabled++;
|
||||
}
|
||||
|
||||
if (equipState) {
|
||||
numberOfOptionsEnabled++;
|
||||
}
|
||||
|
||||
if (unEquipState) {
|
||||
numberOfOptionsEnabled++;
|
||||
}
|
||||
|
||||
if (dropState) {
|
||||
numberOfOptionsEnabled++;
|
||||
}
|
||||
|
||||
if (combineState) {
|
||||
numberOfOptionsEnabled++;
|
||||
}
|
||||
|
||||
if (examineState) {
|
||||
numberOfOptionsEnabled++;
|
||||
}
|
||||
|
||||
if (holdState) {
|
||||
numberOfOptionsEnabled++;
|
||||
}
|
||||
|
||||
if (discardState) {
|
||||
numberOfOptionsEnabled++;
|
||||
}
|
||||
|
||||
if (setOnQuickSlotsState) {
|
||||
numberOfOptionsEnabled++;
|
||||
}
|
||||
|
||||
if (repairState) {
|
||||
numberOfOptionsEnabled++;
|
||||
}
|
||||
|
||||
if (numberOfOptionsEnabled == 0) {
|
||||
if (optionsPanel.gameObject.activeSelf) {
|
||||
optionsPanel.gameObject.SetActive (false);
|
||||
}
|
||||
} else {
|
||||
if (!optionsPanel.gameObject.activeSelf) {
|
||||
optionsPanel.gameObject.SetActive (true);
|
||||
}
|
||||
}
|
||||
|
||||
optionsPanel.sizeDelta = new Vector2 (optionsPanel.sizeDelta.x, (buttonHeight * numberOfOptionsEnabled) + extraHeight);
|
||||
|
||||
panelBackground.sizeDelta = new Vector2 (panelBackground.sizeDelta.x, (buttonHeight * numberOfOptionsEnabled) + panelBackgroundOffset);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2638aadb229026446824d03c21adff03
|
||||
timeCreated: 1565604620
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventorySlotOptionsButtons.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,306 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using UnityEngine.UI;
|
||||
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class inventoryWeightManager : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public bool useInventoryWeightEnabled = true;
|
||||
|
||||
public bool useInventoryWeightLimit;
|
||||
public float inventoryWeightLimit;
|
||||
|
||||
public string weightUnit = "Kg";
|
||||
|
||||
public float currentTotalWeight;
|
||||
|
||||
public bool useMaxObjectWeightToPick;
|
||||
public float maxObjectWeightToPick;
|
||||
|
||||
public string inventoryWeightLimitStatName = "Inventory Weight Limit";
|
||||
|
||||
[Space]
|
||||
[Header ("Debug")]
|
||||
[Space]
|
||||
|
||||
public bool showDebugPrint;
|
||||
|
||||
public bool weightLimitReached;
|
||||
|
||||
public bool weightLimitReachedPreviously;
|
||||
|
||||
[Space]
|
||||
[Header ("Events Settings")]
|
||||
[Space]
|
||||
|
||||
public UnityEvent eventOnRegularWeight;
|
||||
public UnityEvent evenOnWeightLimitReached;
|
||||
|
||||
[Space]
|
||||
[Header ("Components")]
|
||||
[Space]
|
||||
|
||||
public GameObject inventoryWeightPanel;
|
||||
public Text currentObjectWeightText;
|
||||
|
||||
public Text totalInventoryWeightText;
|
||||
|
||||
public Slider totalInventoryWeightSlider;
|
||||
|
||||
public inventoryManager mainInventoryManager;
|
||||
|
||||
public GameObject currentInventoryObjectWeightPanel;
|
||||
public playerStatsSystem playerStatsManager;
|
||||
|
||||
bool hasPlayerStatsManager;
|
||||
|
||||
Coroutine updateFullInventoryWeightCoroutine;
|
||||
|
||||
void Start ()
|
||||
{
|
||||
if (!useInventoryWeightEnabled) {
|
||||
if (inventoryWeightPanel.activeSelf) {
|
||||
inventoryWeightPanel.SetActive (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateCurrentInventoryObjectWeight ()
|
||||
{
|
||||
if (!useInventoryWeightEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainInventoryManager.isCurrentObjectNotNull ()) {
|
||||
if (!currentInventoryObjectWeightPanel.activeSelf) {
|
||||
currentInventoryObjectWeightPanel.SetActive (true);
|
||||
}
|
||||
|
||||
inventoryInfo currentInventoryObjectInfo = mainInventoryManager.getCurrentInventoryObjectInfo ();
|
||||
|
||||
float currentObjectWeight = currentInventoryObjectInfo.weight;
|
||||
|
||||
if (currentInventoryObjectInfo.storeTotalAmountPerUnit) {
|
||||
int currentObjectAmountPerUnit = mainInventoryManager.getInventoryObjectAmountPerUnitByName (currentInventoryObjectInfo.Name);
|
||||
|
||||
if (currentObjectAmountPerUnit > 0) {
|
||||
currentObjectWeight /= currentObjectAmountPerUnit;
|
||||
}
|
||||
}
|
||||
|
||||
float currentObjectTotalWeight = currentObjectWeight * currentInventoryObjectInfo.amount;
|
||||
|
||||
currentObjectWeightText.text = (currentObjectTotalWeight).ToString ("F1") + " " + weightUnit;
|
||||
|
||||
if (currentInventoryObjectInfo.amount > 1) {
|
||||
currentObjectWeightText.text += " (" + currentObjectWeight.ToString ("F2") + " x " + currentInventoryObjectInfo.amount + ")";
|
||||
}
|
||||
} else {
|
||||
if (currentInventoryObjectWeightPanel.activeSelf) {
|
||||
currentInventoryObjectWeightPanel.SetActive (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void disableCurrentInventoryObjectWeight ()
|
||||
{
|
||||
if (currentInventoryObjectWeightPanel.activeSelf) {
|
||||
currentInventoryObjectWeightPanel.SetActive (false);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateInventoryWeight ()
|
||||
{
|
||||
if (!useInventoryWeightEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gameObject.activeInHierarchy) {
|
||||
useInventoryWeightEnabled = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (updateFullInventoryWeightCoroutine != null) {
|
||||
StopCoroutine (updateFullInventoryWeightCoroutine);
|
||||
}
|
||||
|
||||
updateFullInventoryWeightCoroutine = StartCoroutine (updateInventoryWeightCoroutine ());
|
||||
}
|
||||
|
||||
IEnumerator updateInventoryWeightCoroutine ()
|
||||
{
|
||||
yield return new WaitForSeconds (0.01f);
|
||||
|
||||
currentTotalWeight = 0;
|
||||
|
||||
for (int i = 0; i < mainInventoryManager.inventoryList.Count; i++) {
|
||||
float currentObjectWeight = mainInventoryManager.inventoryList [i].weight;
|
||||
|
||||
if (mainInventoryManager.inventoryList [i].storeTotalAmountPerUnit) {
|
||||
int currentObjectAmountPerUnit = mainInventoryManager.getInventoryObjectAmountPerUnitByName (mainInventoryManager.inventoryList [i].Name);
|
||||
|
||||
if (currentObjectAmountPerUnit > 0) {
|
||||
currentObjectWeight /= currentObjectAmountPerUnit;
|
||||
}
|
||||
}
|
||||
|
||||
currentTotalWeight += mainInventoryManager.inventoryList [i].amount * currentObjectWeight;
|
||||
}
|
||||
|
||||
if (weightLimitReached) {
|
||||
weightLimitReachedPreviously = true;
|
||||
}
|
||||
|
||||
if (useInventoryWeightLimit) {
|
||||
if (currentTotalWeight > inventoryWeightLimit) {
|
||||
weightLimitReached = true;
|
||||
} else {
|
||||
weightLimitReached = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (weightLimitReached) {
|
||||
evenOnWeightLimitReached.Invoke ();
|
||||
} else {
|
||||
if (weightLimitReachedPreviously) {
|
||||
eventOnRegularWeight.Invoke ();
|
||||
}
|
||||
}
|
||||
|
||||
string totalInventoryWeightString = currentTotalWeight.ToString ("F1");
|
||||
|
||||
if (useInventoryWeightLimit) {
|
||||
totalInventoryWeightString += " / " + inventoryWeightLimit + " " + weightUnit;
|
||||
}
|
||||
|
||||
totalInventoryWeightText.text = totalInventoryWeightString;
|
||||
|
||||
if (useInventoryWeightLimit) {
|
||||
totalInventoryWeightSlider.maxValue = inventoryWeightLimit;
|
||||
|
||||
totalInventoryWeightSlider.value = currentTotalWeight;
|
||||
}
|
||||
}
|
||||
|
||||
public int checkIfCanCarryObjectWeight (inventoryInfo inventoryInfoToCheck)
|
||||
{
|
||||
if (!useInventoryWeightEnabled) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
float currentObjectWeight = inventoryInfoToCheck.weight;
|
||||
|
||||
if (inventoryInfoToCheck.storeTotalAmountPerUnit) {
|
||||
int currentObjectAmountPerUnit = mainInventoryManager.getInventoryObjectAmountPerUnitByName (inventoryInfoToCheck.Name);
|
||||
|
||||
if (currentObjectAmountPerUnit > 0) {
|
||||
currentObjectWeight /= currentObjectAmountPerUnit;
|
||||
}
|
||||
}
|
||||
|
||||
float newExtraWeight = inventoryInfoToCheck.amount * currentObjectWeight;
|
||||
|
||||
if (newExtraWeight + currentTotalWeight < inventoryWeightLimit) {
|
||||
return inventoryInfoToCheck.amount;
|
||||
} else {
|
||||
float weightSpaceFree = inventoryWeightLimit - currentTotalWeight;
|
||||
|
||||
int amountWhichCanBeTaken = (int)(weightSpaceFree / currentObjectWeight);
|
||||
|
||||
return amountWhichCanBeTaken;
|
||||
}
|
||||
}
|
||||
|
||||
public bool checkIfCanCarrySingleObjectWeight (inventoryInfo inventoryInfoToCheck)
|
||||
{
|
||||
if (!useMaxObjectWeightToPick) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!useInventoryWeightEnabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
float currentObjectWeight = inventoryInfoToCheck.weight;
|
||||
|
||||
if (inventoryInfoToCheck.storeTotalAmountPerUnit) {
|
||||
int currentObjectAmountPerUnit = mainInventoryManager.getInventoryObjectAmountPerUnitByName (inventoryInfoToCheck.Name);
|
||||
|
||||
if (currentObjectAmountPerUnit > 0) {
|
||||
currentObjectWeight /= currentObjectAmountPerUnit;
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("object weight " + currentObjectWeight);
|
||||
}
|
||||
|
||||
if (currentObjectWeight > maxObjectWeightToPick) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void initializeInventoryWeightLimitAmount (float newValue)
|
||||
{
|
||||
inventoryWeightLimit = newValue;
|
||||
}
|
||||
|
||||
public void increaseInventoryWeightLimitAmount (float newValue)
|
||||
{
|
||||
inventoryWeightLimit += newValue;
|
||||
|
||||
updateInventoryWeight ();
|
||||
}
|
||||
|
||||
public void updateInventoryWeightLimitAmountWithoutUpdatingStatManager (int statId, float amount)
|
||||
{
|
||||
inventoryWeightLimit = amount;
|
||||
}
|
||||
|
||||
public void increaseInventoryBagWeight (float newValue)
|
||||
{
|
||||
if (!useInventoryWeightEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
increaseInventoryWeightLimitAmount (newValue);
|
||||
|
||||
if (!hasPlayerStatsManager) {
|
||||
if (playerStatsManager != null) {
|
||||
hasPlayerStatsManager = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasPlayerStatsManager) {
|
||||
playerStatsManager.updateStatValue (inventoryWeightLimitStatName, inventoryWeightLimit);
|
||||
}
|
||||
}
|
||||
|
||||
public void setUseInventoryWeightEnabledState (bool state)
|
||||
{
|
||||
useInventoryWeightEnabled = state;
|
||||
}
|
||||
|
||||
public void setUseInventoryWeightEnabledStateFromEditor (bool state)
|
||||
{
|
||||
setUseInventoryWeightEnabledState (state);
|
||||
|
||||
updateComponent ();
|
||||
}
|
||||
|
||||
public void updateComponent ()
|
||||
{
|
||||
GKC_Utils.updateComponent (this);
|
||||
|
||||
GKC_Utils.updateDirtyScene ("Update inventory weight manager", gameObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 663397c012e54eb47b1fc69cee12591c
|
||||
timeCreated: 1565873998
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/inventoryWeightManager.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class meleeShieldInventoryPrefabCreationSystem : inventoryPrefabCreationSystem
|
||||
{
|
||||
public override void createInventoryPrefabObject ()
|
||||
{
|
||||
meleeShieldPickup currentMeleeShieldPickup = GetComponent<meleeShieldPickup> ();
|
||||
|
||||
inventoryObject currentInventoryObject = GetComponentInChildren<inventoryObject> ();
|
||||
|
||||
string newName = currentInventoryObject.inventoryObjectInfo.Name;
|
||||
|
||||
currentMeleeShieldPickup.setMeleeShieldName (newName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 860f3dccd40c16f47a720166ebbb0863
|
||||
timeCreated: 1617256350
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/meleeShieldInventoryPrefabCreationSystem.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class meleeWeaponConsumableInventoryPrefabCreationSystem : inventoryPrefabCreationSystem
|
||||
{
|
||||
public override void createInventoryPrefabObject ()
|
||||
{
|
||||
meleeWeaponConsumablePickup currentMeleeWeaponConsumablePickup = GetComponent<meleeWeaponConsumablePickup> ();
|
||||
|
||||
inventoryObject currentInventoryObject = GetComponentInChildren<inventoryObject> ();
|
||||
|
||||
string newName = currentInventoryObject.inventoryObjectInfo.Name;
|
||||
|
||||
currentMeleeWeaponConsumablePickup.setWeaponConsumableName (newName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 178e7c9b90b03714d9dd280958e25b76
|
||||
timeCreated: 1623454221
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/meleeWeaponConsumableInventoryPrefabCreationSystem.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class meleeWeaponInventoryPrefabCreationSystem : inventoryPrefabCreationSystem
|
||||
{
|
||||
public override void createInventoryPrefabObject ()
|
||||
{
|
||||
meleeWeaponPickup currentMeleeWeaponPickup = GetComponent<meleeWeaponPickup> ();
|
||||
|
||||
inventoryObject currentInventoryObject = GetComponentInChildren<inventoryObject> ();
|
||||
|
||||
string newName = currentInventoryObject.inventoryObjectInfo.Name;
|
||||
|
||||
currentMeleeWeaponPickup.setMeleeWeaponName (newName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d65c2b003ea7d0349bf5f9d3d5f18ce9
|
||||
timeCreated: 1611325454
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Inventory/meleeWeaponInventoryPrefabCreationSystem.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,325 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using UnityEngine.UI;
|
||||
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class playerInventoryCategoriesListManager : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public Color categorySelectedIconColor;
|
||||
public Color categorUnSelectedIconColor;
|
||||
|
||||
[Space]
|
||||
[Header ("Category Info List Settings")]
|
||||
[Space]
|
||||
|
||||
public List<categoryInfo> categoryInfoList = new List<categoryInfo> ();
|
||||
|
||||
[Space]
|
||||
[Header ("Debug")]
|
||||
[Space]
|
||||
|
||||
public bool categoryListPanelActive;
|
||||
public bool selectingMultipleCategories;
|
||||
public List<string> categoriesStringList = new List<string> ();
|
||||
|
||||
[Space]
|
||||
[Header ("Events Settings")]
|
||||
[Space]
|
||||
|
||||
public UnityEvent eventOnCategoriesPanelOpened;
|
||||
public UnityEvent eventOnCategoriesPanelClosed;
|
||||
|
||||
[Space]
|
||||
[Header ("Components")]
|
||||
[Space]
|
||||
|
||||
public GameObject categoryListPanel;
|
||||
|
||||
public RectTransform inventoryListPanel;
|
||||
|
||||
public RectTransform inventoryListPanelScaleOnCategoryOpened;
|
||||
|
||||
public RectTransform inventoryListPanelScaleOnCategoryClosed;
|
||||
|
||||
public inventoryManager mainInventoryManager;
|
||||
|
||||
public Scrollbar inventorySlotsScrollbar;
|
||||
|
||||
public RawImage combineCategoriesIcon;
|
||||
|
||||
categoryInfo currentCategoryInfo;
|
||||
|
||||
void Start ()
|
||||
{
|
||||
if (categoryListPanel.activeSelf) {
|
||||
categoryListPanel.SetActive (false);
|
||||
}
|
||||
}
|
||||
|
||||
public void selectInventoryCategoryList (List<string> categoryNameList)
|
||||
{
|
||||
if (!selectingMultipleCategories) {
|
||||
enableSelectingMultipleCategories ();
|
||||
}
|
||||
|
||||
for (int i = 0; i < categoryNameList.Count; i++) {
|
||||
selectInventoryCategory (categoryNameList[i]);
|
||||
}
|
||||
}
|
||||
public void selectInventoryCategory (string categoryName)
|
||||
{
|
||||
List<inventoryInfo> inventoryList = mainInventoryManager.inventoryList;
|
||||
|
||||
int inventoryListCount = inventoryList.Count;
|
||||
|
||||
if (selectingMultipleCategories) {
|
||||
for (int i = 0; i < categoryInfoList.Count; i++) {
|
||||
currentCategoryInfo = categoryInfoList[i];
|
||||
|
||||
if (currentCategoryInfo.Name == categoryName) {
|
||||
currentCategoryInfo.categorySelected = !currentCategoryInfo.categorySelected;
|
||||
|
||||
if (currentCategoryInfo.categoryLowerIcon.activeSelf != currentCategoryInfo.categorySelected) {
|
||||
currentCategoryInfo.categoryLowerIcon.SetActive (currentCategoryInfo.categorySelected);
|
||||
}
|
||||
|
||||
if (currentCategoryInfo.categorySelected) {
|
||||
currentCategoryInfo.categoryButtonIcon.color = categorySelectedIconColor;
|
||||
|
||||
if (!categoriesStringList.Contains (categoryName)) {
|
||||
categoriesStringList.Add (categoryName);
|
||||
}
|
||||
} else {
|
||||
currentCategoryInfo.categoryButtonIcon.color = categorUnSelectedIconColor;
|
||||
|
||||
if (categoriesStringList.Contains (categoryName)) {
|
||||
categoriesStringList.Remove (categoryName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < inventoryListCount; i++) {
|
||||
if (inventoryList[i] != null && inventoryList[i].inventoryGameObject != null && !inventoryList[i].hideSlotOnMenu) {
|
||||
if (categoriesStringList.Contains (inventoryList[i].categoryName)) {
|
||||
if (!inventoryList[i].button.gameObject.activeSelf) {
|
||||
inventoryList[i].button.gameObject.SetActive (true);
|
||||
}
|
||||
} else {
|
||||
if (inventoryList[i].button.gameObject.activeSelf) {
|
||||
inventoryList[i].button.gameObject.SetActive (false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (inventoryList[i].button.gameObject.activeSelf) {
|
||||
inventoryList[i].button.gameObject.SetActive (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < inventoryListCount; i++) {
|
||||
if (inventoryList[i] != null && inventoryList[i].inventoryGameObject != null && !inventoryList[i].hideSlotOnMenu) {
|
||||
if (inventoryList[i].categoryName.Equals (categoryName)) {
|
||||
if (!inventoryList[i].button.gameObject.activeSelf) {
|
||||
inventoryList[i].button.gameObject.SetActive (true);
|
||||
}
|
||||
} else {
|
||||
if (inventoryList[i].button.gameObject.activeSelf) {
|
||||
inventoryList[i].button.gameObject.SetActive (false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (inventoryList[i].button.gameObject.activeSelf) {
|
||||
inventoryList[i].button.gameObject.SetActive (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < categoryInfoList.Count; i++) {
|
||||
currentCategoryInfo = categoryInfoList[i];
|
||||
|
||||
if (currentCategoryInfo.Name.Equals (categoryName)) {
|
||||
if (!currentCategoryInfo.categorySelected) {
|
||||
currentCategoryInfo.categorySelected = true;
|
||||
|
||||
if (currentCategoryInfo.categoryLowerIcon.activeSelf != currentCategoryInfo.categorySelected) {
|
||||
currentCategoryInfo.categoryLowerIcon.SetActive (currentCategoryInfo.categorySelected);
|
||||
}
|
||||
|
||||
if (currentCategoryInfo.categorySelected) {
|
||||
currentCategoryInfo.categoryButtonIcon.color = categorySelectedIconColor;
|
||||
} else {
|
||||
currentCategoryInfo.categoryButtonIcon.color = categorUnSelectedIconColor;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
currentCategoryInfo.categorySelected = false;
|
||||
|
||||
if (currentCategoryInfo.categoryLowerIcon.activeSelf) {
|
||||
currentCategoryInfo.categoryLowerIcon.SetActive (false);
|
||||
}
|
||||
|
||||
currentCategoryInfo.categoryButtonIcon.color = categorUnSelectedIconColor;
|
||||
}
|
||||
}
|
||||
|
||||
categoriesStringList.Clear ();
|
||||
}
|
||||
|
||||
resetScroll ();
|
||||
|
||||
mainInventoryManager.setInventoryOptionsOnSlotPanelActiveState (false);
|
||||
}
|
||||
|
||||
public void enableOrDisableCategoryListPanel ()
|
||||
{
|
||||
categoryListPanelActive = !categoryListPanelActive;
|
||||
|
||||
updateInventoryListPanelPosition ();
|
||||
}
|
||||
|
||||
public void enableCategoryListPanel ()
|
||||
{
|
||||
categoryListPanelActive = true;
|
||||
|
||||
updateInventoryListPanelPosition ();
|
||||
}
|
||||
|
||||
public void disableCategoryListPanel ()
|
||||
{
|
||||
categoryListPanelActive = false;
|
||||
|
||||
updateInventoryListPanelPosition ();
|
||||
}
|
||||
|
||||
public void updateInventoryListPanelPosition ()
|
||||
{
|
||||
if (categoryListPanelActive) {
|
||||
eventOnCategoriesPanelOpened.Invoke ();
|
||||
} else {
|
||||
eventOnCategoriesPanelClosed.Invoke ();
|
||||
}
|
||||
|
||||
if (categoryListPanel.activeSelf != categoryListPanelActive) {
|
||||
categoryListPanel.SetActive (categoryListPanelActive);
|
||||
}
|
||||
|
||||
if (categoryListPanelActive) {
|
||||
|
||||
inventoryListPanel.anchoredPosition = inventoryListPanelScaleOnCategoryOpened.anchoredPosition;
|
||||
|
||||
inventoryListPanel.sizeDelta = inventoryListPanelScaleOnCategoryOpened.sizeDelta;
|
||||
} else {
|
||||
inventoryListPanel.anchoredPosition = inventoryListPanelScaleOnCategoryClosed.anchoredPosition;
|
||||
|
||||
inventoryListPanel.sizeDelta = inventoryListPanelScaleOnCategoryClosed.sizeDelta;
|
||||
|
||||
enableAllCategories ();
|
||||
|
||||
if (selectingMultipleCategories) {
|
||||
enableOrDisableSelectingMultipleCategories ();
|
||||
} else {
|
||||
disableAllCategoriesIcons ();
|
||||
}
|
||||
|
||||
categoriesStringList.Clear ();
|
||||
}
|
||||
|
||||
resetScroll ();
|
||||
|
||||
mainInventoryManager.setInventoryOptionsOnSlotPanelActiveState (false);
|
||||
}
|
||||
|
||||
public void enableAllCategories ()
|
||||
{
|
||||
int inventoryListCount = mainInventoryManager.inventoryList.Count;
|
||||
|
||||
for (int i = 0; i < inventoryListCount; i++) {
|
||||
if (!mainInventoryManager.inventoryList[i].button.gameObject.activeSelf && !mainInventoryManager.inventoryList[i].hideSlotOnMenu) {
|
||||
mainInventoryManager.inventoryList[i].button.gameObject.SetActive (true);
|
||||
}
|
||||
}
|
||||
|
||||
mainInventoryManager.setInventoryOptionsOnSlotPanelActiveState (false);
|
||||
}
|
||||
|
||||
public void enableSelectingMultipleCategories ()
|
||||
{
|
||||
selectingMultipleCategories = false;
|
||||
|
||||
enableOrDisableSelectingMultipleCategories ();
|
||||
}
|
||||
|
||||
public void disableSelectingMultipleCategories ()
|
||||
{
|
||||
selectingMultipleCategories = true;
|
||||
|
||||
enableOrDisableSelectingMultipleCategories ();
|
||||
}
|
||||
public void enableOrDisableSelectingMultipleCategories ()
|
||||
{
|
||||
selectingMultipleCategories = !selectingMultipleCategories;
|
||||
|
||||
if (selectingMultipleCategories) {
|
||||
combineCategoriesIcon.color = categorySelectedIconColor;
|
||||
|
||||
for (int i = 0; i < categoryInfoList.Count; i++) {
|
||||
if (categoryInfoList[i].categorySelected) {
|
||||
if (!categoriesStringList.Contains (categoryInfoList[i].Name)) {
|
||||
categoriesStringList.Add (categoryInfoList[i].Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
combineCategoriesIcon.color = categorUnSelectedIconColor;
|
||||
|
||||
if (!categoryListPanelActive) {
|
||||
disableAllCategoriesIcons ();
|
||||
}
|
||||
}
|
||||
|
||||
mainInventoryManager.setInventoryOptionsOnSlotPanelActiveState (false);
|
||||
}
|
||||
|
||||
public void disableAllCategoriesIcons ()
|
||||
{
|
||||
for (int i = 0; i < categoryInfoList.Count; i++) {
|
||||
categoryInfoList[i].categorySelected = false;
|
||||
|
||||
if (categoryInfoList[i].categoryLowerIcon.activeSelf) {
|
||||
categoryInfoList[i].categoryLowerIcon.SetActive (categoryInfoList[i].categorySelected);
|
||||
}
|
||||
|
||||
categoryInfoList[i].categoryButtonIcon.color = categorUnSelectedIconColor;
|
||||
}
|
||||
}
|
||||
|
||||
public void resetScroll ()
|
||||
{
|
||||
StartCoroutine (resetScrollCoroutine ());
|
||||
}
|
||||
|
||||
private IEnumerator resetScrollCoroutine ()
|
||||
{
|
||||
inventorySlotsScrollbar.value = 0;
|
||||
|
||||
yield return null;
|
||||
|
||||
inventorySlotsScrollbar.value = 1;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class categoryInfo
|
||||
{
|
||||
public string Name;
|
||||
public RawImage categoryButtonIcon;
|
||||
public GameObject categoryLowerIcon;
|
||||
public bool categorySelected;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user