plantilla base para movimiento básico
This commit is contained in:
Robii Aragon
2026-02-05 05:07:55 -08:00
parent ed7b223c04
commit fd87a6ffd5
14441 changed files with 13711084 additions and 20 deletions

View File

@@ -0,0 +1,241 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class GKCConditionInfo : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool conditionCheckEnabled;
public bool searchPlayerOnSceneIfNotAssigned;
public LayerMask layermaskToCheck;
public bool checkConditionCompleteOnTriggerEnterEnabled = true;
[Space]
[Header ("Coroutine Settings")]
[Space]
public bool checkConditionOnCoroutine;
public bool stopCoroutineOnConditionComplete;
public bool stopCoroutineOnConditionNotComplete;
[Space]
[Header ("Events Settings")]
[Space]
public UnityEvent eventOnConditionComplete;
public UnityEvent eventOnConditionNotComplete;
[Space]
[Space]
public bool useEventOnTriggerEnter;
public UnityEvent eventOnTriggerEnter;
public bool useEventOnTriggerExit;
public UnityEvent eventOnTriggerExit;
[Space]
[Header ("Debug")]
[Space]
public bool showDebugPrint;
public bool checkConditionPaused;
public GameObject currentPlayer;
public bool coroutineUpdateInProcess;
bool playerAssignedProperly;
public void findPlayerOnScene ()
{
if (searchPlayerOnSceneIfNotAssigned) {
setCurrentPlayer (GKC_Utils.findMainPlayerOnScene ());
}
}
public bool checkIfPlayerAssigned ()
{
if (playerAssignedProperly) {
return true;
}
if (currentPlayer == null) {
findPlayerOnScene ();
if (currentPlayer == null) {
print ("WARNING: no player controller has been assigned to the mission." +
" Make sure to use a trigger to activate the mission or assign the player manually");
} else {
return true;
}
}
return false;
}
public virtual void setCurrentPlayer (GameObject newPlayer)
{
currentPlayer = newPlayer;
if (currentPlayer != null) {
playerAssignedProperly = true;
} else {
playerAssignedProperly = false;
}
}
public virtual void checkIfConditionComplete ()
{
}
public virtual bool checkIfConditionCompleteAndReturnResult ()
{
return false;
}
public void setConditionResult (bool state)
{
if (showDebugPrint) {
print ("Condition result: " + state);
}
if (state) {
eventOnConditionComplete.Invoke ();
} else {
eventOnConditionNotComplete.Invoke ();
}
if (state) {
if (stopCoroutineOnConditionComplete) {
if (checkConditionOnCoroutine) {
stopUpdateCoroutine ();
}
}
} else {
if (stopCoroutineOnConditionNotComplete) {
if (checkConditionOnCoroutine) {
stopUpdateCoroutine ();
}
}
}
}
void OnTriggerEnter (Collider col)
{
checkTriggerInfo (col, true);
}
void OnTriggerExit (Collider col)
{
checkTriggerInfo (col, false);
}
public void checkTriggerInfo (Collider col, bool isEnter)
{
if (!conditionCheckEnabled) {
return;
}
if (checkConditionPaused) {
return;
}
if ((1 << col.gameObject.layer & layermaskToCheck.value) == 1 << col.gameObject.layer) {
if (isEnter) {
setCurrentPlayer (col.gameObject);
playerComponentsManager mainPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
if (mainPlayerComponentsManager != null) {
GKCConditionSystem mainGKCConditionSystem = mainPlayerComponentsManager.getGKCConditionSystem ();
if (mainGKCConditionSystem != null) {
mainGKCConditionSystem.setCurrentGKCConditionInfo (this);
if (checkConditionCompleteOnTriggerEnterEnabled) {
if (checkConditionOnCoroutine) {
stopUpdateCoroutine ();
conditionCoroutine = StartCoroutine (updateCoroutine ());
} else {
mainGKCConditionSystem.checkIfConditionComplete ();
}
}
if (useEventOnTriggerEnter) {
eventOnTriggerEnter.Invoke ();
}
}
}
} else {
if (col.gameObject == currentPlayer) {
setCurrentPlayer (null);
checkFunctionOnTriggerExit ();
if (useEventOnTriggerExit) {
eventOnTriggerExit.Invoke ();
}
}
}
}
}
public void setCheckConditionPausedState (bool state)
{
checkConditionPaused = state;
}
public void stopUpdateCoroutine ()
{
if (conditionCoroutine != null) {
StopCoroutine (conditionCoroutine);
}
coroutineUpdateInProcess = false;
}
public virtual void checkFunctionOnTriggerExit ()
{
if (checkConditionOnCoroutine) {
stopUpdateCoroutine ();
}
}
public Coroutine conditionCoroutine;
IEnumerator updateCoroutine ()
{
var waitTime = new WaitForFixedUpdate ();
while (true) {
checkConditionOnUpdateState ();
coroutineUpdateInProcess = true;
yield return waitTime;
}
}
public virtual void checkConditionOnUpdateState ()
{
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: f5337ad6999838946bdd71a2510f6f24
timeCreated: 1621917267
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/Condition System/GKCConditionInfo.cs
uploadId: 814740

View File

@@ -0,0 +1,42 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GKCConditionSystem : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool conditionSystemEnabled = true;
[Space]
[Header ("Debug")]
[Space]
public GKCConditionInfo currentGKCConditionInfo;
public void setCurrentGKCConditionInfo (GKCConditionInfo newGKCConditionInfo)
{
if (!conditionSystemEnabled) {
return;
}
currentGKCConditionInfo = newGKCConditionInfo;
}
public void checkIfConditionComplete ()
{
if (!conditionSystemEnabled) {
return;
}
if (currentGKCConditionInfo != null) {
currentGKCConditionInfo.checkIfConditionComplete ();
}
}
public void refreshConditionSystemCheckStatus ()
{
checkIfConditionComplete ();
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 2b15f8af7649893449a8bad157cf5892
timeCreated: 1621916398
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/Condition System/GKCConditionSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,59 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GKCCurrencyConditionSystem : GKCConditionInfo
{
[Header ("Custom Settings")]
[Space]
public int amountToCheck;
public override bool checkIfConditionCompleteAndReturnResult ()
{
if (!checkIfPlayerAssigned ()) {
return false;
}
bool conditionResult = checkConditionResult ();
setConditionResult (conditionResult);
return conditionResult;
}
public override void checkIfConditionComplete ()
{
if (!checkIfPlayerAssigned ()) {
return;
}
bool conditionResult = checkConditionResult ();
setConditionResult (conditionResult);
}
bool checkConditionResult ()
{
bool conditionResult = false;
playerComponentsManager mainPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
if (mainPlayerComponentsManager != null) {
currencySystem mainCurrencySystem = mainPlayerComponentsManager.getCurrencySystem ();
if (mainCurrencySystem != null) {
bool currentConditionState = true;
if (mainCurrencySystem.getCurrentMoneyAmount () < amountToCheck) {
currentConditionState = false;
}
conditionResult = currentConditionState;
}
}
return conditionResult;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: d1cd44fa2b283914bb7be6b129e13264
timeCreated: 1633481784
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/Condition System/GKCCurrencyConditionSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,138 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GKCFireWeaponsConditionSystem : GKCConditionInfo
{
[Header ("Custom Settings")]
[Space]
public bool checkIfCarryinWeapon;
public bool checkIfCarryingWeaponByName;
public string weaponCarriedName;
public bool checkBothConditionsOnCoroutineUpdate;
[Space]
[Header ("Debug")]
[Space]
public bool currentConditionCompleteChecked;
public bool currentConditionNotCompleteChecked;
playerWeaponsManager mainPlayerWeaponsManager;
bool mainPlayerWeaponsManagerLocated;
public override bool checkIfConditionCompleteAndReturnResult ()
{
if (!checkIfPlayerAssigned ()) {
return false;
}
bool conditionResult = checkConditionResult ();
setConditionResult (conditionResult);
return conditionResult;
}
public override void checkIfConditionComplete ()
{
if (!checkIfPlayerAssigned ()) {
return;
}
bool conditionResult = checkConditionResult ();
setConditionResult (conditionResult);
}
public override void checkFunctionOnTriggerExit ()
{
base.checkFunctionOnTriggerExit ();
mainPlayerWeaponsManager = null;
mainPlayerWeaponsManagerLocated = false;
currentConditionNotCompleteChecked = false;
currentConditionCompleteChecked = false;
}
public override void checkConditionOnUpdateState ()
{
bool conditionResult = checkConditionResult ();
if (checkBothConditionsOnCoroutineUpdate) {
if (conditionResult) {
if (!currentConditionCompleteChecked) {
setConditionResult (true);
currentConditionCompleteChecked = true;
currentConditionNotCompleteChecked = false;
}
} else {
if (!currentConditionNotCompleteChecked) {
setConditionResult (false);
currentConditionNotCompleteChecked = true;
currentConditionCompleteChecked = false;
}
}
} else {
if (conditionResult) {
setConditionResult (true);
}
}
}
bool checkConditionResult ()
{
bool conditionResult = false;
if (!mainPlayerWeaponsManagerLocated) {
playerComponentsManager mainPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
if (mainPlayerComponentsManager != null) {
mainPlayerWeaponsManager = mainPlayerComponentsManager.getPlayerWeaponsManager ();
mainPlayerWeaponsManagerLocated = mainPlayerWeaponsManager != null;
}
}
if (mainPlayerWeaponsManagerLocated) {
bool currentConditionState = true;
if (checkIfCarryinWeapon) {
if (!mainPlayerWeaponsManager.isPlayerCarringWeapon ()) {
currentConditionState = false;
}
if (checkIfCarryingWeaponByName) {
if (currentConditionState) {
string currentWeaponName = mainPlayerWeaponsManager.getCurrentWeaponName ();
if (currentWeaponName != null && currentWeaponName != "") {
if (!currentWeaponName.Equals (weaponCarriedName)) {
currentConditionState = false;
}
} else {
currentConditionState = false;
}
}
}
}
conditionResult = currentConditionState;
}
return conditionResult;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 8d572dbd4c4836841b38b4e0464f2897
timeCreated: 1674122125
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/Condition System/GKCFireWeaponsConditionSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,109 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GKCInventoryConditionSystem : GKCConditionInfo
{
[Header ("Custom Settings")]
[Space]
public List<inventoryConditionInfo> inventoryConditionInfoList = new List<inventoryConditionInfo> ();
public bool checkIfInventoryIsEmpty;
public bool checkIfAnyWeaponIsEquipped;
public bool anyWeaponMustBeEquipped;
public override bool checkIfConditionCompleteAndReturnResult ()
{
if (!checkIfPlayerAssigned ()) {
return false;
}
bool conditionResult = checkConditionResult ();
setConditionResult (conditionResult);
return conditionResult;
}
public override void checkIfConditionComplete ()
{
if (!checkIfPlayerAssigned ()) {
return;
}
bool conditionResult = checkConditionResult ();
setConditionResult (conditionResult);
}
bool checkConditionResult ()
{
bool conditionResult = false;
playerComponentsManager mainPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
if (mainPlayerComponentsManager != null) {
inventoryManager mainInventoryManager = mainPlayerComponentsManager.getInventoryManager ();
if (mainInventoryManager != null) {
bool currentConditionState = true;
for (int i = 0; i < inventoryConditionInfoList.Count; i++) {
if (currentConditionState) {
bool objectLocated =
mainInventoryManager.getInventoryObjectAmountByName (inventoryConditionInfoList [i].inventoryObjectName) >=
inventoryConditionInfoList [i].inventoryAmount;
if (objectLocated) {
if (inventoryConditionInfoList [i].inventoryIsEquipped) {
if (!mainInventoryManager.checkIfInventoryObjectEquipped (inventoryConditionInfoList [i].inventoryObjectName)) {
currentConditionState = false;
}
}
} else {
if (inventoryConditionInfoList [i].inventoryAmount > 0) {
currentConditionState = false;
}
}
}
}
if (checkIfInventoryIsEmpty) {
if (!mainInventoryManager.isInventoryEmpty ()) {
currentConditionState = false;
}
}
if (checkIfAnyWeaponIsEquipped) {
bool isAnyInventoryWeaponEquipped = mainInventoryManager.isAnyInventoryWeaponEquipped ();
if (anyWeaponMustBeEquipped) {
if (!isAnyInventoryWeaponEquipped) {
currentConditionState = false;
}
} else {
if (isAnyInventoryWeaponEquipped) {
currentConditionState = false;
}
}
}
conditionResult = currentConditionState;
}
}
return conditionResult;
}
[System.Serializable]
public class inventoryConditionInfo
{
public string inventoryObjectName;
public int inventoryAmount;
public bool inventoryIsEquipped;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 3dc655125ab7ba644b9354120db73343
timeCreated: 1622016833
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/Condition System/GKCInventoryConditionSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,138 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GKCMeleeConditionSystem : GKCConditionInfo
{
[Header ("Custom Settings")]
[Space]
public bool checkIfCarryinWeapon;
public string weaponCarriedName;
public bool checkIfWeaponOnHand;
public bool checkIfWeaponSecondaryAbilityActive;
public bool checkBothConditionsOnCoroutineUpdate;
[Space]
[Header ("Debug")]
[Space]
public bool currentConditionCompleteChecked;
public bool currentConditionNotCompleteChecked;
grabbedObjectMeleeAttackSystem mainGrabbedObjectMeleeAttackSystem;
bool mainGrabbedObjectMeleeAttackSystemLocated;
public override bool checkIfConditionCompleteAndReturnResult ()
{
if (!checkIfPlayerAssigned ()) {
return false;
}
bool conditionResult = checkConditionResult ();
setConditionResult (conditionResult);
return conditionResult;
}
public override void checkIfConditionComplete ()
{
if (!checkIfPlayerAssigned ()) {
return;
}
bool conditionResult = checkConditionResult ();
setConditionResult (conditionResult);
}
public override void checkFunctionOnTriggerExit ()
{
base.checkFunctionOnTriggerExit ();
mainGrabbedObjectMeleeAttackSystem = null;
mainGrabbedObjectMeleeAttackSystemLocated = false;
currentConditionNotCompleteChecked = false;
currentConditionCompleteChecked = false;
}
public override void checkConditionOnUpdateState ()
{
bool conditionResult = checkConditionResult ();
if (checkBothConditionsOnCoroutineUpdate) {
if (conditionResult) {
if (!currentConditionCompleteChecked) {
setConditionResult (true);
currentConditionCompleteChecked = true;
currentConditionNotCompleteChecked = false;
}
} else {
if (!currentConditionNotCompleteChecked) {
setConditionResult (false);
currentConditionNotCompleteChecked = true;
currentConditionCompleteChecked = false;
}
}
} else {
if (conditionResult) {
setConditionResult (true);
}
}
}
bool checkConditionResult ()
{
bool conditionResult = false;
if (!mainGrabbedObjectMeleeAttackSystemLocated) {
playerComponentsManager mainPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
if (mainPlayerComponentsManager != null) {
mainGrabbedObjectMeleeAttackSystem = mainPlayerComponentsManager.getGrabbedObjectMeleeAttackSystem ();
mainGrabbedObjectMeleeAttackSystemLocated = mainGrabbedObjectMeleeAttackSystem != null;
}
}
if (mainGrabbedObjectMeleeAttackSystemLocated) {
bool currentConditionState = true;
if (checkIfCarryinWeapon) {
if (!mainGrabbedObjectMeleeAttackSystem.getCurrentMeleeWeaponName ().Equals (weaponCarriedName)) {
currentConditionState = false;
}
}
if (checkIfWeaponOnHand) {
if (!mainGrabbedObjectMeleeAttackSystem.isCarryingObject ()) {
currentConditionState = false;
}
}
if (checkIfWeaponSecondaryAbilityActive) {
if (!mainGrabbedObjectMeleeAttackSystem.isSecondaryAbilityActiveOnCurrentWeapon ()) {
currentConditionState = false;
}
}
conditionResult = currentConditionState;
}
return conditionResult;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 0dc60e7a7b58d5343ac002d6dc8a110f
timeCreated: 1621917138
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/Condition System/GKCMeleeConditionSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,77 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GKCVehicleConditionSystem : GKCConditionInfo
{
[Header ("Custom Settings")]
[Space]
public bool checkMaxSpeedToGetOn;
public float maxSpeedToGetOn;
public bool checkMaxSpeedToGetOff;
public float maxSpeedToGetOff;
public Rigidbody mainVehicleRigidbody;
public override bool checkIfConditionCompleteAndReturnResult ()
{
if (!conditionCheckEnabled) {
return false;
}
if (checkConditionPaused) {
return false;
}
bool conditionResult = checkConditionResult ();
setConditionResult (conditionResult);
return conditionResult;
}
public override void checkIfConditionComplete ()
{
if (!conditionCheckEnabled) {
return;
}
if (checkConditionPaused) {
return;
}
bool conditionResult = checkConditionResult ();
setConditionResult (conditionResult);
}
bool checkConditionResult ()
{
bool conditionResult = false;
bool currentConditionState = true;
if (checkMaxSpeedToGetOn) {
if (mainVehicleRigidbody != null) {
if (Mathf.Abs (mainVehicleRigidbody.linearVelocity.magnitude) > maxSpeedToGetOn) {
currentConditionState = false;
}
}
}
if (checkMaxSpeedToGetOff) {
if (mainVehicleRigidbody != null) {
if (Mathf.Abs (mainVehicleRigidbody.linearVelocity.magnitude) > maxSpeedToGetOff) {
currentConditionState = false;
}
}
}
conditionResult = currentConditionState;
return conditionResult;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 1b6ca0ae758b43742b30cbd4dc396d26
timeCreated: 1691810868
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/Condition System/GKCVehicleConditionSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,78 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GKCVendorConditionSystem : GKCConditionInfo
{
[Header ("Custom Settings")]
[Space]
public int vendorObjectAmount;
public bool useInfiniteVendorAmount;
public float vendorObjectPrice;
public float customMoneyChangeSpeed = 20;
public override bool checkIfConditionCompleteAndReturnResult ()
{
if (!checkIfPlayerAssigned ()) {
return false;
}
bool conditionResult = checkConditionResult ();
setConditionResult (conditionResult);
return conditionResult;
}
public override void checkIfConditionComplete ()
{
if (!checkIfPlayerAssigned ()) {
return;
}
bool conditionResult = checkConditionResult ();
setConditionResult (conditionResult);
}
bool checkConditionResult ()
{
bool conditionResult = false;
playerComponentsManager mainPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
if (mainPlayerComponentsManager != null) {
currencySystem mainCurrencySystem = mainPlayerComponentsManager.getCurrencySystem ();
if (mainCurrencySystem != null) {
bool currentConditionState = true;
if (mainCurrencySystem.getCurrentMoneyAmount () < vendorObjectPrice) {
currentConditionState = false;
}
if (currentConditionState) {
if (useInfiniteVendorAmount || vendorObjectAmount > 0) {
mainCurrencySystem.increaseTotalMoneyAmount (-vendorObjectPrice, customMoneyChangeSpeed);
if (!useInfiniteVendorAmount) {
vendorObjectAmount--;
}
} else {
currentConditionState = false;
}
}
conditionResult = currentConditionState;
}
}
return conditionResult;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 987ed8d8cc5bea8449f2b1f13a884bf6
timeCreated: 1625204278
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/Condition System/GKCVendorConditionSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,139 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class simpleFireWeaponsConditionSystem : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool conditionCheckEnabled;
public bool checkIfCurrentWeapon;
[Space]
public bool checkIfAimingWeapon;
public bool checkIfThirdPersonActive;
public bool checkIfFirstPersonActive;
public bool checkIfFullBodyAwarenessActive;
[Space]
public bool conditionResultCompleteIfAnyConditionTrue;
[Space]
[Header ("Events Settings")]
[Space]
public UnityEvent eventOnConditionComplete;
public UnityEvent eventOnConditionNotComplete;
[Space]
[Header ("Debug")]
[Space]
public bool showDebugPrint;
[Space]
[Header ("Components")]
[Space]
public IKWeaponSystem mainIKWeaponSystem;
public void checkIfConditionComplete ()
{
if (!conditionCheckEnabled) {
return;
}
bool conditionResult = checkConditionResult ();
setConditionResult (conditionResult);
}
bool checkConditionResult ()
{
bool conditionResult = false;
bool currentConditionState = true;
if (conditionResultCompleteIfAnyConditionTrue) {
currentConditionState = false;
if (checkIfAimingWeapon) {
if (mainIKWeaponSystem.isAimingWeapon ()) {
currentConditionState = true;
}
}
if (checkIfThirdPersonActive) {
if (!mainIKWeaponSystem.isPlayerCameraFirstPersonActive ()) {
currentConditionState = true;
}
}
if (checkIfFirstPersonActive) {
if (mainIKWeaponSystem.isPlayerCameraFirstPersonActive ()) {
currentConditionState = true;
}
}
if (checkIfFullBodyAwarenessActive) {
if (mainIKWeaponSystem.isFullBodyAwarenessActive ()) {
currentConditionState = true;
}
}
} else {
if (checkIfAimingWeapon) {
if (!mainIKWeaponSystem.isAimingWeapon ()) {
currentConditionState = false;
}
}
if (checkIfThirdPersonActive) {
if (mainIKWeaponSystem.isPlayerCameraFirstPersonActive ()) {
currentConditionState = false;
}
}
if (checkIfFirstPersonActive) {
if (!mainIKWeaponSystem.isPlayerCameraFirstPersonActive ()) {
currentConditionState = false;
}
}
if (checkIfFullBodyAwarenessActive) {
if (!mainIKWeaponSystem.isFullBodyAwarenessActive ()) {
currentConditionState = false;
}
}
}
if (checkIfCurrentWeapon) {
if (!mainIKWeaponSystem.isCurrentWeapon ()) {
currentConditionState = false;
}
}
conditionResult = currentConditionState;
return conditionResult;
}
public void setConditionResult (bool state)
{
if (showDebugPrint) {
print ("Condition result: " + state);
}
if (state) {
eventOnConditionComplete.Invoke ();
} else {
eventOnConditionNotComplete.Invoke ();
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 1f642849e4faa17459b765ac3ea81fc3
timeCreated: 1678676234
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/Condition System/simpleFireWeaponsConditionSystem.cs
uploadId: 814740