add ckg
plantilla base para movimiento básico
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user