add ckg
plantilla base para movimiento básico
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
[System.Serializable]
|
||||
public class objectStatButtonInfo : MonoBehaviour
|
||||
{
|
||||
public string objectCategoryName;
|
||||
|
||||
public string objectName;
|
||||
|
||||
[Space]
|
||||
|
||||
public GameObject buttonGameObject;
|
||||
|
||||
public Text statNameText;
|
||||
|
||||
public RawImage statImage;
|
||||
|
||||
public Text statValueText;
|
||||
|
||||
public Text extraStatValueText;
|
||||
|
||||
public Slider statSlider;
|
||||
|
||||
public Toggle statToggle;
|
||||
|
||||
[Space]
|
||||
|
||||
public bool objectAssigned;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d766f471afc38f4992d58b35b7d89cb
|
||||
timeCreated: 1664495191
|
||||
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/Stats System/Objects Stats/objectStatButtonInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,39 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class objectStatsInfo
|
||||
{
|
||||
public string Name;
|
||||
|
||||
[Space]
|
||||
|
||||
public List<objectStatInfo> objectStatInfoList = new List<objectStatInfo> ();
|
||||
|
||||
[Space]
|
||||
|
||||
public bool usedOnObject;
|
||||
|
||||
public List<string> usableObjectList = new List<string> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class objectStatInfo
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public bool statIsAmount = true;
|
||||
|
||||
public Texture statIcon;
|
||||
|
||||
[Space]
|
||||
|
||||
public float currentFloatValue;
|
||||
|
||||
public float maxFloatValue;
|
||||
|
||||
[Space]
|
||||
|
||||
public bool currentBoolState;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0d1fae7324b4ed47bbe2e5080ee8787
|
||||
timeCreated: 1664244096
|
||||
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/Stats System/Objects Stats/objectStatsInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu (fileName = "Object Stats Template", menuName = "GKC/Create Object Stats Template", order = 51)]
|
||||
public class objectStatsInfoTemplate : ScriptableObject
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public int ID = 0;
|
||||
|
||||
[Space]
|
||||
[Header ("Other Settings")]
|
||||
[Space]
|
||||
|
||||
public bool usedOnObject;
|
||||
|
||||
public List<string> usableObjectList = new List<string> ();
|
||||
|
||||
[Space]
|
||||
[Header ("Object Stats Settings")]
|
||||
[Space]
|
||||
|
||||
public List<objectStatInfo> objectStatInfoList = new List<objectStatInfo> ();
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aab22c978bb5e0c4a938f068b8128925
|
||||
timeCreated: 1664354883
|
||||
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/Stats System/Objects Stats/objectStatsInfoTemplate.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu (fileName = "Object Stats Template List", menuName = "GKC/Create Object Stats Template List", order = 51)]
|
||||
public class objectStatsInfoTemplateData : ScriptableObject
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public int ID = 0;
|
||||
|
||||
[Space]
|
||||
|
||||
[TextArea (3, 5)] public string description;
|
||||
|
||||
[Space]
|
||||
[Space]
|
||||
|
||||
public List<objectStatsInfoTemplate> objectStatsInfoTemplateList = new List<objectStatsInfoTemplate> ();
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d957663987b8c8347af28e31ca66e1ed
|
||||
timeCreated: 1664355062
|
||||
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/Stats System/Objects Stats/objectStatsInfoTemplateData.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,199 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class objectStatsSystem : MonoBehaviour
|
||||
{
|
||||
[Header ("Stats Settings")]
|
||||
[Space]
|
||||
|
||||
public string objectName;
|
||||
|
||||
public bool useStats;
|
||||
|
||||
public float loadStatsDelay;
|
||||
|
||||
public List<statInfo> statInfoList = new List<statInfo> ();
|
||||
|
||||
[Space]
|
||||
[Header ("Debug")]
|
||||
[Space]
|
||||
|
||||
public bool showDebugPrint;
|
||||
|
||||
public bool characterLocated;
|
||||
|
||||
[Space]
|
||||
[Header ("Components")]
|
||||
[Space]
|
||||
|
||||
public GameObject mainCharacterGameObject;
|
||||
|
||||
public objectStatsInfoTemplate mainObjectStatsInfoTemplate;
|
||||
|
||||
|
||||
string currentStatNameToCheck;
|
||||
|
||||
public void addObjectStatsToMainManager ()
|
||||
{
|
||||
checkMainCharacterGameObject ();
|
||||
|
||||
if (characterLocated) {
|
||||
playerComponentsManager currentPlayerComponentsManager = mainCharacterGameObject.GetComponent<playerComponentsManager> ();
|
||||
|
||||
if (currentPlayerComponentsManager != null) {
|
||||
objectsStatsSystem currentobjectsStatsSystem = currentPlayerComponentsManager.getObjectsStatsSystem ();
|
||||
|
||||
if (currentobjectsStatsSystem != null) {
|
||||
currentobjectsStatsSystem.addObjectStatsSystem (this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setMainCharacterGameObject (GameObject newObject)
|
||||
{
|
||||
mainCharacterGameObject = newObject;
|
||||
}
|
||||
|
||||
public void checkMainCharacterGameObject ()
|
||||
{
|
||||
if (characterLocated) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainCharacterGameObject == null) {
|
||||
getMainCharacterGameObject ();
|
||||
}
|
||||
|
||||
characterLocated = mainCharacterGameObject != null;
|
||||
}
|
||||
|
||||
public virtual void getMainCharacterGameObject ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void checkStatsStateOnLoad ()
|
||||
{
|
||||
if (useStats) {
|
||||
if (loadStatsDelay > 0) {
|
||||
setStatsOnLoadWithDelay ();
|
||||
} else {
|
||||
setStatsOnLoad ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setStatsOnLoadWithDelay ()
|
||||
{
|
||||
StartCoroutine (setStatsOnLoadCoroutine ());
|
||||
}
|
||||
|
||||
IEnumerator setStatsOnLoadCoroutine ()
|
||||
{
|
||||
yield return new WaitForSeconds (loadStatsDelay);
|
||||
|
||||
setStatsOnLoad ();
|
||||
}
|
||||
|
||||
public void setStatsOnLoad ()
|
||||
{
|
||||
if (useStats) {
|
||||
if (showDebugPrint) {
|
||||
print ("\n");
|
||||
print ("SETTING STATS INFO ON " + gameObject.name);
|
||||
|
||||
print ("\n");
|
||||
}
|
||||
|
||||
for (int i = 0; i < statInfoList.Count; i++) {
|
||||
statInfo currentStatInfo = statInfoList [i];
|
||||
|
||||
if (currentStatInfo.statIsAmount) {
|
||||
currentStatInfo.eventToInitializeFloatStat.Invoke (currentStatInfo.currentFloatValue);
|
||||
} else {
|
||||
currentStatInfo.eventToInitializeBoolStat.Invoke (currentStatInfo.currentBoolState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setCurrentStatNameToSave (string newValue)
|
||||
{
|
||||
currentStatNameToCheck = newValue;
|
||||
}
|
||||
|
||||
public void setCurrentFloatValueToSave (float newValue)
|
||||
{
|
||||
if (useStats) {
|
||||
for (int i = 0; i < statInfoList.Count; i++) {
|
||||
statInfo currentStatInfo = statInfoList [i];
|
||||
|
||||
if (currentStatInfo.Name.Equals (currentStatNameToCheck)) {
|
||||
currentStatInfo.currentFloatValue = newValue;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setCurrentBoolValueToSave (bool newValue)
|
||||
{
|
||||
if (useStats) {
|
||||
for (int i = 0; i < statInfoList.Count; i++) {
|
||||
statInfo currentStatInfo = statInfoList [i];
|
||||
|
||||
if (currentStatInfo.Name.Equals (currentStatNameToCheck)) {
|
||||
currentStatInfo.currentBoolState = newValue;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void checkEventOnStatsSave ()
|
||||
{
|
||||
if (useStats) {
|
||||
for (int i = 0; i < statInfoList.Count; i++) {
|
||||
statInfo currentStatInfo = statInfoList [i];
|
||||
|
||||
currentStatNameToCheck = currentStatInfo.Name;
|
||||
|
||||
if (currentStatInfo.statIsAmount) {
|
||||
currentStatInfo.eventToGetFloatStat.Invoke ();
|
||||
} else {
|
||||
currentStatInfo.eventToGetBoolStat.Invoke ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class statInfo
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public bool statIsAmount = true;
|
||||
|
||||
[Space]
|
||||
|
||||
public float currentFloatValue;
|
||||
|
||||
public eventParameters.eventToCallWithAmount eventToInitializeFloatStat;
|
||||
|
||||
public UnityEvent eventToGetFloatStat;
|
||||
|
||||
[Space]
|
||||
[Space]
|
||||
|
||||
public bool currentBoolState;
|
||||
|
||||
public eventParameters.eventToCallWithBool eventToInitializeBoolStat;
|
||||
|
||||
public UnityEvent eventToGetBoolStat;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 367d190aa6e56f146bbbda45db2d2f51
|
||||
timeCreated: 1664245089
|
||||
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/Stats System/Objects Stats/objectStatsSystem.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class objectStatsSystemOnMeleeWeapons : objectStatsSystem
|
||||
{
|
||||
|
||||
|
||||
public override void getMainCharacterGameObject ()
|
||||
{
|
||||
grabPhysicalObjectMeleeAttackSystem currentGrabPhysicalObjectMeleeAttackSystem = GetComponent<grabPhysicalObjectMeleeAttackSystem> ();
|
||||
|
||||
if (currentGrabPhysicalObjectMeleeAttackSystem != null) {
|
||||
mainCharacterGameObject = currentGrabPhysicalObjectMeleeAttackSystem.getCurrentCharacter ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d057aecd26832244282fc0d0707d2203
|
||||
timeCreated: 1664355556
|
||||
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/Stats System/Objects Stats/objectStatsSystemOnMeleeWeapons.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,115 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class objectsStatsSystem : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public bool objectsStatsSystemEnabled = true;
|
||||
|
||||
public List<objectStatsSystem> objectStatsSystemList = new List<objectStatsSystem> ();
|
||||
|
||||
[Space]
|
||||
[Header ("Object Stats Template Settings")]
|
||||
[Space]
|
||||
|
||||
public List<objectStatsInfoTemplateData> objectStatsInfoTemplateDataList = new List<objectStatsInfoTemplateData> ();
|
||||
|
||||
[Space]
|
||||
[Header ("Object Stats List Settings")]
|
||||
[Space]
|
||||
|
||||
public List<objectStatsInfo> objectStatsInfoList = new List<objectStatsInfo> ();
|
||||
|
||||
|
||||
|
||||
public List<objectStatsInfoTemplateData> getObjectStatsInfoTemplateDataList ()
|
||||
{
|
||||
return objectStatsInfoTemplateDataList;
|
||||
}
|
||||
|
||||
public void addObjectStatsSystem (objectStatsSystem newObjectStatsSystem)
|
||||
{
|
||||
if (!objectsStatsSystemEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!objectStatsSystemList.Contains (newObjectStatsSystem)) {
|
||||
objectStatsSystemList.Add (newObjectStatsSystem);
|
||||
}
|
||||
}
|
||||
|
||||
public List<objectStatInfo> getStatsFromObjectByName (string objectName)
|
||||
{
|
||||
if (!objectsStatsSystemEnabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int currentObjectIndex = objectStatsSystemList.FindIndex (s => s.objectName.Equals (objectName));
|
||||
|
||||
if (currentObjectIndex > -1) {
|
||||
return objectStatsSystemList [currentObjectIndex].mainObjectStatsInfoTemplate.objectStatInfoList;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool objectCanBeUpgraded (string objectName)
|
||||
{
|
||||
if (!objectsStatsSystemEnabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int currentObjectIndex = objectStatsSystemList.FindIndex (s => s.objectName.Equals (objectName));
|
||||
|
||||
if (currentObjectIndex > -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void increaseStat (string statName, float statExtraValue)
|
||||
{
|
||||
if (!objectsStatsSystemEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
// statInfo currentStatInfo = null;
|
||||
//
|
||||
// int statInfoListCount = statInfoList.Count;
|
||||
//
|
||||
// for (int k = 0; k < statInfoListCount; k++) {
|
||||
// currentStatInfo = statInfoList [k];
|
||||
//
|
||||
// if (currentStatInfo.Name.Equals (statName)) {
|
||||
// currentStatInfo.currentValue += statExtraValue;
|
||||
//
|
||||
// if (currentStatInfo.useMaxAmount) {
|
||||
// currentStatInfo.currentValue = Mathf.Clamp (currentStatInfo.currentValue, 0, getStatMaxAmountByIndex (k));
|
||||
// }
|
||||
//
|
||||
// if (currentStatInfo.useCustomStatTypeForEvents) {
|
||||
// currentStatInfo.customStatType.eventToIncreaseStat (statExtraValue);
|
||||
// } else {
|
||||
// currentStatInfo.eventToIncreaseStat.Invoke (statExtraValue);
|
||||
// }
|
||||
//
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
public void setObjectsStatsSystemEnabledState (bool state)
|
||||
{
|
||||
objectsStatsSystemEnabled = state;
|
||||
}
|
||||
|
||||
public void setObjectsStatsSystemEnabledStateFromEditor (bool state)
|
||||
{
|
||||
setObjectsStatsSystemEnabledState (state);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 89fbb176551b85249a455c25d471396e
|
||||
timeCreated: 1664246635
|
||||
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/Stats System/Objects Stats/objectsStatsSystem.cs
|
||||
uploadId: 814740
|
||||
Reference in New Issue
Block a user