add some extra assets FX and SFX
This commit is contained in:
@@ -40,6 +40,8 @@ public class inventoryManager : inventoryManagerInfo
|
||||
public bool infiniteAmountPerSlot;
|
||||
public int amountPerSlot;
|
||||
|
||||
public bool ignoreMaximumObjectAmount;
|
||||
|
||||
public bool dropSingleObjectOnInfiniteAmount = true;
|
||||
|
||||
public bool useInventoryCameraEnabled = true;
|
||||
@@ -85,6 +87,10 @@ public class inventoryManager : inventoryManagerInfo
|
||||
[TextArea (1, 10)]
|
||||
public string objectTooMuchHeavyToCarryMessage;
|
||||
|
||||
public float maxObjectAmountReachedMessageTime = 2;
|
||||
[TextArea (1, 10)]
|
||||
public string maxObjectAmountReachedMessage = "Can't store more units of this object";
|
||||
|
||||
public bool checkWeightLimitToPickObjects;
|
||||
public inventoryWeightManager mainInventoryWeightManager;
|
||||
|
||||
@@ -104,6 +110,8 @@ public class inventoryManager : inventoryManagerInfo
|
||||
public bool useMaxNumberOfWeaponsToEquip;
|
||||
public int maxNumberOfWeaponsToEquip;
|
||||
|
||||
public bool takeAmmoFromWeaponsAlreadyCarried;
|
||||
|
||||
[TextArea (1, 10)]
|
||||
public string maxNumberOfWeaponsEquippedMessage;
|
||||
|
||||
@@ -266,6 +274,8 @@ public class inventoryManager : inventoryManagerInfo
|
||||
GameObject previousMessagePanel;
|
||||
pickUpObject currentPickupObject;
|
||||
|
||||
GameObject currentPickupGameObject;
|
||||
|
||||
public float distanceToPlaceObjectInCamera = 10;
|
||||
public float placeObjectInCameraSpeed = 10;
|
||||
public int numberOfRotationsObjectInCamera = 3;
|
||||
@@ -1036,6 +1046,11 @@ public class inventoryManager : inventoryManagerInfo
|
||||
}
|
||||
}
|
||||
|
||||
public bool isInitializingInventory ()
|
||||
{
|
||||
return initializingInventory;
|
||||
}
|
||||
|
||||
public bool isInventoryEmpty ()
|
||||
{
|
||||
if (inventoryList.Count == 0) {
|
||||
@@ -1405,6 +1420,94 @@ public class inventoryManager : inventoryManagerInfo
|
||||
|
||||
bool canCheckToPickupObject = false;
|
||||
|
||||
if (takeAmmoFromWeaponsAlreadyCarried) {
|
||||
if (showDebugPrint) {
|
||||
print ("take ammo from fire weapons already carried active, checking pickup info");
|
||||
}
|
||||
|
||||
if (inventoryObjectToPickup.isWeapon && !inventoryObjectToPickup.isMeleeWeapon) {
|
||||
if (showDebugPrint) {
|
||||
print ("pickup found is a fire weapon, checking info");
|
||||
}
|
||||
|
||||
if (getInventoryObjectAmountByName (inventoryObjectToPickup.Name) >= 1) {
|
||||
if (showDebugPrint) {
|
||||
print ("trying to get a fire weapon already carried, getting ammo info");
|
||||
}
|
||||
|
||||
if (currentPickupGameObject != null) {
|
||||
bool removePickupResult = false;
|
||||
|
||||
weaponOnInventory currentWeaponOnInventory = currentPickupGameObject.GetComponentInChildren<weaponOnInventory> ();
|
||||
|
||||
int currentWeaponRemainingAmmo = currentWeaponOnInventory.getRemainingAmmoValue ();
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("found weapon has ammo on it, checking info " + currentWeaponRemainingAmmo);
|
||||
}
|
||||
|
||||
if (currentWeaponRemainingAmmo > 0 || currentWeaponRemainingAmmo == -1) {
|
||||
weaponPickup currentWeaponPickup = currentWeaponOnInventory.getWeaponPickup ();
|
||||
|
||||
if (currentWeaponPickup != null) {
|
||||
string currentWeaponPickupName = currentWeaponPickup.getWeaponName ();
|
||||
|
||||
if (currentWeaponPickupName != "") {
|
||||
string currentWeaponAmmoName = weaponsManager.getWeaponAmmoNameByWeaponName (currentWeaponPickupName);
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("weapon ammo name " + currentWeaponAmmoName);
|
||||
}
|
||||
|
||||
if (currentWeaponAmmoName != "") {
|
||||
if (currentWeaponRemainingAmmo == -1) {
|
||||
currentWeaponRemainingAmmo = weaponsManager.getWeaponOriginalClipSize (currentWeaponPickupName);
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("weapon ammo amount is -1, checking for the original weapon clip size " + currentWeaponRemainingAmmo);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentWeaponRemainingAmmo > 0) {
|
||||
inventoryInfo newAmmoInventoryInfo = getInventoryInfoByName (currentWeaponAmmoName);
|
||||
|
||||
newAmmoInventoryInfo.amount = currentWeaponRemainingAmmo;
|
||||
|
||||
tryToPickUpObject (newAmmoInventoryInfo);
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("getting ammo from weapon " + currentWeaponPickupName + " " + currentWeaponAmmoName + " " + currentWeaponRemainingAmmo);
|
||||
}
|
||||
|
||||
removePickupResult = true;
|
||||
|
||||
currentWeaponPickup.showPickupTakenMessage (currentWeaponAmmoName + " x " + currentWeaponRemainingAmmo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
removePickupResult = true;
|
||||
}
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("remove pickup result " + removePickupResult);
|
||||
}
|
||||
|
||||
if (removePickupResult) {
|
||||
pickUpObject temporalPickupObject = currentPickupGameObject.GetComponent<pickUpObject> ();
|
||||
|
||||
if (temporalPickupObject != null) {
|
||||
temporalPickupObject.setIgnoreMessagesAndDestroyPickupActiveState (true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Check for the weight of the objects to pick
|
||||
if (checkWeightLimitToPickObjects && mainInventoryWeightManager != null) {
|
||||
int amountWhichCanBeTaken = mainInventoryWeightManager.checkIfCanCarryObjectWeight (currentPickUpObjectInfo);
|
||||
@@ -1441,7 +1544,7 @@ public class inventoryManager : inventoryManagerInfo
|
||||
canCheckToPickupObject = false;
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("object too much heavy");
|
||||
print ("object too heavy");
|
||||
}
|
||||
|
||||
objectWeightMessage = objectTooMuchHeavyToCarryMessage;
|
||||
@@ -1472,6 +1575,57 @@ public class inventoryManager : inventoryManagerInfo
|
||||
canCheckToPickupObject = true;
|
||||
}
|
||||
|
||||
if (!ignoreMaximumObjectAmount) {
|
||||
if (canCheckToPickupObject) {
|
||||
//check first if there are more units of the object to store and how much
|
||||
int currentUnitsOfObjectOnInventory = getInventoryObjectAmountByName (currentPickUpObjectInfo.Name);
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("currentUnitsOfObjectOnInventory " + currentUnitsOfObjectOnInventory);
|
||||
}
|
||||
|
||||
if (currentPickUpObjectInfo.setMaximumObjectAmount) {
|
||||
if (currentUnitsOfObjectOnInventory <= -1) {
|
||||
if (showDebugPrint) {
|
||||
print ("no units carried from this object yet");
|
||||
}
|
||||
|
||||
currentUnitsOfObjectOnInventory = 0;
|
||||
}
|
||||
|
||||
if (currentUnitsOfObjectOnInventory >= currentPickUpObjectInfo.maximumObjectAmount) {
|
||||
if (showDebugPrint) {
|
||||
print ("can't take more units of this object, cancelling pickup");
|
||||
}
|
||||
|
||||
canCheckToPickupObject = false;
|
||||
|
||||
amountToTake = 0;
|
||||
|
||||
inventoryAmountNotTaken = currentPickUpObjectInfo.amount;
|
||||
} else {
|
||||
int maxAmountToTake = currentPickUpObjectInfo.maximumObjectAmount - currentUnitsOfObjectOnInventory;
|
||||
|
||||
if (amountToTake > maxAmountToTake) {
|
||||
int amountToRemove = amountToTake - maxAmountToTake;
|
||||
|
||||
amountToTake -= amountToRemove;
|
||||
|
||||
inventoryAmountNotTaken += amountToRemove;
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("maxAmountToTake " + maxAmountToTake + " amountToRemove " + amountToRemove);
|
||||
}
|
||||
} else {
|
||||
if (showDebugPrint) {
|
||||
print ("object can be taken without reaching max amount");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (canCheckToPickupObject) {
|
||||
if (infiniteAmountPerSlot) {
|
||||
addAmountToInventorySlot (currentPickUpObjectInfo, -1, amountToTake);
|
||||
@@ -2458,6 +2612,11 @@ public class inventoryManager : inventoryManagerInfo
|
||||
checkEventOnClickInventoryChange ();
|
||||
}
|
||||
|
||||
public bool isIgnoreMaximumObjectAmountActive ()
|
||||
{
|
||||
return ignoreMaximumObjectAmount;
|
||||
}
|
||||
|
||||
public bool isCurrentObjectNotNull ()
|
||||
{
|
||||
if (currentInventoryObject != null) {
|
||||
@@ -2718,7 +2877,8 @@ public class inventoryManager : inventoryManagerInfo
|
||||
if (objectIsMeleeWeapon) {
|
||||
if (initializingInventory) {
|
||||
if (mainMeleeWeaponsGrabbedManager.isDrawWeaponAtStartIfFoundOnInitializingInventoryActive () &&
|
||||
!mainMeleeWeaponsGrabbedManager.characterIsCarryingWeapon () && mainMeleeWeaponsGrabbedManager.meleeWeaponsGrabbedManagerActive) {
|
||||
!mainMeleeWeaponsGrabbedManager.characterIsCarryingWeapon () &&
|
||||
mainMeleeWeaponsGrabbedManager.isMeleeWeaponsGrabbedManagerActive ()) {
|
||||
drawMeleeWeaponAtStart = true;
|
||||
}
|
||||
}
|
||||
@@ -2730,7 +2890,6 @@ public class inventoryManager : inventoryManagerInfo
|
||||
mainMeleeWeaponsGrabbedManager.enableOrDisableMeleeWeaponMeshOnCharacterBodyByNameAndInstantiateMesh (true, currentInventoryObject.Name);
|
||||
}
|
||||
}
|
||||
//grabPhysicalObjectMeleeAttackSystem currentGrabPhysicalObjectMeleeAttackSystem = mainMeleeWeaponsGrabbedManager.getWeaponGrabbedByName (currentInventoryObject.Name);
|
||||
}
|
||||
|
||||
if (equippedCorrectly) {
|
||||
@@ -2748,11 +2907,35 @@ public class inventoryManager : inventoryManagerInfo
|
||||
print ("equipping regular object, like the future armor/cloth system");
|
||||
}
|
||||
|
||||
bool checkMeleeShieldToIgnoreDraw = false;
|
||||
|
||||
if (isMeleeShield && initializingInventory) {
|
||||
if (!mainMeleeWeaponsGrabbedManager.isDrawWeaponAtStartIfFoundOnInitializingInventoryActive () ||
|
||||
!mainMeleeWeaponsGrabbedManager.isMeleeWeaponsGrabbedManagerActive ()) {
|
||||
|
||||
checkMeleeShieldToIgnoreDraw = true;
|
||||
|
||||
mainMeleeWeaponsGrabbedManager.setUseEquipShieldCheckWhenActivatingShieldState (true);
|
||||
}
|
||||
}
|
||||
|
||||
checkIfEquippingArmorClothObjectOnSlotAlreadyOccupied ();
|
||||
|
||||
inventoryObject currentInventoryObjectToUse = getInventoryObjectComponentByInventoryGameObject (currentInventoryObject.inventoryGameObject);
|
||||
|
||||
equippedCorrectly = currentInventoryObjectToUse.setObjectEquippedStateOnInventoryOnNewBehavior (gameObject, true);
|
||||
|
||||
if (checkMeleeShieldToIgnoreDraw && equippedCorrectly) {
|
||||
string shieldName = mainMeleeWeaponsGrabbedManager.getCurrentShieldName ();
|
||||
|
||||
if (shieldName == null || shieldName == "") {
|
||||
shieldName = currentInventoryObject.Name;
|
||||
}
|
||||
|
||||
//print ("check if the shield should be drawed or not");
|
||||
|
||||
mainMeleeWeaponsGrabbedManager.drawOrSheatheShield (false, shieldName, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (equippedCorrectly) {
|
||||
@@ -2922,7 +3105,7 @@ public class inventoryManager : inventoryManagerInfo
|
||||
}
|
||||
}
|
||||
|
||||
if (objectIsWeapon) {
|
||||
if (objectIsWeapon || isMeleeShield) {
|
||||
showWeaponSlotsParentWhenWeaponSelectedByName (currentInventoryObject.Name);
|
||||
}
|
||||
}
|
||||
@@ -2997,6 +3180,21 @@ public class inventoryManager : inventoryManagerInfo
|
||||
eventOnInventoryObjectEquipped.Invoke (currentInventoryObject.Name);
|
||||
}
|
||||
}
|
||||
|
||||
if (!equippedCorrectly) {
|
||||
inventoryObject currentInventoryObjectToUse = getInventoryObjectComponentByInventoryGameObject (currentInventoryObject.inventoryGameObject);
|
||||
|
||||
string customMessageOnNotAbleToEquip = currentInventoryObjectToUse.getCustomMessageOnNotAbleToEquip ();
|
||||
|
||||
if (customMessageOnNotAbleToEquip != "") {
|
||||
|
||||
string currentInventoryObjectName = inventoryLocalizationManager.GetLocalizedValue (currentInventoryObject.Name);
|
||||
|
||||
customMessageOnNotAbleToEquip = customMessageOnNotAbleToEquip.Replace ("-OBJECT-", currentInventoryObjectName);
|
||||
|
||||
showObjectMessage (customMessageOnNotAbleToEquip, usedObjectMessageTime, usedObjectMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3186,6 +3384,17 @@ public class inventoryManager : inventoryManagerInfo
|
||||
}
|
||||
}
|
||||
|
||||
public void setCurrentInventoryObjectAndUnequipByName (string objectToUnequipName)
|
||||
{
|
||||
inventoryInfo currentInventoryInfo = getPlayerInventoryInfoByName (objectToUnequipName);
|
||||
|
||||
if (currentInventoryInfo != null) {
|
||||
setCurrentInventoryObject (currentInventoryInfo);
|
||||
|
||||
unEquipCurrentObject ();
|
||||
}
|
||||
}
|
||||
|
||||
public void unEquipObjectByName (string objectToUnequipName)
|
||||
{
|
||||
int inventoryListCount = inventoryList.Count;
|
||||
@@ -3228,10 +3437,10 @@ public class inventoryManager : inventoryManagerInfo
|
||||
if (updateQuickAccessInventorySlots) {
|
||||
bool isCustomizingCharacterActive = mainInventoryQuickAccessSlotsSystem.isCustomizingCharacterActive ();
|
||||
|
||||
bool isArmorClothAccessory = currentInventoryObject.isArmorClothAccessory;
|
||||
bool isArmorClothAccessory = currentInventoryInfo.isArmorClothAccessory;
|
||||
|
||||
if (isArmorClothAccessory) {
|
||||
inventoryObjectPrefabObtained = mainInventoryListManager.getInventoryPrefabByName (currentInventoryObject.Name);
|
||||
inventoryObjectPrefabObtained = mainInventoryListManager.getInventoryPrefabByName (currentInventoryInfo.Name);
|
||||
|
||||
if (inventoryObjectPrefabObtained != null) {
|
||||
armorClothPickup newPickup = inventoryObjectPrefabObtained.GetComponent<armorClothPickup> ();
|
||||
@@ -4210,6 +4419,11 @@ public class inventoryManager : inventoryManagerInfo
|
||||
currentPickupObject = newPickupObject;
|
||||
}
|
||||
|
||||
public void setCurrentPickupGameObject (GameObject newObject)
|
||||
{
|
||||
currentPickupGameObject = newObject;
|
||||
}
|
||||
|
||||
public void setObjectInfo (inventoryInfo currentInventoryObjectInfo)
|
||||
{
|
||||
resetAndDisableNumberOfObjectsToUseMenu ();
|
||||
@@ -6054,6 +6268,17 @@ public class inventoryManager : inventoryManagerInfo
|
||||
mainInventoryMenuPanelsSystem.setInventoryPanelByName (panelInfo);
|
||||
}
|
||||
|
||||
public void showMaxObjectAmountReachedMessage (string objectName)
|
||||
{
|
||||
string newMaxObjectAmountReachedMessage = maxObjectAmountReachedMessage;
|
||||
|
||||
if (objectName != "" && newMaxObjectAmountReachedMessage.Contains ("-OBJECT-")) {
|
||||
newMaxObjectAmountReachedMessage = newMaxObjectAmountReachedMessage.Replace ("-OBJECT-", objectName);
|
||||
}
|
||||
|
||||
showObjectMessage (newMaxObjectAmountReachedMessage, maxObjectAmountReachedMessageTime, usedObjectMessage);
|
||||
}
|
||||
|
||||
public void showInventoryFullMessage ()
|
||||
{
|
||||
if (inventoryFullCoroutine != null) {
|
||||
@@ -6167,6 +6392,7 @@ public class inventoryManager : inventoryManagerInfo
|
||||
|
||||
setOpenOrCloseInventoryMenuState ();
|
||||
}
|
||||
|
||||
public void openOrCloseInventory (bool state)
|
||||
{
|
||||
if (state) {
|
||||
|
||||
Reference in New Issue
Block a user