mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-22 08:08:51 -05:00
Move sync variable instancer to collection to its own MB
This commit is contained in:
parent
42f21495a5
commit
20db73a43f
@ -24,6 +24,8 @@ GameObject:
|
||||
- component: {fileID: 4095674729113015293}
|
||||
- component: {fileID: 5231109137669188302}
|
||||
- component: {fileID: 3219820094781281706}
|
||||
- component: {fileID: 3464795203355677658}
|
||||
- component: {fileID: 9113883788723746504}
|
||||
m_Layer: 0
|
||||
m_Name: Enemy
|
||||
m_TagString: Untagged
|
||||
@ -274,8 +276,8 @@ MonoBehaviour:
|
||||
_syncToCollection:
|
||||
_usage: 1
|
||||
_collection: {fileID: 0}
|
||||
_instancer: {fileID: 5231109137669188302}
|
||||
_syncToCollectionKey: Health
|
||||
_instancer: {fileID: 0}
|
||||
_syncToCollectionKey:
|
||||
_syncToList:
|
||||
_usage: 1
|
||||
_list: {fileID: 0}
|
||||
@ -350,8 +352,8 @@ MonoBehaviour:
|
||||
_syncToCollection:
|
||||
_usage: 1
|
||||
_collection: {fileID: 0}
|
||||
_instancer: {fileID: 5231109137669188302}
|
||||
_syncToCollectionKey: Position
|
||||
_instancer: {fileID: 0}
|
||||
_syncToCollectionKey:
|
||||
_syncToList:
|
||||
_usage: 1
|
||||
_list: {fileID: 0}
|
||||
@ -404,3 +406,47 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_list: {fileID: 11400000, guid: 118b16031adba41c2921b637788fa016, type: 2}
|
||||
--- !u!114 &3464795203355677658
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2421445419809145576}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 84fa545dc2b5d4429a502d265e32b9e1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_variableInstancer: {fileID: -2978108162882953924}
|
||||
_syncToCollection:
|
||||
_usage: 1
|
||||
_collection: {fileID: 0}
|
||||
_instancer: {fileID: 5231109137669188302}
|
||||
_syncToCollectionKey: Health
|
||||
_syncToList:
|
||||
_usage: 0
|
||||
_list: {fileID: 0}
|
||||
_instancer: {fileID: 0}
|
||||
--- !u!114 &9113883788723746504
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2421445419809145576}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c9fe1eb9a37bc421e9d54b82844bbf9e, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_variableInstancer: {fileID: 1637442682690422268}
|
||||
_syncToCollection:
|
||||
_usage: 1
|
||||
_collection: {fileID: 0}
|
||||
_instancer: {fileID: 5231109137669188302}
|
||||
_syncToCollectionKey: Position
|
||||
_syncToList:
|
||||
_usage: 0
|
||||
_list: {fileID: 0}
|
||||
_instancer: {fileID: 0}
|
||||
|
@ -6,7 +6,7 @@ namespace UnityAtoms.BaseAtoms
|
||||
/// <summary>
|
||||
/// Adds a GameObject to a GameObject Value List on OnEnable and removes it on OnDestroy.
|
||||
/// </summary>
|
||||
[AddComponentMenu("Unity Atoms/Sync GameObject To List")]
|
||||
[AddComponentMenu("Unity Atoms/MonoBehaviour Helpers/Sync GameObject To List")]
|
||||
[EditorIcon("atom-icon-delicate")]
|
||||
public class SyncGameObjectToList : MonoBehaviour
|
||||
{
|
||||
|
@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Assertions;
|
||||
|
||||
namespace UnityAtoms.BaseAtoms
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds a Variable from a Variable Instancer to a Collection or List on OnEnable and removes it on OnDestroy.
|
||||
/// </summary>
|
||||
[EditorIcon("atom-icon-delicate")]
|
||||
public class SyncVariableInstancerToCollection<T, V, VI> : MonoBehaviour
|
||||
where V : AtomBaseVariable<T>
|
||||
where VI : class, IVariable<V>
|
||||
{
|
||||
/// <summary>
|
||||
/// The Variable Instancer whose Variable will get synced to the List and / or Collection defined.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
private VI _variableInstancer = default;
|
||||
|
||||
/// <summary>
|
||||
/// If assigned the Variable from the Variable Instancer will be added to the Collection on Start using `_syncToCollectionKey` as key or if not specified it uses the gameObject's instance id as key. The value will also be removed from the collection OnDestroy.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
private AtomCollectionReference _syncToCollection = default;
|
||||
|
||||
/// <summary>
|
||||
/// If this string is not null or white space and if a Collection to sync to is defined, this is the key that will used when adding the Variable to the Collection. If not defined the key defaults to this GameObject's instance id.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
private String _syncToCollectionKey = default;
|
||||
|
||||
/// <summary>
|
||||
/// If assigned the Variable from the Variable Instancer will be added to the list on Start. The value will also be removed from the list OnDestroy.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
private AtomListReference _syncToList = default;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Assert.IsNotNull(_variableInstancer);
|
||||
|
||||
if (_syncToCollection != null && _syncToCollection.GetValue() != null)
|
||||
{
|
||||
_syncToCollection.GetValue().Add(String.IsNullOrWhiteSpace(_syncToCollectionKey) ? GetInstanceID().ToString() : _syncToCollectionKey, _variableInstancer.Variable);
|
||||
}
|
||||
|
||||
if (_syncToList != null && _syncToList.GetValue() != null)
|
||||
{
|
||||
_syncToList.GetValue().Add(_variableInstancer.Variable);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (_syncToCollection != null && _syncToCollection.GetValue() != null)
|
||||
{
|
||||
_syncToCollection.GetValue().Remove(GetInstanceID().ToString());
|
||||
}
|
||||
|
||||
if (_syncToList != null && _syncToList.GetValue() != null)
|
||||
{
|
||||
_syncToList.GetValue().Remove(_variableInstancer.Variable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 967ccc983ae8b4c49981f43f4b63de04
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9d95601f8b1234ea18f7905c2a8fc8fb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,12 @@
|
||||
using UnityEngine;
|
||||
using UnityAtoms.BaseAtoms;
|
||||
|
||||
namespace UnityAtoms.BaseAtoms
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy.
|
||||
/// </summary>
|
||||
[AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync Bool Variable Instancer to Collection")]
|
||||
[EditorIcon("atom-icon-delicate")]
|
||||
public class SyncBoolVariableInstancerToCollection : SyncVariableInstancerToCollection<bool, BoolVariable, BoolVariableInstancer> { }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96223c1559f544ce4a760452682223c4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,12 @@
|
||||
using UnityAtoms.BaseAtoms;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityAtoms.BaseAtoms
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy.
|
||||
/// </summary>
|
||||
[AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync Collider2D Variable Instancer to Collection")]
|
||||
[EditorIcon("atom-icon-delicate")]
|
||||
public class SyncCollider2DVariableInstancerToCollection : SyncVariableInstancerToCollection<Collider2D, Collider2DVariable, Collider2DVariableInstancer> { }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0568445422ca44e7fa6d63d6453d5f30
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,12 @@
|
||||
using UnityAtoms.BaseAtoms;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityAtoms.BaseAtoms
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy.
|
||||
/// </summary>
|
||||
[AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync Collider Variable Instancer to Collection")]
|
||||
[EditorIcon("atom-icon-delicate")]
|
||||
public class SyncColliderVariableInstancerToCollection : SyncVariableInstancerToCollection<Collider, ColliderVariable, ColliderVariableInstancer> { }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ca68c6198e834819b7eefbf74c2fd42
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,12 @@
|
||||
using UnityAtoms.BaseAtoms;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityAtoms.BaseAtoms
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy.
|
||||
/// </summary>
|
||||
[AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync Color Variable Instancer to Collection")]
|
||||
[EditorIcon("atom-icon-delicate")]
|
||||
public class SyncColorVariableInstancerToCollection : SyncVariableInstancerToCollection<Color, ColorVariable, ColorVariableInstancer> { }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9ce530051602d436a8b25f28e9dcf88f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,12 @@
|
||||
using UnityEngine;
|
||||
using UnityAtoms.BaseAtoms;
|
||||
|
||||
namespace UnityAtoms.BaseAtoms
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy.
|
||||
/// </summary>
|
||||
[AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync Float Variable Instancer to Collection")]
|
||||
[EditorIcon("atom-icon-delicate")]
|
||||
public class SyncFloatVariableInstancerToCollection : SyncVariableInstancerToCollection<float, FloatVariable, FloatVariableInstancer> { }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3bf191c5ab7c84f7184abfa947bd24ef
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,12 @@
|
||||
using UnityAtoms.BaseAtoms;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityAtoms.BaseAtoms
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy.
|
||||
/// </summary>
|
||||
[AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync GameObject Variable Instancer to Collection")]
|
||||
[EditorIcon("atom-icon-delicate")]
|
||||
public class SyncGameObjectVariableInstancerToCollection : SyncVariableInstancerToCollection<GameObject, GameObjectVariable, GameObjectVariableInstancer> { }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5d51231331004e00b6f2fbdc91768d0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,12 @@
|
||||
using UnityEngine;
|
||||
using UnityAtoms.BaseAtoms;
|
||||
|
||||
namespace UnityAtoms.BaseAtoms
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy.
|
||||
/// </summary>
|
||||
[AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync Int Variable Instancer to Collection")]
|
||||
[EditorIcon("atom-icon-delicate")]
|
||||
public class SyncIntVariableInstancerToCollection : SyncVariableInstancerToCollection<int, IntVariable, IntVariableInstancer> { }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 84fa545dc2b5d4429a502d265e32b9e1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,12 @@
|
||||
using UnityEngine;
|
||||
using UnityAtoms.BaseAtoms;
|
||||
|
||||
namespace UnityAtoms.BaseAtoms
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy.
|
||||
/// </summary>
|
||||
[AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync String Variable Instancer to Collection")]
|
||||
[EditorIcon("atom-icon-delicate")]
|
||||
public class SyncStringVariableInstancerToCollection : SyncVariableInstancerToCollection<string, StringVariable, StringVariableInstancer> { }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2ae57eed554524e648a16aab8b026232
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,12 @@
|
||||
using UnityAtoms.BaseAtoms;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityAtoms.BaseAtoms
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy.
|
||||
/// </summary>
|
||||
[AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync Vector2 Variable Instancer to Collection")]
|
||||
[EditorIcon("atom-icon-delicate")]
|
||||
public class SyncVector2VariableInstancerToCollection : SyncVariableInstancerToCollection<Vector2, Vector2Variable, Vector2VariableInstancer> { }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8392210b17ca241a1922f4f2d8cb6d6c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,12 @@
|
||||
using UnityAtoms.BaseAtoms;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityAtoms.BaseAtoms
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy.
|
||||
/// </summary>
|
||||
[AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync Vector3 Variable Instancer to Collection")]
|
||||
[EditorIcon("atom-icon-delicate")]
|
||||
public class SyncVector3VariableInstancerToCollection : SyncVariableInstancerToCollection<Vector3, Vector3Variable, Vector3VariableInstancer> { }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9fe1eb9a37bc421e9d54b82844bbf9e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -84,6 +84,11 @@ namespace UnityAtoms.Editor
|
||||
templateName: "UA_Template__SetVariableValue.txt",
|
||||
relativeFileNameAndPath: Path.Combine(Runtime.IsUnityAtomsRepo ? "Runtime" : "", "Actions", "SetVariableValue", $"Set{{VALUE_TYPE_NAME}}VariableValue.cs")
|
||||
);
|
||||
public static readonly AtomType SYNC_VARIABLE_INSTANCER_TO_COLLECTION = new AtomType(
|
||||
displayName: "Sync Variable Instancer To Collection",
|
||||
templateName: "UA_Template__SyncVariableInstancerToCollection.txt",
|
||||
relativeFileNameAndPath: Path.Combine(Runtime.IsUnityAtomsRepo ? "Runtime" : "", "SyncVariableInstancerToCollection", $"Sync{{VALUE_TYPE_NAME}}VariableInstancerToCollection.cs")
|
||||
);
|
||||
public static readonly AtomType UNITY_EVENT = new AtomType(
|
||||
displayName: "Unity Event",
|
||||
templateName: "UA_Template__UnityEvent.txt"
|
||||
@ -137,6 +142,7 @@ namespace UnityAtoms.Editor
|
||||
AtomTypes.EVENT_REFERENCE,
|
||||
AtomTypes.PAIR_EVENT_REFERENCE,
|
||||
AtomTypes.SET_VARIABLE_VALUE,
|
||||
AtomTypes.SYNC_VARIABLE_INSTANCER_TO_COLLECTION,
|
||||
AtomTypes.UNITY_EVENT,
|
||||
AtomTypes.PAIR_UNITY_EVENT,
|
||||
AtomTypes.VARIABLE,
|
||||
@ -154,33 +160,32 @@ namespace UnityAtoms.Editor
|
||||
{ AtomTypes.VALUE_LIST, new List<AtomType>() { AtomTypes.EVENT } },
|
||||
{ AtomTypes.BASE_EVENT_REFERENCE_LISTENER, new List<AtomType>() { AtomTypes.EVENT, AtomTypes.BASE_EVENT_REFERENCE, AtomTypes.UNITY_EVENT } },
|
||||
{ AtomTypes.EVENT_REFERENCE_LISTENER, new List<AtomType>() {
|
||||
AtomTypes.VARIABLE, AtomTypes.EVENT, AtomTypes.PAIR_EVENT, AtomTypes.FUNCTION_T_T,
|
||||
AtomTypes.VARIABLE_INSTANCER, AtomTypes.PAIR_EVENT_REFERENCE, AtomTypes.UNITY_EVENT, AtomTypes.PAIR }
|
||||
AtomTypes.EVENT, AtomTypes.EVENT_REFERENCE, AtomTypes.UNITY_EVENT }
|
||||
},
|
||||
{ AtomTypes.PAIR_EVENT_REFERENCE_LISTENER, new List<AtomType>() {
|
||||
AtomTypes.VARIABLE, AtomTypes.EVENT, AtomTypes.PAIR_EVENT, AtomTypes.FUNCTION_T_T,
|
||||
AtomTypes.VARIABLE_INSTANCER, AtomTypes.EVENT_REFERENCE, AtomTypes.PAIR_UNITY_EVENT, AtomTypes.PAIR }
|
||||
AtomTypes.PAIR_EVENT, AtomTypes.PAIR_EVENT_REFERENCE, AtomTypes.PAIR_UNITY_EVENT}
|
||||
},
|
||||
{ AtomTypes.REFERENCE, new List<AtomType>() {
|
||||
AtomTypes.CONSTANT, AtomTypes.VARIABLE, AtomTypes.EVENT, AtomTypes.PAIR_EVENT, AtomTypes.FUNCTION_T_T, AtomTypes.VARIABLE_INSTANCER, AtomTypes.PAIR }
|
||||
},
|
||||
{ AtomTypes.BASE_EVENT_REFERENCE, new List<AtomType>() {AtomTypes.EVENT, AtomTypes.EVENT_INSTANCER }
|
||||
},
|
||||
{ AtomTypes.EVENT_REFERENCE, new List<AtomType>() { AtomTypes.VARIABLE, AtomTypes.EVENT, AtomTypes.PAIR_EVENT,
|
||||
AtomTypes.FUNCTION_T_T, AtomTypes.VARIABLE_INSTANCER, AtomTypes.EVENT_INSTANCER, AtomTypes.PAIR }
|
||||
{ AtomTypes.EVENT_REFERENCE, new List<AtomType>() { AtomTypes.VARIABLE, AtomTypes.EVENT, AtomTypes.VARIABLE_INSTANCER, AtomTypes.EVENT_INSTANCER }
|
||||
},
|
||||
{ AtomTypes.PAIR_EVENT_REFERENCE, new List<AtomType>() { AtomTypes.VARIABLE, AtomTypes.EVENT, AtomTypes.PAIR_EVENT,
|
||||
AtomTypes.FUNCTION_T_T, AtomTypes.VARIABLE_INSTANCER, AtomTypes.PAIR_EVENT_INSTANCER, AtomTypes.PAIR }
|
||||
{ AtomTypes.PAIR_EVENT_REFERENCE, new List<AtomType>() { AtomTypes.VARIABLE, AtomTypes.PAIR_EVENT, AtomTypes.VARIABLE_INSTANCER, AtomTypes.PAIR_EVENT_INSTANCER }
|
||||
},
|
||||
{ AtomTypes.SET_VARIABLE_VALUE, new List<AtomType>() {
|
||||
AtomTypes.EVENT, AtomTypes.PAIR_EVENT, AtomTypes.FUNCTION_T_T, AtomTypes.VARIABLE, AtomTypes.CONSTANT,
|
||||
AtomTypes.REFERENCE, AtomTypes.VARIABLE_INSTANCER, AtomTypes.PAIR }
|
||||
},
|
||||
{ AtomTypes.SYNC_VARIABLE_INSTANCER_TO_COLLECTION, new List<AtomType>() {
|
||||
AtomTypes.VARIABLE, AtomTypes.VARIABLE_INSTANCER }
|
||||
},
|
||||
{ AtomTypes.PAIR_UNITY_EVENT, new List<AtomType>() { AtomTypes.PAIR } },
|
||||
{ AtomTypes.VARIABLE, new List<AtomType>() { AtomTypes.EVENT, AtomTypes.PAIR_EVENT, AtomTypes.FUNCTION_T_T, AtomTypes.PAIR } },
|
||||
{ AtomTypes.VARIABLE_INSTANCER, new List<AtomType>() { AtomTypes.VARIABLE, AtomTypes.EVENT, AtomTypes.PAIR_EVENT, AtomTypes.FUNCTION_T_T, AtomTypes.PAIR } },
|
||||
{ AtomTypes.EVENT_INSTANCER, new List<AtomType>() { AtomTypes.EVENT } },
|
||||
{ AtomTypes.PAIR_EVENT_INSTANCER, new List<AtomType>() { AtomTypes.EVENT, AtomTypes.PAIR } }
|
||||
{ AtomTypes.PAIR_EVENT_INSTANCER, new List<AtomType>() { AtomTypes.PAIR_EVENT } }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
using UnityEngine;
|
||||
using UnityAtoms.BaseAtoms;
|
||||
<%IF TYPE_HAS_NAMESPACE%>using {TYPE_NAMESPACE};<%ENDIF%>
|
||||
|
||||
<%IF HAS_SUB_UA_NAMESPACE%>
|
||||
namespace UnityAtoms.{SUB_UA_NAMESPACE}
|
||||
<%ELSE%>
|
||||
namespace UnityAtoms
|
||||
<%ENDIF%>
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy.
|
||||
/// </summary>
|
||||
[AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync {VALUE_TYPE_NAME} Variable Instancer to Collection")]
|
||||
[EditorIcon("atom-icon-delicate")]
|
||||
public class Sync{VALUE_TYPE_NAME}VariableInstancerToCollection : SyncVariableInstancerToCollection<{VALUE_TYPE}, {VALUE_TYPE_NAME}Variable, {VALUE_TYPE_NAME}VariableInstancer> { }
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf6a161b0fbad45fab39780ebd140c99
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
7
Packages/Core/Runtime/Interfaces/IVariable.cs
Normal file
7
Packages/Core/Runtime/Interfaces/IVariable.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace UnityAtoms
|
||||
{
|
||||
public interface IVariable<T>
|
||||
{
|
||||
T Variable { get; }
|
||||
}
|
||||
}
|
11
Packages/Core/Runtime/Interfaces/IVariable.cs.meta
Normal file
11
Packages/Core/Runtime/Interfaces/IVariable.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8810e38924433414b85a64e28b5c161e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -3,7 +3,7 @@ using UnityEngine;
|
||||
|
||||
namespace UnityAtoms
|
||||
{
|
||||
[AddComponentMenu("Unity Atoms/Variable Resetter")]
|
||||
[AddComponentMenu("Unity Atoms/MonoBehaviour Helpers/Variable Resetter")]
|
||||
[DefaultExecutionOrder(Runtime.ExecutionOrder.VARIABLE_RESETTER)]
|
||||
[EditorIcon("atom-icon-delicate")]
|
||||
public class VariableResetter : MonoBehaviour
|
||||
|
@ -17,7 +17,7 @@ namespace UnityAtoms
|
||||
/// <typeparam name="F">Function of type T => T</typeparam>
|
||||
[EditorIcon("atom-icon-hotpink")]
|
||||
[DefaultExecutionOrder(Runtime.ExecutionOrder.VARIABLE_INSTANCER)]
|
||||
public abstract class AtomBaseVariableInstancer<T, V, CO, L> : MonoBehaviour
|
||||
public abstract class AtomBaseVariableInstancer<T, V, CO, L> : MonoBehaviour, IVariable<V>
|
||||
where V : AtomBaseVariable<T>
|
||||
where CO : IGetValue<IAtomCollection>
|
||||
where L : IGetValue<IAtomList>
|
||||
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e0f09b8091f4495f98f91f403072169
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,13 @@
|
||||
using UnityEngine;
|
||||
using UnityAtoms.BaseAtoms;
|
||||
using UnityAtoms.Mobile;
|
||||
|
||||
namespace UnityAtoms.Mobile
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy.
|
||||
/// </summary>
|
||||
[AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync TouchUserInput Variable Instancer to Collection")]
|
||||
[EditorIcon("atom-icon-delicate")]
|
||||
public class SyncTouchUserInputVariableInstancerToCollection : SyncVariableInstancerToCollection<TouchUserInput, TouchUserInputVariable, TouchUserInputVariableInstancer> { }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21ffdc4ff8dcc40fbb3c56c93619656b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b3501a99b022468a9ed549befdc7dc1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,13 @@
|
||||
using UnityEngine;
|
||||
using UnityAtoms.BaseAtoms;
|
||||
using UnityAtoms.MonoHooks;
|
||||
|
||||
namespace UnityAtoms.MonoHooks
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy.
|
||||
/// </summary>
|
||||
[AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync Collider2DGameObject Variable Instancer to Collection")]
|
||||
[EditorIcon("atom-icon-delicate")]
|
||||
public class SyncCollider2DGameObjectVariableInstancerToCollection : SyncVariableInstancerToCollection<Collider2DGameObject, Collider2DGameObjectVariable, Collider2DGameObjectVariableInstancer> { }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec40bfabc10254768947e2748b790283
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,13 @@
|
||||
using UnityEngine;
|
||||
using UnityAtoms.BaseAtoms;
|
||||
using UnityAtoms.MonoHooks;
|
||||
|
||||
namespace UnityAtoms.MonoHooks
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy.
|
||||
/// </summary>
|
||||
[AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync ColliderGameObject Variable Instancer to Collection")]
|
||||
[EditorIcon("atom-icon-delicate")]
|
||||
public class SyncColliderGameObjectVariableInstancerToCollection : SyncVariableInstancerToCollection<ColliderGameObject, ColliderGameObjectVariable, ColliderGameObjectVariableInstancer> { }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 70a860013e0574439a7cff1ffcab164c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b588e9c7d0764aeabe6db1605827fef
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,13 @@
|
||||
using UnityEngine;
|
||||
using UnityAtoms.BaseAtoms;
|
||||
using UnityAtoms.SceneMgmt;
|
||||
|
||||
namespace UnityAtoms.SceneMgmt
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds Variable Instancer's Variable of type {TYPE} to a Collection or List on OnEnable and removes it on OnDestroy.
|
||||
/// </summary>
|
||||
[AddComponentMenu("Unity Atoms/Sync Variable Instancer to Collection/Sync SceneField Variable Instancer to Collection")]
|
||||
[EditorIcon("atom-icon-delicate")]
|
||||
public class SyncSceneFieldVariableInstancerToCollection : SyncVariableInstancerToCollection<SceneField, SceneFieldVariable, SceneFieldVariableInstancer> { }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d451cebd701174f53bea83243f25b809
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: c3c99b8d76418472cb0261944ff3deb8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user