- Added a top menu bar option to regenerate all existing Atoms. Nifty when developing the library.

- Added the option to use a Constant in Atom References. Related to #58
This commit is contained in:
AdamRamberg 2019-10-16 18:02:08 +02:00
parent bfc37e2a2f
commit 299dc195e2
37 changed files with 282 additions and 90 deletions

View File

@ -13,6 +13,7 @@
- Improved examples.
- Changed name on Atomic Tags to UA Tags.
- Automatic generation of API docs in markdown format from C# XML comments.
- Added internal tool to regenerate all existing Atoms. Nifty when doing changes that requires you to update all types of Atoms.
# 1.0.0 (Mars 17, 2019)

View File

@ -119,6 +119,14 @@ All new features added to the project should be documented using [C# XML comment
When you are all setup you simply run `npm run generate:docs` in the root of the project and voila, fresh documentation is generated for you!
## Generator
Before submitting a PR please check and see if the change requires you to update the Generator and the templates.
### Pro tip
If you are doing updates that requires you to update all existing Atoms you can use `Unity Atoms/Tools/Regenerate all Atoms` from the top menu bar.
## Pull requests
Pull requests should be made to the [canary branch](https://github.com/AdamRamberg/unity-atoms/tree/canary).

View File

@ -11,8 +11,7 @@ namespace UnityAtoms.Editor
public class AtomReferenceDrawer : PropertyDrawer
{
private static readonly string[] _popupOptions =
{ "Use Constant", "Use Variable" };
{ "Use Value", "Use Constant", "Use Variable" };
private static GUIStyle _popupStyle;
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
@ -29,9 +28,10 @@ namespace UnityAtoms.Editor
EditorGUI.BeginChangeCheck();
// Get properties
SerializedProperty useConstant = property.FindPropertyRelative("UseConstant");
SerializedProperty constantValue = property.FindPropertyRelative("ConstantValue");
SerializedProperty variable = property.FindPropertyRelative("Variable");
SerializedProperty _usage = property.FindPropertyRelative("_usage");
SerializedProperty _value = property.FindPropertyRelative("_value");
SerializedProperty _constant = property.FindPropertyRelative("_constant");
SerializedProperty _variable = property.FindPropertyRelative("_variable");
// Calculate rect for configuration button
Rect buttonRect = new Rect(position);
@ -42,13 +42,13 @@ namespace UnityAtoms.Editor
// Store old indent level and set it to 0, the PrefixLabel takes care of it
int indent = EditorGUI.indentLevel;
EditorGUI.indentLevel = 0;
_usage.intValue = EditorGUI.Popup(buttonRect, _usage.intValue, _popupOptions, _popupStyle);
var usage = (AtomReference.Usage)_usage.intValue;
int result = EditorGUI.Popup(buttonRect, useConstant.boolValue ? 0 : 1, _popupOptions, _popupStyle);
useConstant.boolValue = result == 0;
var valueToUse = usage == AtomReference.Usage.Value ? _value : usage == AtomReference.Usage.Constant ? _constant : _variable;
EditorGUI.PropertyField(position,
useConstant.boolValue ? constantValue : variable,
valueToUse,
GUIContent.none);
if (EditorGUI.EndChangeCheck())

View File

@ -0,0 +1,88 @@
using System;
using System.Linq;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace UnityAtoms.Editor
{
/// <summary>
/// Internal utility class to regenerate all Atoms. Reachable via top menu bar and `Tools/Unity Atoms/Regenerate All Atoms`.
/// </summary>
internal class RegenereateAllAtoms
{
private class RegenerateItem
{
public string type;
public string baseWritePath;
public bool isEquatable;
public List<AtomType> atomTypesToGenerate;
public string typeNamespace;
public string subUnityAtomsNamespace;
public RegenerateItem(string type, string baseWritePath, bool isEquatable, List<AtomType> atomTypesToGenerate, string typeNamespace, string subUnityAtomsNamespace)
{
this.type = type;
this.baseWritePath = baseWritePath;
this.isEquatable = isEquatable;
this.atomTypesToGenerate = atomTypesToGenerate;
this.typeNamespace = typeNamespace;
this.subUnityAtomsNamespace = subUnityAtomsNamespace;
}
}
private Generator generator;
/// <summary>
/// Create the editor window.
/// </summary>
[MenuItem("Tools/Unity Atoms/Regenerate all Atoms")]
static void Regenereate()
{
if (!Runtime.IsUnityAtomsRepo)
{
Debug.LogWarning("This is currently only available working in the Unity Atoms project...");
}
List<AtomType> ALL_ATOM_TYPES = new List<AtomType>()
{
AtomTypes.ACTION,
AtomTypes.ACTION_X2,
AtomTypes.CONSTANT,
AtomTypes.EVENT,
AtomTypes.EVENT_X2,
AtomTypes.LIST,
AtomTypes.LISTENER,
AtomTypes.LISTENER_X2,
AtomTypes.REFERENCE,
AtomTypes.SET_VARIABLE_VALUE,
AtomTypes.UNITY_EVENT,
AtomTypes.UNITY_EVENT_X2,
AtomTypes.VARIABLE
};
var itemsToRegenerate = new List<RegenerateItem>()
{
new RegenerateItem(type: "bool", baseWritePath: "../Packages/Core", isEquatable: true, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "", subUnityAtomsNamespace: ""),
new RegenerateItem(type: "Collider2D", baseWritePath: "../Packages/Core", isEquatable: false, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: ""),
new RegenerateItem(type: "Collider", baseWritePath: "../Packages/Core", isEquatable: false, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: ""),
new RegenerateItem(type: "Color", baseWritePath: "../Packages/Core", isEquatable: true, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: ""),
new RegenerateItem(type: "float", baseWritePath: "../Packages/Core", isEquatable: true, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "", subUnityAtomsNamespace: ""),
new RegenerateItem(type: "GameObject", baseWritePath: "../Packages/Core", isEquatable: false, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: ""),
new RegenerateItem(type: "int", baseWritePath: "../Packages/Core", isEquatable: true, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "", subUnityAtomsNamespace: ""),
new RegenerateItem(type: "string", baseWritePath: "../Packages/Core", isEquatable: true, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "", subUnityAtomsNamespace: ""),
new RegenerateItem(type: "Vector2", baseWritePath: "../Packages/Core", isEquatable: true, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: ""),
new RegenerateItem(type: "Vector3", baseWritePath: "../Packages/Core", isEquatable: true, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: ""),
new RegenerateItem(type: "TouchUserInput", baseWritePath: "../Packages/Mobile", isEquatable: true, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "UnityAtoms.Mobile", subUnityAtomsNamespace: "Mobile"),
new RegenerateItem(type: "SceneField", baseWritePath: "../Packages/SceneMgmt", isEquatable: true, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "UnityAtoms.SceneMgmt", subUnityAtomsNamespace: "SceneMgmt"),
};
var generator = new Generator();
foreach (var item in itemsToRegenerate)
{
generator.Generate(item.type, item.baseWritePath, item.isEquatable, item.atomTypesToGenerate, item.typeNamespace, item.subUnityAtomsNamespace);
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: abab2f04a13794e1b8896e358754a3c7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -10,10 +10,11 @@ namespace UnityAtoms
<%ENDIF%>
{
/// <summary>
/// Reference of type `{TYPE}`. Inherits from `AtomReference&lt;{TYPE}, {TYPE_NAME}Variable&gt;`.
/// Reference of type `{TYPE}`. Inherits from `AtomReference&lt;{TYPE}, {TYPE_NAME}Variable, {TYPE_NAME}Constant&gt;`.
/// </summary>
[Serializable]
public sealed class {TYPE_NAME}Reference : AtomReference<
{TYPE},
{TYPE_NAME}Variable> { }
{TYPE_NAME}Variable,
{TYPE_NAME}Constant> { }
}

View File

@ -10,13 +10,14 @@ namespace UnityAtoms
<%ENDIF%>
{
/// <summary>
/// Set variable value Action of type `{TYPE}`. Inherits from `SetVariableValue&lt;{TYPE}, {TYPE_NAME}Variable, {TYPE_NAME}Reference, {TYPE_NAME}Event, {TYPE_NAME}{TYPE_NAME}Event&gt;`.
/// Set variable value Action of type `{TYPE}`. Inherits from `SetVariableValue&lt;{TYPE}, {TYPE_NAME}Variable, {TYPE_NAME}Constant, {TYPE_NAME}Reference, {TYPE_NAME}Event, {TYPE_NAME}{TYPE_NAME}Event&gt;`.
/// </summary>
[EditorIcon("atom-icon-purple")]
[CreateAssetMenu(menuName = "Unity Atoms/Actions/Set Variable Value/{TYPE_NAME}", fileName = "Set{TYPE_NAME}VariableValue")]
public sealed class Set{TYPE_NAME}VariableValue : SetVariableValue<
{TYPE},
{TYPE_NAME}Variable,
{TYPE_NAME}Constant,
{TYPE_NAME}Reference,
{TYPE_NAME}Event,
{TYPE_NAME}{TYPE_NAME}Event>

View File

@ -3,13 +3,14 @@ using UnityEngine;
namespace UnityAtoms
{
/// <summary>
/// Set variable value Action of type `bool`. Inherits from `SetVariableValue&lt;bool, BoolVariable, BoolReference, BoolEvent, BoolBoolEvent&gt;`.
/// Set variable value Action of type `bool`. Inherits from `SetVariableValue&lt;bool, BoolVariable, BoolConstant, BoolReference, BoolEvent, BoolBoolEvent&gt;`.
/// </summary>
[EditorIcon("atom-icon-purple")]
[CreateAssetMenu(menuName = "Unity Atoms/Actions/Set Variable Value/Bool", fileName = "SetBoolVariableValue")]
public sealed class SetBoolVariableValue : SetVariableValue<
bool,
BoolVariable,
BoolConstant,
BoolReference,
BoolEvent,
BoolBoolEvent>

View File

@ -3,13 +3,14 @@ using UnityEngine;
namespace UnityAtoms
{
/// <summary>
/// Set variable value Action of type `Collider2D`. Inherits from `SetVariableValue&lt;Collider2D, Collider2DVariable, Collider2DReference, Collider2DEvent, Collider2DCollider2DEvent&gt;`.
/// Set variable value Action of type `Collider2D`. Inherits from `SetVariableValue&lt;Collider2D, Collider2DVariable, Collider2DConstant, Collider2DReference, Collider2DEvent, Collider2DCollider2DEvent&gt;`.
/// </summary>
[EditorIcon("atom-icon-purple")]
[CreateAssetMenu(menuName = "Unity Atoms/Actions/Set Variable Value/Collider2D", fileName = "SetCollider2DVariableValue")]
public sealed class SetCollider2DVariableValue : SetVariableValue<
Collider2D,
Collider2DVariable,
Collider2DConstant,
Collider2DReference,
Collider2DEvent,
Collider2DCollider2DEvent>

View File

@ -3,13 +3,14 @@ using UnityEngine;
namespace UnityAtoms
{
/// <summary>
/// Set variable value Action of type `Collider`. Inherits from `SetVariableValue&lt;Collider, ColliderVariable, ColliderReference, ColliderEvent, ColliderColliderEvent&gt;`.
/// Set variable value Action of type `Collider`. Inherits from `SetVariableValue&lt;Collider, ColliderVariable, ColliderConstant, ColliderReference, ColliderEvent, ColliderColliderEvent&gt;`.
/// </summary>
[EditorIcon("atom-icon-purple")]
[CreateAssetMenu(menuName = "Unity Atoms/Actions/Set Variable Value/Collider", fileName = "SetColliderVariableValue")]
public sealed class SetColliderVariableValue : SetVariableValue<
Collider,
ColliderVariable,
ColliderConstant,
ColliderReference,
ColliderEvent,
ColliderColliderEvent>

View File

@ -3,13 +3,14 @@ using UnityEngine;
namespace UnityAtoms
{
/// <summary>
/// Set variable value Action of type `Color`. Inherits from `SetVariableValue&lt;Color, ColorVariable, ColorReference, ColorEvent, ColorColorEvent&gt;`.
/// Set variable value Action of type `Color`. Inherits from `SetVariableValue&lt;Color, ColorVariable, ColorConstant, ColorReference, ColorEvent, ColorColorEvent&gt;`.
/// </summary>
[EditorIcon("atom-icon-purple")]
[CreateAssetMenu(menuName = "Unity Atoms/Actions/Set Variable Value/Color", fileName = "SetColorVariableValue")]
public sealed class SetColorVariableValue : SetVariableValue<
Color,
ColorVariable,
ColorConstant,
ColorReference,
ColorEvent,
ColorColorEvent>

View File

@ -3,13 +3,14 @@ using UnityEngine;
namespace UnityAtoms
{
/// <summary>
/// Set variable value Action of type `float`. Inherits from `SetVariableValue&lt;float, FloatVariable, FloatReference, FloatEvent, FloatFloatEvent&gt;`.
/// Set variable value Action of type `float`. Inherits from `SetVariableValue&lt;float, FloatVariable, FloatConstant, FloatReference, FloatEvent, FloatFloatEvent&gt;`.
/// </summary>
[EditorIcon("atom-icon-purple")]
[CreateAssetMenu(menuName = "Unity Atoms/Actions/Set Variable Value/Float", fileName = "SetFloatVariableValue")]
public sealed class SetFloatVariableValue : SetVariableValue<
float,
FloatVariable,
FloatConstant,
FloatReference,
FloatEvent,
FloatFloatEvent>

View File

@ -3,13 +3,14 @@ using UnityEngine;
namespace UnityAtoms
{
/// <summary>
/// Set variable value Action of type `GameObject`. Inherits from `SetVariableValue&lt;GameObject, GameObjectVariable, GameObjectReference, GameObjectEvent, GameObjectGameObjectEvent&gt;`.
/// Set variable value Action of type `GameObject`. Inherits from `SetVariableValue&lt;GameObject, GameObjectVariable, GameObjectConstant, GameObjectReference, GameObjectEvent, GameObjectGameObjectEvent&gt;`.
/// </summary>
[EditorIcon("atom-icon-purple")]
[CreateAssetMenu(menuName = "Unity Atoms/Actions/Set Variable Value/GameObject", fileName = "SetGameObjectVariableValue")]
public sealed class SetGameObjectVariableValue : SetVariableValue<
GameObject,
GameObjectVariable,
GameObjectConstant,
GameObjectReference,
GameObjectEvent,
GameObjectGameObjectEvent>

View File

@ -3,13 +3,14 @@ using UnityEngine;
namespace UnityAtoms
{
/// <summary>
/// Set variable value Action of type `int`. Inherits from `SetVariableValue&lt;int, IntVariable, IntReference, IntEvent, IntIntEvent&gt;`.
/// Set variable value Action of type `int`. Inherits from `SetVariableValue&lt;int, IntVariable, IntConstant, IntReference, IntEvent, IntIntEvent&gt;`.
/// </summary>
[EditorIcon("atom-icon-purple")]
[CreateAssetMenu(menuName = "Unity Atoms/Actions/Set Variable Value/Int", fileName = "SetIntVariableValue")]
public sealed class SetIntVariableValue : SetVariableValue<
int,
IntVariable,
IntConstant,
IntReference,
IntEvent,
IntIntEvent>

View File

@ -3,13 +3,14 @@ using UnityEngine;
namespace UnityAtoms
{
/// <summary>
/// Set variable value Action of type `string`. Inherits from `SetVariableValue&lt;string, StringVariable, StringReference, StringEvent, StringStringEvent&gt;`.
/// Set variable value Action of type `string`. Inherits from `SetVariableValue&lt;string, StringVariable, StringConstant, StringReference, StringEvent, StringStringEvent&gt;`.
/// </summary>
[EditorIcon("atom-icon-purple")]
[CreateAssetMenu(menuName = "Unity Atoms/Actions/Set Variable Value/String", fileName = "SetStringVariableValue")]
public sealed class SetStringVariableValue : SetVariableValue<
string,
StringVariable,
StringConstant,
StringReference,
StringEvent,
StringStringEvent>

View File

@ -8,14 +8,16 @@ namespace UnityAtoms
/// </summary>
/// <typeparam name="T">The type of the Variable to set.</typeparam>
/// <typeparam name="V">A Variable class of type `type` to set.</typeparam>
/// <typeparam name="C">A Constant class of type `type` to set.</typeparam>
/// <typeparam name="R">A Reference of type `type`.</typeparam>
/// <typeparam name="E1">An Event of type `type`.</typeparam>
/// <typeparam name="E2">An Event x 2 of type `type`.</typeparam>
public abstract class SetVariableValue<T, V, R, E1, E2> : VoidAction
public abstract class SetVariableValue<T, V, C, R, E1, E2> : VoidAction
where E1 : AtomEvent<T>
where E2 : AtomEvent<T, T>
where V : AtomVariable<T, E1, E2>
where R : AtomReference<T, V>
where C : AtomBaseVariable<T>
where R : AtomReference<T, V, C>
{
/// <summary>
/// The Variable to set.

View File

@ -3,13 +3,14 @@ using UnityEngine;
namespace UnityAtoms
{
/// <summary>
/// Set variable value Action of type `Vector2`. Inherits from `SetVariableValue&lt;Vector2, Vector2Variable, Vector2Reference, Vector2Event, Vector2Vector2Event&gt;`.
/// Set variable value Action of type `Vector2`. Inherits from `SetVariableValue&lt;Vector2, Vector2Variable, Vector2Constant, Vector2Reference, Vector2Event, Vector2Vector2Event&gt;`.
/// </summary>
[EditorIcon("atom-icon-purple")]
[CreateAssetMenu(menuName = "Unity Atoms/Actions/Set Variable Value/Vector2", fileName = "SetVector2VariableValue")]
public sealed class SetVector2VariableValue : SetVariableValue<
Vector2,
Vector2Variable,
Vector2Constant,
Vector2Reference,
Vector2Event,
Vector2Vector2Event>

View File

@ -3,13 +3,14 @@ using UnityEngine;
namespace UnityAtoms
{
/// <summary>
/// Set variable value Action of type `Vector3`. Inherits from `SetVariableValue&lt;Vector3, Vector3Variable, Vector3Reference, Vector3Event, Vector3Vector3Event&gt;`.
/// Set variable value Action of type `Vector3`. Inherits from `SetVariableValue&lt;Vector3, Vector3Variable, Vector3Constant, Vector3Reference, Vector3Event, Vector3Vector3Event&gt;`.
/// </summary>
[EditorIcon("atom-icon-purple")]
[CreateAssetMenu(menuName = "Unity Atoms/Actions/Set Variable Value/Vector3", fileName = "SetVector3VariableValue")]
public sealed class SetVector3VariableValue : SetVariableValue<
Vector3,
Vector3Variable,
Vector3Constant,
Vector3Reference,
Vector3Event,
Vector3Vector3Event>

View File

@ -1,37 +1,58 @@
using UnityEngine;
namespace UnityAtoms
{
/// <summary>
/// None generic base class for `AtomReference&lt;T, V&gt;`.
/// </summary>
public abstract class AtomReference { }
public abstract class AtomReference<T, V> : AtomReference
where V : AtomBaseVariable<T>
public abstract class AtomReference
{
/// <summary>
/// If set to `true` then use constant instead of Variable value.
/// Enum for how to use the Reference.
/// </summary>
public bool UseConstant;
public enum Usage
{
Value = 0,
Constant = 1,
Variable = 2,
}
/// <summary>
/// Constant value used if `UseConstant` is set to `true`.
/// Should we use the provided value (via inspector), the Constant value or the Variable value?
/// </summary>
public T ConstantValue;
[SerializeField]
protected Usage _usage;
}
public abstract class AtomReference<T, V, C> : AtomReference
where V : AtomBaseVariable<T>
where C : AtomBaseVariable<T>
{
/// <summary>
/// Value used if `Usage` is set to `Value`.
/// </summary>
[SerializeField]
private T _value;
/// <summary>
/// Variable used if `UseConstant` is set to `false`.
/// Constant used if `Usage` is set to `Constant`.
/// </summary>
public V Variable;
public C _constant;
/// <summary>
/// Variable used if `Usage` is set to `Variable`.
/// </summary>
public V _variable;
protected AtomReference()
{
UseConstant = true;
_usage = AtomReference.Usage.Value;
}
protected AtomReference(T value) : this()
{
UseConstant = true;
ConstantValue = value;
_usage = AtomReference.Usage.Value;
_value = value;
}
/// <summary>
@ -40,10 +61,20 @@ namespace UnityAtoms
/// <value>The value of type `T`.</value>
public T Value
{
get { return UseConstant ? ConstantValue : Variable.Value; }
get
{
switch (_usage)
{
case (AtomReference.Usage.Constant): return _constant.Value;
case (AtomReference.Usage.Variable): return _variable.Value;
case (AtomReference.Usage.Value):
default:
return _value;
}
}
}
public static implicit operator T(AtomReference<T, V> reference)
public static implicit operator T(AtomReference<T, V, C> reference)
{
return reference.Value;
}

View File

@ -3,10 +3,11 @@ using System;
namespace UnityAtoms
{
/// <summary>
/// Reference of type `bool`. Inherits from `AtomReference&lt;bool, BoolVariable&gt;`.
/// Reference of type `bool`. Inherits from `AtomReference&lt;bool, BoolVariable, BoolConstant&gt;`.
/// </summary>
[Serializable]
public sealed class BoolReference : AtomReference<
bool,
BoolVariable> { }
BoolVariable,
BoolConstant> { }
}

View File

@ -4,10 +4,11 @@ using UnityEngine;
namespace UnityAtoms
{
/// <summary>
/// Reference of type `Collider2D`. Inherits from `AtomReference&lt;Collider2D, Collider2DVariable&gt;`.
/// Reference of type `Collider2D`. Inherits from `AtomReference&lt;Collider2D, Collider2DVariable, Collider2DConstant&gt;`.
/// </summary>
[Serializable]
public sealed class Collider2DReference : AtomReference<
Collider2D,
Collider2DVariable> { }
Collider2DVariable,
Collider2DConstant> { }
}

View File

@ -4,10 +4,11 @@ using UnityEngine;
namespace UnityAtoms
{
/// <summary>
/// Reference of type `Collider`. Inherits from `AtomReference&lt;Collider, ColliderVariable&gt;`.
/// Reference of type `Collider`. Inherits from `AtomReference&lt;Collider, ColliderVariable, ColliderConstant&gt;`.
/// </summary>
[Serializable]
public sealed class ColliderReference : AtomReference<
Collider,
ColliderVariable> { }
ColliderVariable,
ColliderConstant> { }
}

View File

@ -4,10 +4,11 @@ using UnityEngine;
namespace UnityAtoms
{
/// <summary>
/// Reference of type `Color`. Inherits from `AtomReference&lt;Color, ColorVariable&gt;`.
/// Reference of type `Color`. Inherits from `AtomReference&lt;Color, ColorVariable, ColorConstant&gt;`.
/// </summary>
[Serializable]
public sealed class ColorReference : AtomReference<
Color,
ColorVariable> { }
ColorVariable,
ColorConstant> { }
}

View File

@ -3,10 +3,11 @@ using System;
namespace UnityAtoms
{
/// <summary>
/// Reference of type `float`. Inherits from `AtomReference&lt;float, FloatVariable&gt;`.
/// Reference of type `float`. Inherits from `AtomReference&lt;float, FloatVariable, FloatConstant&gt;`.
/// </summary>
[Serializable]
public sealed class FloatReference : AtomReference<
float,
FloatVariable> { }
FloatVariable,
FloatConstant> { }
}

View File

@ -4,10 +4,11 @@ using UnityEngine;
namespace UnityAtoms
{
/// <summary>
/// Reference of type `GameObject`. Inherits from `AtomReference&lt;GameObject, GameObjectVariable&gt;`.
/// Reference of type `GameObject`. Inherits from `AtomReference&lt;GameObject, GameObjectVariable, GameObjectConstant&gt;`.
/// </summary>
[Serializable]
public sealed class GameObjectReference : AtomReference<
GameObject,
GameObjectVariable> { }
GameObjectVariable,
GameObjectConstant> { }
}

View File

@ -3,10 +3,11 @@ using System;
namespace UnityAtoms
{
/// <summary>
/// Reference of type `int`. Inherits from `AtomReference&lt;int, IntVariable&gt;`.
/// Reference of type `int`. Inherits from `AtomReference&lt;int, IntVariable, IntConstant&gt;`.
/// </summary>
[Serializable]
public sealed class IntReference : AtomReference<
int,
IntVariable> { }
IntVariable,
IntConstant> { }
}

View File

@ -3,10 +3,11 @@ using System;
namespace UnityAtoms
{
/// <summary>
/// Reference of type `string`. Inherits from `AtomReference&lt;string, StringVariable&gt;`.
/// Reference of type `string`. Inherits from `AtomReference&lt;string, StringVariable, StringConstant&gt;`.
/// </summary>
[Serializable]
public sealed class StringReference : AtomReference<
string,
StringVariable> { }
StringVariable,
StringConstant> { }
}

View File

@ -4,10 +4,11 @@ using UnityEngine;
namespace UnityAtoms
{
/// <summary>
/// Reference of type `Vector2`. Inherits from `AtomReference&lt;Vector2, Vector2Variable&gt;`.
/// Reference of type `Vector2`. Inherits from `AtomReference&lt;Vector2, Vector2Variable, Vector2Constant&gt;`.
/// </summary>
[Serializable]
public sealed class Vector2Reference : AtomReference<
Vector2,
Vector2Variable> { }
Vector2Variable,
Vector2Constant> { }
}

View File

@ -4,10 +4,11 @@ using UnityEngine;
namespace UnityAtoms
{
/// <summary>
/// Reference of type `Vector3`. Inherits from `AtomReference&lt;Vector3, Vector3Variable&gt;`.
/// Reference of type `Vector3`. Inherits from `AtomReference&lt;Vector3, Vector3Variable, Vector3Constant&gt;`.
/// </summary>
[Serializable]
public sealed class Vector3Reference : AtomReference<
Vector3,
Vector3Variable> { }
Vector3Variable,
Vector3Constant> { }
}

View File

@ -4,13 +4,14 @@ using UnityAtoms.Mobile;
namespace UnityAtoms.Mobile
{
/// <summary>
/// Set variable value Action of type `TouchUserInput`. Inherits from `SetVariableValue&lt;TouchUserInput, TouchUserInputVariable, TouchUserInputReference, TouchUserInputEvent, TouchUserInputTouchUserInputEvent&gt;`.
/// Set variable value Action of type `TouchUserInput`. Inherits from `SetVariableValue&lt;TouchUserInput, TouchUserInputVariable, TouchUserInputConstant, TouchUserInputReference, TouchUserInputEvent, TouchUserInputTouchUserInputEvent&gt;`.
/// </summary>
[EditorIcon("atom-icon-purple")]
[CreateAssetMenu(menuName = "Unity Atoms/Actions/Set Variable Value/TouchUserInput", fileName = "SetTouchUserInputVariableValue")]
public sealed class SetTouchUserInputVariableValue : SetVariableValue<
TouchUserInput,
TouchUserInputVariable,
TouchUserInputConstant,
TouchUserInputReference,
TouchUserInputEvent,
TouchUserInputTouchUserInputEvent>

View File

@ -4,10 +4,11 @@ using UnityAtoms.Mobile;
namespace UnityAtoms.Mobile
{
/// <summary>
/// Reference of type `TouchUserInput`. Inherits from `AtomReference&lt;TouchUserInput, TouchUserInputVariable&gt;`.
/// Reference of type `TouchUserInput`. Inherits from `AtomReference&lt;TouchUserInput, TouchUserInputVariable, TouchUserInputConstant&gt;`.
/// </summary>
[Serializable]
public sealed class TouchUserInputReference : AtomReference<
TouchUserInput,
TouchUserInputVariable> { }
TouchUserInputVariable,
TouchUserInputConstant> { }
}

View File

@ -4,13 +4,14 @@ using UnityAtoms.SceneMgmt;
namespace UnityAtoms.SceneMgmt
{
/// <summary>
/// Set variable value Action of type `SceneField`. Inherits from `SetVariableValue&lt;SceneField, SceneFieldVariable, SceneFieldReference, SceneFieldEvent, SceneFieldSceneFieldEvent&gt;`.
/// Set variable value Action of type `SceneField`. Inherits from `SetVariableValue&lt;SceneField, SceneFieldVariable, SceneFieldConstant, SceneFieldReference, SceneFieldEvent, SceneFieldSceneFieldEvent&gt;`.
/// </summary>
[EditorIcon("atom-icon-purple")]
[CreateAssetMenu(menuName = "Unity Atoms/Actions/Set Variable Value/SceneField", fileName = "SetSceneFieldVariableValue")]
public sealed class SetSceneFieldVariableValue : SetVariableValue<
SceneField,
SceneFieldVariable,
SceneFieldConstant,
SceneFieldReference,
SceneFieldEvent,
SceneFieldSceneFieldEvent>

View File

@ -4,10 +4,11 @@ using UnityAtoms.SceneMgmt;
namespace UnityAtoms.SceneMgmt
{
/// <summary>
/// Reference of type `SceneField`. Inherits from `AtomReference&lt;SceneField, SceneFieldVariable&gt;`.
/// Reference of type `SceneField`. Inherits from `AtomReference&lt;SceneField, SceneFieldVariable, SceneFieldConstant&gt;`.
/// </summary>
[Serializable]
public sealed class SceneFieldReference : AtomReference<
SceneField,
SceneFieldVariable> { }
SceneFieldVariable,
SceneFieldConstant> { }
}

View File

@ -607,6 +607,18 @@ A new toggle row (`VisualElement`).
---
## `RegenereateAllAtoms`
Internal utility class to regenerate all Atoms. Reachable via top menu bar and `Tools/Unity Atoms/Regenerate All Atoms`.
### Methods
#### `Regenereate`
Create the editor window.
---
## `Templating`
Internal class used for templating when generating new Atoms using the `Generator`.

View File

@ -407,58 +407,59 @@ Do the Action.
## `SetBoolVariableValue`
Set variable value Action of type `bool`. Inherits from `SetVariableValue<bool, BoolVariable, BoolReference, BoolEvent, BoolBoolEvent>`.
Set variable value Action of type `bool`. Inherits from `SetVariableValue<bool, BoolVariable, BoolConstant, BoolReference, BoolEvent, BoolBoolEvent>`.
---
## `SetCollider2DVariableValue`
Set variable value Action of type `Collider2D`. Inherits from `SetVariableValue<Collider2D, Collider2DVariable, Collider2DReference, Collider2DEvent, Collider2DCollider2DEvent>`.
Set variable value Action of type `Collider2D`. Inherits from `SetVariableValue<Collider2D, Collider2DVariable, Collider2DConstant, Collider2DReference, Collider2DEvent, Collider2DCollider2DEvent>`.
---
## `SetColliderVariableValue`
Set variable value Action of type `Collider`. Inherits from `SetVariableValue<Collider, ColliderVariable, ColliderReference, ColliderEvent, ColliderColliderEvent>`.
Set variable value Action of type `Collider`. Inherits from `SetVariableValue<Collider, ColliderVariable, ColliderConstant, ColliderReference, ColliderEvent, ColliderColliderEvent>`.
---
## `SetColorVariableValue`
Set variable value Action of type `Color`. Inherits from `SetVariableValue<Color, ColorVariable, ColorReference, ColorEvent, ColorColorEvent>`.
Set variable value Action of type `Color`. Inherits from `SetVariableValue<Color, ColorVariable, ColorConstant, ColorReference, ColorEvent, ColorColorEvent>`.
---
## `SetFloatVariableValue`
Set variable value Action of type `float`. Inherits from `SetVariableValue<float, FloatVariable, FloatReference, FloatEvent, FloatFloatEvent>`.
Set variable value Action of type `float`. Inherits from `SetVariableValue<float, FloatVariable, FloatConstant, FloatReference, FloatEvent, FloatFloatEvent>`.
---
## `SetGameObjectVariableValue`
Set variable value Action of type `GameObject`. Inherits from `SetVariableValue<GameObject, GameObjectVariable, GameObjectReference, GameObjectEvent, GameObjectGameObjectEvent>`.
Set variable value Action of type `GameObject`. Inherits from `SetVariableValue<GameObject, GameObjectVariable, GameObjectConstant, GameObjectReference, GameObjectEvent, GameObjectGameObjectEvent>`.
---
## `SetIntVariableValue`
Set variable value Action of type `int`. Inherits from `SetVariableValue<int, IntVariable, IntReference, IntEvent, IntIntEvent>`.
Set variable value Action of type `int`. Inherits from `SetVariableValue<int, IntVariable, IntConstant, IntReference, IntEvent, IntIntEvent>`.
---
## `SetStringVariableValue`
Set variable value Action of type `string`. Inherits from `SetVariableValue<string, StringVariable, StringReference, StringEvent, StringStringEvent>`.
Set variable value Action of type `string`. Inherits from `SetVariableValue<string, StringVariable, StringConstant, StringReference, StringEvent, StringStringEvent>`.
---
## `SetVariableValue<T,V,R,E1,E2>`
## `SetVariableValue<T,V,C,R,E1,E2>`
#### Type Parameters
- `T` - The type of the Variable to set.
- `V` - A Variable class of type `type` to set.
- `C` - A Constant class of type `type` to set.
- `R` - A Reference of type `type`.
- `E1` - An Event of type `type`.
- `E2` - An Event x 2 of type `type`.
@ -487,13 +488,13 @@ Perform the action.
## `SetVector2VariableValue`
Set variable value Action of type `Vector2`. Inherits from `SetVariableValue<Vector2, Vector2Variable, Vector2Reference, Vector2Event, Vector2Vector2Event>`.
Set variable value Action of type `Vector2`. Inherits from `SetVariableValue<Vector2, Vector2Variable, Vector2Constant, Vector2Reference, Vector2Event, Vector2Vector2Event>`.
---
## `SetVector3VariableValue`
Set variable value Action of type `Vector3`. Inherits from `SetVariableValue<Vector3, Vector3Variable, Vector3Reference, Vector3Event, Vector3Vector3Event>`.
Set variable value Action of type `Vector3`. Inherits from `SetVariableValue<Vector3, Vector3Variable, Vector3Constant, Vector3Reference, Vector3Event, Vector3Vector3Event>`.
---
@ -1646,65 +1647,77 @@ List of type `Vector3`. Inherits from `AtomList<Vector3, Vector3Event>`.
None generic base class for `AtomReference<T, V>`.
### Variables
#### `_usage`
Should we use the provided value (via inspector), the Constant value or the Variable value?
---
## `AtomReference.Usage`
Enum for how to use the Reference.
---
## `BoolReference`
Reference of type `bool`. Inherits from `AtomReference<bool, BoolVariable>`.
Reference of type `bool`. Inherits from `AtomReference<bool, BoolVariable, BoolConstant>`.
---
## `Collider2DReference`
Reference of type `Collider2D`. Inherits from `AtomReference<Collider2D, Collider2DVariable>`.
Reference of type `Collider2D`. Inherits from `AtomReference<Collider2D, Collider2DVariable, Collider2DConstant>`.
---
## `ColliderReference`
Reference of type `Collider`. Inherits from `AtomReference<Collider, ColliderVariable>`.
Reference of type `Collider`. Inherits from `AtomReference<Collider, ColliderVariable, ColliderConstant>`.
---
## `ColorReference`
Reference of type `Color`. Inherits from `AtomReference<Color, ColorVariable>`.
Reference of type `Color`. Inherits from `AtomReference<Color, ColorVariable, ColorConstant>`.
---
## `FloatReference`
Reference of type `float`. Inherits from `AtomReference<float, FloatVariable>`.
Reference of type `float`. Inherits from `AtomReference<float, FloatVariable, FloatConstant>`.
---
## `GameObjectReference`
Reference of type `GameObject`. Inherits from `AtomReference<GameObject, GameObjectVariable>`.
Reference of type `GameObject`. Inherits from `AtomReference<GameObject, GameObjectVariable, GameObjectConstant>`.
---
## `IntReference`
Reference of type `int`. Inherits from `AtomReference<int, IntVariable>`.
Reference of type `int`. Inherits from `AtomReference<int, IntVariable, IntConstant>`.
---
## `StringReference`
Reference of type `string`. Inherits from `AtomReference<string, StringVariable>`.
Reference of type `string`. Inherits from `AtomReference<string, StringVariable, StringConstant>`.
---
## `Vector2Reference`
Reference of type `Vector2`. Inherits from `AtomReference<Vector2, Vector2Variable>`.
Reference of type `Vector2`. Inherits from `AtomReference<Vector2, Vector2Variable, Vector2Constant>`.
---
## `Vector3Reference`
Reference of type `Vector3`. Inherits from `AtomReference<Vector3, Vector3Variable>`.
Reference of type `Vector3`. Inherits from `AtomReference<Vector3, Vector3Variable, Vector3Constant>`.
---

View File

@ -39,7 +39,7 @@ Update the `TouchUserInputVariable`.abstract Call this on every Update tick.
## `SetTouchUserInputVariableValue`
Set variable value Action of type `TouchUserInput`. Inherits from `SetVariableValue<TouchUserInput, TouchUserInputVariable, TouchUserInputReference, TouchUserInputEvent, TouchUserInputTouchUserInputEvent>`.
Set variable value Action of type `TouchUserInput`. Inherits from `SetVariableValue<TouchUserInput, TouchUserInputVariable, TouchUserInputConstant, TouchUserInputReference, TouchUserInputEvent, TouchUserInputTouchUserInputEvent>`.
---
@ -81,7 +81,7 @@ List of type `TouchUserInput`. Inherits from `AtomList<TouchUserInput, TouchUser
## `TouchUserInputReference`
Reference of type `TouchUserInput`. Inherits from `AtomReference<TouchUserInput, TouchUserInputVariable>`.
Reference of type `TouchUserInput`. Inherits from `AtomReference<TouchUserInput, TouchUserInputVariable, TouchUserInputConstant>`.
---

View File

@ -51,7 +51,7 @@ Action x 2 of type `SceneField`. Inherits from `AtomAction<SceneField, SceneFiel
## `SetSceneFieldVariableValue`
Set variable value Action of type `SceneField`. Inherits from `SetVariableValue<SceneField, SceneFieldVariable, SceneFieldReference, SceneFieldEvent, SceneFieldSceneFieldEvent>`.
Set variable value Action of type `SceneField`. Inherits from `SetVariableValue<SceneField, SceneFieldVariable, SceneFieldConstant, SceneFieldReference, SceneFieldEvent, SceneFieldSceneFieldEvent>`.
---
@ -93,7 +93,7 @@ List of type `SceneField`. Inherits from `AtomList<SceneField, SceneFieldEvent>`
## `SceneFieldReference`
Reference of type `SceneField`. Inherits from `AtomReference<SceneField, SceneFieldVariable>`.
Reference of type `SceneField`. Inherits from `AtomReference<SceneField, SceneFieldVariable, SceneFieldConstant>`.
---