Docs for mobile api

This commit is contained in:
AdamRamberg 2019-10-15 03:07:22 +02:00
parent a51ea7cffa
commit 13ab7b6fc3
46 changed files with 432 additions and 42 deletions

View File

@ -10,6 +10,9 @@ namespace UnityAtoms.{SUB_UA_NAMESPACE}.Editor
namespace UnityAtoms.Editor
<%ENDIF%>
{
/// <summary>
/// Constant property drawer of type `{TYPE}`. Inherits from `AtomDrawer&lt;{TYPE_NAME}Constant&gt;`.
/// </summary>
[CustomPropertyDrawer(typeof({TYPE_NAME}Constant))]
public class {TYPE_NAME}ConstantDrawer : AtomDrawer<{TYPE_NAME}Constant> { }
}

View File

@ -10,6 +10,9 @@ namespace UnityAtoms.{SUB_UA_NAMESPACE}.Editor
namespace UnityAtoms.Editor
<%ENDIF%>
{
/// <summary>
/// Event property drawer of type `{TYPE}`. Inherits from `AtomDrawer&lt;{TYPE_NAME}Event&gt;`.
/// </summary>
[CustomPropertyDrawer(typeof({TYPE_NAME}Event))]
public class {TYPE_NAME}EventDrawer : AtomDrawer<{TYPE_NAME}Event> { }
}

View File

@ -10,6 +10,9 @@ namespace UnityAtoms.{SUB_UA_NAMESPACE}.Editor
namespace UnityAtoms.Editor
<%ENDIF%>
{
/// <summary>
/// List property drawer of type `{TYPE}`. Inherits from `AtomDrawer&lt;{TYPE_NAME}List&gt;`.
/// </summary>
[CustomPropertyDrawer(typeof({TYPE_NAME}List))]
public class {TYPE_NAME}ListDrawer : AtomDrawer<{TYPE_NAME}List> { }
}

View File

@ -10,6 +10,9 @@ namespace UnityAtoms.{SUB_UA_NAMESPACE}.Editor
namespace UnityAtoms.Editor
<%ENDIF%>
{
/// <summary>
/// Variable property drawer of type `{TYPE}`. Inherits from `AtomDrawer&lt;{TYPE_NAME}Variable&gt;`.
/// </summary>
[CustomPropertyDrawer(typeof({TYPE_NAME}Variable))]
public class {TYPE_NAME}VariableDrawer : AtomDrawer<{TYPE_NAME}Variable> { }
}

View File

@ -10,6 +10,9 @@ namespace UnityAtoms.{SUB_UA_NAMESPACE}.Editor
namespace UnityAtoms.Editor
<%ENDIF%>
{
/// <summary>
/// Event x 2 property drawer of type `{TYPE}`. Inherits from `AtomDrawer&lt;{TYPE_NAME}{TYPE_NAME}Event&gt;`.
/// </summary>
[CustomPropertyDrawer(typeof({TYPE_NAME}{TYPE_NAME}Event))]
public class {TYPE_NAME}{TYPE_NAME}EventDrawer : AtomDrawer<{TYPE_NAME}{TYPE_NAME}Event> { }
}

View File

@ -14,6 +14,9 @@ namespace UnityAtoms.{SUB_UA_NAMESPACE}.Editor
namespace UnityAtoms.Editor
<%ENDIF%>
{
/// <summary>
/// Event property drawer of type `{TYPE}`. Inherits from `AtomEventEditor&lt;{TYPE}, {TYPE_NAME}Event&gt;`.
/// </summary>
[CustomEditor(typeof({TYPE_NAME}Event))]
public sealed class {TYPE_NAME}EventEditor : AtomEventEditor<{TYPE}, {TYPE_NAME}Event>
{

View File

@ -8,6 +8,9 @@ namespace UnityAtoms.{SUB_UA_NAMESPACE}
namespace UnityAtoms
<%ENDIF%>
{
/// <summary>
/// Action of type `{TYPE}`. Inherits from `AtomAction&lt;{TYPE}&gt;`.
/// </summary>
[EditorIcon("atom-icon-purple")]
public abstract class {TYPE_NAME}Action : AtomAction<{TYPE}> { }
}

View File

@ -9,6 +9,9 @@ namespace UnityAtoms.{SUB_UA_NAMESPACE}
namespace UnityAtoms
<%ENDIF%>
{
/// <summary>
/// Constant of type `{TYPE}`. Inherits from `AtomBaseVariable&lt;{TYPE}&gt;`.
/// </summary>
[EditorIcon("atom-icon-teal")]
[CreateAssetMenu(menuName = "Unity Atoms/Constants/{TYPE_NAME}", fileName = "{TYPE_NAME}Constant")]
public sealed class {TYPE_NAME}Constant : AtomBaseVariable<{TYPE}> { }

View File

@ -9,6 +9,9 @@ namespace UnityAtoms.{SUB_UA_NAMESPACE}
namespace UnityAtoms
<%ENDIF%>
{
/// <summary>
/// Event of type `{TYPE}`. Inherits from `AtomEvent&lt;{TYPE}&gt;`.
/// </summary>
[EditorIcon("atom-icon-cherry")]
[CreateAssetMenu(menuName = "Unity Atoms/Events/{TYPE_NAME}", fileName = "{TYPE_NAME}Event")]
public sealed class {TYPE_NAME}Event : AtomEvent<{TYPE}> { }

View File

@ -9,6 +9,9 @@ namespace UnityAtoms.{SUB_UA_NAMESPACE}
namespace UnityAtoms
<%ENDIF%>
{
/// <summary>
/// List of type `{TYPE}`. Inherits from `AtomList&lt;{TYPE}, {TYPE_NAME}Event&gt;`.
/// </summary>
[EditorIcon("atom-icon-piglet")]
[CreateAssetMenu(menuName = "Unity Atoms/Lists/{TYPE_NAME}", fileName = "{TYPE_NAME}List")]
public sealed class {TYPE_NAME}List : AtomList<{TYPE}, {TYPE_NAME}Event> { }

View File

@ -9,6 +9,9 @@ namespace UnityAtoms.{SUB_UA_NAMESPACE}
namespace UnityAtoms
<%ENDIF%>
{
/// <summary>
/// Listener of type `{TYPE}`. Inherits from `AtomListener&lt;{TYPE}, {TYPE_NAME}Action, {TYPE_NAME}Event, {TYPE_NAME}UnityEvent&gt;`.
/// </summary>
[EditorIcon("atom-icon-orange")]
[AddComponentMenu("Unity Atoms/Listeners/{TYPE_NAME}")]
public sealed class {TYPE_NAME}Listener : AtomListener<

View File

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

View File

@ -9,6 +9,9 @@ namespace UnityAtoms.{SUB_UA_NAMESPACE}
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;`.
/// </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<

View File

@ -10,6 +10,9 @@ namespace UnityAtoms.{SUB_UA_NAMESPACE}
namespace UnityAtoms
<%ENDIF%>
{
/// <summary>
/// Unity Event of type `{TYPE}`. Inherits from `UnityEvent&lt;{TYPE}&gt;`.
/// </summary>
[Serializable]
public sealed class {TYPE_NAME}UnityEvent : UnityEvent<{TYPE}> { }
}

View File

@ -12,11 +12,19 @@ namespace UnityAtoms.{SUB_UA_NAMESPACE}
namespace UnityAtoms
<%ENDIF%>
{
<%IF EQUATABLE%>
/// <summary>
/// Variable of type `{TYPE}`. Inherits from `EquatableAtomVariable&lt;{TYPE}, {TYPE_NAME}Event, {TYPE_NAME}{TYPE_NAME}Event&gt;`.
/// </summary>
[EditorIcon("atom-icon-lush")]
[CreateAssetMenu(menuName = "Unity Atoms/Variables/{TYPE_NAME}", fileName = "{TYPE_NAME}Variable")]
<%IF EQUATABLE%>
public sealed class {TYPE_NAME}Variable : EquatableAtomVariable<{TYPE}, {TYPE_NAME}Event, {TYPE_NAME}{TYPE_NAME}Event> { }
<%ELSE%>
/// <summary>
/// Variable of type `{TYPE}`. Inherits from `AtomVariable&lt;{TYPE}, {TYPE_NAME}Event, {TYPE_NAME}{TYPE_NAME}Event&gt;`.
/// </summary>
[EditorIcon("atom-icon-lush")]
[CreateAssetMenu(menuName = "Unity Atoms/Variables/{TYPE_NAME}", fileName = "{TYPE_NAME}Variable")]
public sealed class {TYPE_NAME}Variable : AtomVariable<{TYPE}, {TYPE_NAME}Event, {TYPE_NAME}{TYPE_NAME}Event>
{
protected override bool AreEqual({TYPE} first, {TYPE} second)

View File

@ -8,6 +8,9 @@ namespace UnityAtoms.{SUB_UA_NAMESPACE}
namespace UnityAtoms
<%ENDIF%>
{
/// <summary>
/// Action x 2 of type `{TYPE}`. Inherits from `AtomAction&lt;{TYPE}, {TYPE}&gt;`.
/// </summary>
[EditorIcon("atom-icon-purple")]
public abstract class {TYPE_NAME}{TYPE_NAME}Action : AtomAction<{TYPE}, {TYPE}> { }
}

View File

@ -9,6 +9,9 @@ namespace UnityAtoms.{SUB_UA_NAMESPACE}
namespace UnityAtoms
<%ENDIF%>
{
/// <summary>
/// Event x 2 of type `{TYPE}`. Inherits from `AtomEvent&lt;{TYPE}, {TYPE}&gt;`.
/// </summary>
[EditorIcon("atom-icon-cherry")]
[CreateAssetMenu(menuName = "Unity Atoms/Events/{TYPE_NAME} x 2", fileName = "{TYPE_NAME}{TYPE_NAME}Event")]
public sealed class {TYPE_NAME}{TYPE_NAME}Event : AtomEvent<{TYPE}, {TYPE}> { }

View File

@ -9,6 +9,9 @@ namespace UnityAtoms.{SUB_UA_NAMESPACE}
namespace UnityAtoms
<%ENDIF%>
{
/// <summary>
/// Listener x 2 of type `{TYPE}`. Inherits from `AtomListener&lt;{TYPE}, {TYPE}, {TYPE_NAME}{TYPE_NAME}Action, {TYPE_NAME}{TYPE_NAME}Event, {TYPE_NAME}{TYPE_NAME}UnityEvent&gt;`.
/// </summary>
[EditorIcon("atom-icon-orange")]
[AddComponentMenu("Unity Atoms/Listeners/{TYPE_NAME} - {TYPE_NAME}")]
public sealed class {TYPE_NAME}{TYPE_NAME}Listener : AtomListener<

View File

@ -10,6 +10,9 @@ namespace UnityAtoms.{SUB_UA_NAMESPACE}
namespace UnityAtoms
<%ENDIF%>
{
/// <summary>
/// Unity Event x 2 of type `{TYPE}`. Inherits from `UnityEvent&lt;{TYPE}, {TYPE}&gt;`.
/// </summary>
[Serializable]
public sealed class {TYPE_NAME}{TYPE_NAME}UnityEvent : UnityEvent<{TYPE}, {TYPE}> { }
}

View File

@ -4,6 +4,9 @@ using UnityAtoms.Editor;
namespace UnityAtoms.Mobile.Editor
{
/// <summary>
/// Constant property drawer of type `TouchUserInput`. Inherits from `AtomDrawer&lt;TouchUserInputConstant&gt;`.
/// </summary>
[CustomPropertyDrawer(typeof(TouchUserInputConstant))]
public class TouchUserInputConstantDrawer : AtomDrawer<TouchUserInputConstant> { }
}

View File

@ -4,6 +4,9 @@ using UnityAtoms.Editor;
namespace UnityAtoms.Mobile.Editor
{
/// <summary>
/// Event property drawer of type `TouchUserInput`. Inherits from `AtomDrawer&lt;TouchUserInputEvent&gt;`.
/// </summary>
[CustomPropertyDrawer(typeof(TouchUserInputEvent))]
public class TouchUserInputEventDrawer : AtomDrawer<TouchUserInputEvent> { }
}

View File

@ -4,6 +4,9 @@ using UnityAtoms.Editor;
namespace UnityAtoms.Mobile.Editor
{
/// <summary>
/// Event x 2 property drawer of type `TouchUserInput`. Inherits from `AtomDrawer&lt;TouchUserInputTouchUserInputEvent&gt;`.
/// </summary>
[CustomPropertyDrawer(typeof(TouchUserInputTouchUserInputEvent))]
public class TouchUserInputTouchUserInputEventDrawer : AtomDrawer<TouchUserInputTouchUserInputEvent> { }
}

View File

@ -4,6 +4,9 @@ using UnityAtoms.Editor;
namespace UnityAtoms.Mobile.Editor
{
/// <summary>
/// List property drawer of type `TouchUserInput`. Inherits from `AtomDrawer&lt;TouchUserInputList&gt;`.
/// </summary>
[CustomPropertyDrawer(typeof(TouchUserInputList))]
public class TouchUserInputListDrawer : AtomDrawer<TouchUserInputList> { }
}

View File

@ -4,6 +4,9 @@ using UnityAtoms.Editor;
namespace UnityAtoms.Mobile.Editor
{
/// <summary>
/// Variable property drawer of type `TouchUserInput`. Inherits from `AtomDrawer&lt;TouchUserInputVariable&gt;`.
/// </summary>
[CustomPropertyDrawer(typeof(TouchUserInputVariable))]
public class TouchUserInputVariableDrawer : AtomDrawer<TouchUserInputVariable> { }
}

View File

@ -5,6 +5,9 @@ using UnityAtoms.Editor;
namespace UnityAtoms.Mobile.Editor
{
/// <summary>
/// Event property drawer of type `TouchUserInput`. Inherits from `AtomEventEditor&lt;TouchUserInput, TouchUserInputEvent&gt;`.
/// </summary>
[CustomEditor(typeof(TouchUserInputEvent))]
public sealed class TouchUserInputEventEditor : AtomEventEditor<TouchUserInput, TouchUserInputEvent>
{

View File

@ -2,6 +2,9 @@ using UnityEngine;
namespace UnityAtoms.Mobile
{
/// <summary>
/// Set variable value Action of type `TouchUserInput`. Inherits from `SetVariableValue&lt;TouchUserInput, TouchUserInputVariable, 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<

View File

@ -1,5 +1,8 @@
namespace UnityAtoms.Mobile
{
/// <summary>
/// Action of type `TouchUserInput`. Inherits from `AtomAction&lt;TouchUserInput&gt;`.
/// </summary>
[EditorIcon("atom-icon-purple")]
public abstract class TouchUserInputAction : AtomAction<TouchUserInput> { }
}

View File

@ -1,5 +1,8 @@
namespace UnityAtoms.Mobile
{
/// <summary>
/// Action x 2 of type `TouchUserInput`. Inherits from `AtomAction&lt;TouchUserInput, TouchUserInput&gt;`.
/// </summary>
[EditorIcon("atom-icon-purple")]
public abstract class TouchUserInputTouchUserInputAction : AtomAction<TouchUserInput, TouchUserInput> { }
}

View File

@ -3,11 +3,15 @@ using UnityAtoms;
namespace UnityAtoms.Mobile
{
/* Updates the TouchUserInputVariable on every Update tick. Meant to be called every Update.
*/
/// <summary>
/// Updates the `TouchUserInputVariable` on every Update tick. Meant to be called every Update.
/// </summary>
[CreateAssetMenu(menuName = "Unity Atoms/Actions/UpdateTouchUserInput", fileName = "UpdateTouchUserInputVariable")]
public sealed class UpdateTouchUserInput : VoidAction
{
/// <summary>
/// The `TouchUserInputVariable` to update.
/// </summary>
public TouchUserInputVariable TouchUserInputVariable;
private TouchUserInput.State _inputState = TouchUserInput.State.None;
@ -18,6 +22,9 @@ namespace UnityAtoms.Mobile
private Vector2 _inputPosLastDown = Vector2.zero;
/// <summary>
/// Update the `TouchUserInputVariable`.abstract Call this on every Update tick.
/// </summary>
public override void Do()
{
#if (UNITY_ANDROID || UNITY_IOS || UNITY_IPHONE) && !UNITY_EDITOR

View File

@ -2,6 +2,9 @@ using UnityEngine;
namespace UnityAtoms.Mobile
{
/// <summary>
/// Constant of type `TouchUserInput`. Inherits from `AtomBaseVariable&lt;TouchUserInput&gt;`.
/// </summary>
[EditorIcon("atom-icon-teal")]
[CreateAssetMenu(menuName = "Unity Atoms/Constants/TouchUserInput", fileName = "TouchUserInputConstant")]
public sealed class TouchUserInputConstant : AtomBaseVariable<TouchUserInput> { }

View File

@ -2,6 +2,9 @@ using UnityEngine;
namespace UnityAtoms.Mobile
{
/// <summary>
/// Event of type `TouchUserInput`. Inherits from `AtomEvent&lt;TouchUserInput&gt;`.
/// </summary>
[EditorIcon("atom-icon-cherry")]
[CreateAssetMenu(menuName = "Unity Atoms/Events/TouchUserInput", fileName = "TouchUserInputEvent")]
public sealed class TouchUserInputEvent : AtomEvent<TouchUserInput> { }

View File

@ -2,6 +2,9 @@ using UnityEngine;
namespace UnityAtoms.Mobile
{
/// <summary>
/// Event x 2 of type `TouchUserInput`. Inherits from `AtomEvent&lt;TouchUserInput, TouchUserInput&gt;`.
/// </summary>
[EditorIcon("atom-icon-cherry")]
[CreateAssetMenu(menuName = "Unity Atoms/Events/TouchUserInput x 2", fileName = "TouchUserInputTouchUserInputEvent")]
public sealed class TouchUserInputTouchUserInputEvent : AtomEvent<TouchUserInput, TouchUserInput> { }

View File

@ -2,6 +2,9 @@ using UnityEngine;
namespace UnityAtoms.Mobile
{
/// <summary>
/// Listener of type `TouchUserInput`. Inherits from `AtomListener&lt;TouchUserInput, TouchUserInputAction, TouchUserInputEvent, TouchUserInputUnityEvent&gt;`.
/// </summary>
[EditorIcon("atom-icon-orange")]
[AddComponentMenu("Unity Atoms/Listeners/TouchUserInput")]
public sealed class TouchUserInputListener : AtomListener<

View File

@ -2,6 +2,9 @@ using UnityEngine;
namespace UnityAtoms.Mobile
{
/// <summary>
/// Listener x 2 of type `TouchUserInput`. Inherits from `AtomListener&lt;TouchUserInput, TouchUserInput, TouchUserInputTouchUserInputAction, TouchUserInputTouchUserInputEvent, TouchUserInputTouchUserInputUnityEvent&gt;`.
/// </summary>
[EditorIcon("atom-icon-orange")]
[AddComponentMenu("Unity Atoms/Listeners/TouchUserInput - TouchUserInput")]
public sealed class TouchUserInputTouchUserInputListener : AtomListener<

View File

@ -2,6 +2,9 @@ using UnityEngine;
namespace UnityAtoms.Mobile
{
/// <summary>
/// List of type `TouchUserInput`. Inherits from `AtomList&lt;TouchUserInput, TouchUserInputEvent&gt;`.
/// </summary>
[EditorIcon("atom-icon-piglet")]
[CreateAssetMenu(menuName = "Unity Atoms/Lists/TouchUserInput", fileName = "TouchUserInputList")]
public sealed class TouchUserInputList : AtomList<TouchUserInput, TouchUserInputEvent> { }

View File

@ -2,6 +2,9 @@ using System;
namespace UnityAtoms.Mobile
{
/// <summary>
/// Reference of type `TouchUserInput`. Inherits from `AtomReference&lt;TouchUserInput, TouchUserInputVariable&gt;`.
/// </summary>
[Serializable]
public sealed class TouchUserInputReference : AtomReference<
TouchUserInput,

View File

@ -4,9 +4,15 @@ using UnityAtoms;
namespace UnityAtoms.Mobile
{
/// <summary>
/// Module class holding data for touch user input.
/// </summary>
[Serializable]
public struct TouchUserInput : IEquatable<TouchUserInput>
{
/// <summary>
/// Enum for different touch user input states.
/// </summary>
public enum State
{
None,
@ -15,14 +21,51 @@ namespace UnityAtoms.Mobile
Up
};
/// <summary>
/// Current input state.
/// </summary>
public State InputState;
/// <summary>
/// Current input position.
/// </summary>
public Vector2 InputPos;
/// <summary>
/// Input position last frame.
/// </summary>
public Vector2 InputPosLastFrame;
/// <summary>
/// Input position last time the user pressed down.
/// </summary>
public Vector2 InputPosLastDown;
/// <summary>
/// The input position in world space.
/// </summary>
/// <returns>The input position in world space.</returns>
public Vector2 InputWorldPos { get { return Camera.main.ScreenToWorldPoint(InputPos); } }
/// <summary>
/// The input position in world space from last frame.
/// </summary>
/// <returns>The input position in world space from last frame.</returns>
public Vector2 InputWorldPosLastFrame { get { return Camera.main.ScreenToWorldPoint(InputPosLastFrame); } }
/// <summary>
/// Input position last time the user pressed down in world space.
/// </summary>
/// <returns>Input position last time the user pressed down in world space.</returns>
public Vector2 InputWorldPosLastDown { get { return Camera.main.ScreenToWorldPoint(InputPosLastDown); } }
/// <summary>
/// Create a `TouchUserInput` class.
/// </summary>
/// <param name="inputState">Initial input state.</param>
/// <param name="inputPos">Initial input position.</param>
/// <param name="inputPosLastFrame">Initial input position last frame.</param>
/// <param name="inputPosLastDown">Initial input position last time the user pressed down.</param>
public TouchUserInput(State inputState, Vector2 inputPos, Vector2 inputPosLastFrame, Vector2 inputPosLastDown)
{
this.InputState = inputState;
@ -31,17 +74,31 @@ namespace UnityAtoms.Mobile
this.InputPosLastDown = inputPosLastDown;
}
/// <summary>
/// Determine if 2 `TouchUserInput` are equal.
/// </summary>
/// <param name="other">The other `TouchUserInput` to compare with.</param>
/// <returns>`true` if equal, otherwise `false`.</returns>
public bool Equals(TouchUserInput other)
{
return this.InputState == other.InputState && this.InputWorldPos == other.InputWorldPos && this.InputWorldPosLastFrame == other.InputWorldPosLastFrame;
}
/// <summary>
/// Determine if 2 `TouchUserInput` are equal comparing against another `object`.
/// </summary>
/// <param name="obj">The other `object` to compare with.</param>
/// <returns>`true` if equal, otherwise `false`.</returns>
public override bool Equals(object obj)
{
TouchUserInput tui = (TouchUserInput)obj;
return Equals(tui);
}
/// <summary>
/// `GetHashCode()` in order to implement `IEquatable&lt;TouchUserInput&gt;`
/// </summary>
/// <returns>An unique hashcode for the current value.</returns>
public override int GetHashCode()
{
var hash = 17;
@ -51,11 +108,23 @@ namespace UnityAtoms.Mobile
return hash;
}
/// <summary>
/// Equality operator
/// </summary>
/// <param name="touch1">First `TouchUserInput`.</param>
/// <param name="touch2">Other `TouchUserInput`.</param>
/// <returns>`true` if equal, otherwise `false`.</returns>
public static bool operator ==(TouchUserInput touch1, TouchUserInput touch2)
{
return touch1.Equals(touch2);
}
/// <summary>
/// Inequality operator
/// </summary>
/// <param name="touch1">First `TouchUserInput`.</param>
/// <param name="touch2">Other `TouchUserInput`.</param>
/// <returns>`true` if they are not equal, otherwise `false`.</returns>
public static bool operator !=(TouchUserInput touch1, TouchUserInput touch2)
{
return !touch1.Equals(touch2);

View File

@ -3,6 +3,9 @@ using UnityEngine.Events;
namespace UnityAtoms.Mobile
{
/// <summary>
/// Unity Event x 2 of type `TouchUserInput`. Inherits from `UnityEvent&lt;TouchUserInput, TouchUserInput&gt;`.
/// </summary>
[Serializable]
public sealed class TouchUserInputTouchUserInputUnityEvent : UnityEvent<TouchUserInput, TouchUserInput> { }
}

View File

@ -3,6 +3,9 @@ using UnityEngine.Events;
namespace UnityAtoms.Mobile
{
/// <summary>
/// Unity Event of type `TouchUserInput`. Inherits from `UnityEvent&lt;TouchUserInput&gt;`.
/// </summary>
[Serializable]
public sealed class TouchUserInputUnityEvent : UnityEvent<TouchUserInput> { }
}

View File

@ -2,6 +2,9 @@ using UnityEngine;
namespace UnityAtoms.Mobile
{
/// <summary>
/// Variable of type `TouchUserInput`. Inherits from `EquatableAtomVariable&lt;TouchUserInput, TouchUserInputEvent, TouchUserInputTouchUserInputEvent&gt;`.
/// </summary>
[EditorIcon("atom-icon-lush")]
[CreateAssetMenu(menuName = "Unity Atoms/Variables/TouchUserInput", fileName = "TouchUserInputVariable")]
public sealed class TouchUserInputVariable : EquatableAtomVariable<TouchUserInput, TouchUserInputEvent, TouchUserInputTouchUserInputEvent> { }

View File

@ -10,6 +10,7 @@
- [UnityAtoms](./api/unityatoms.md)
- [UnityAtoms.Editor](./api/unityatoms.editor.md)
- [UnityAtoms.Tags](./api/unityatoms.tags.md)
- [UnityAtoms.Mobile](./api/unityatoms.mobile.md)
- Subpackages
- [Mobile](./subpackages/mobile.md)
- [SceneMgmt](./subpackages/scene-mgmt.md)

View File

@ -0,0 +1,224 @@
---
id: unityatoms.mobile
title: UnityAtoms.Mobile
hide_title: true
sidebar_label: UnityAtoms.Mobile
---
# Namespace - `UnityAtoms.Mobile`
## `TouchUserInputAction`
Action of type `TouchUserInput`. Inherits from `AtomAction<TouchUserInput>`.
---
## `TouchUserInputTouchUserInputAction`
Action x 2 of type `TouchUserInput`. Inherits from `AtomAction<TouchUserInput, TouchUserInput>`.
---
## `UpdateTouchUserInput`
Updates the `TouchUserInputVariable` on every Update tick. Meant to be called every Update.
### Variables
#### `TouchUserInputVariable`
The `TouchUserInputVariable` to update.
### Methods
#### `Do`
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>`.
---
## `TouchUserInputConstant`
Constant of type `TouchUserInput`. Inherits from `AtomBaseVariable<TouchUserInput>`.
---
## `TouchUserInputEvent`
Event of type `TouchUserInput`. Inherits from `AtomEvent<TouchUserInput>`.
---
## `TouchUserInputTouchUserInputEvent`
Event x 2 of type `TouchUserInput`. Inherits from `AtomEvent<TouchUserInput, TouchUserInput>`.
---
## `TouchUserInputListener`
Listener of type `TouchUserInput`. Inherits from `AtomListener<TouchUserInput, TouchUserInputAction, TouchUserInputEvent, TouchUserInputUnityEvent>`.
---
## `TouchUserInputTouchUserInputListener`
Listener x 2 of type `TouchUserInput`. Inherits from `AtomListener<TouchUserInput, TouchUserInput, TouchUserInputTouchUserInputAction, TouchUserInputTouchUserInputEvent, TouchUserInputTouchUserInputUnityEvent>`.
---
## `TouchUserInputList`
List of type `TouchUserInput`. Inherits from `AtomList<TouchUserInput, TouchUserInputEvent>`.
---
## `TouchUserInputReference`
Reference of type `TouchUserInput`. Inherits from `AtomReference<TouchUserInput, TouchUserInputVariable>`.
---
## `TouchUserInput`
Module class holding data for touch user input.
### Variables
#### `InputState`
Current input state.
---
#### `InputPos`
Current input position.
---
#### `InputPosLastFrame`
Input position last frame.
---
#### `InputPosLastDown`
Input position last time the user pressed down.
### Properties
#### `InputWorldPos`
The input position in world space.
---
#### `InputWorldPosLastFrame`
The input position in world space from last frame.
---
#### `InputWorldPosLastDown`
Input position last time the user pressed down in world space.
### Methods
#### `#ctor(UnityAtoms.Mobile.TouchUserInput.State,UnityEngine.Vector2,UnityEngine.Vector2,UnityEngine.Vector2)`
Create a `TouchUserInput` class.
##### Parameters
- `inputState` - Initial input state.
- `inputPos` - Initial input position.
- `inputPosLastFrame` - Initial input position last frame.
- `inputPosLastDown` - Initial input position last time the user pressed down.
---
#### `Equals(UnityAtoms.Mobile.TouchUserInput)`
Determine if 2 `TouchUserInput` are equal.
##### Parameters
- `other` - The other `TouchUserInput` to compare with.
##### Returns
`true` if equal, otherwise `false`.
---
#### `Equals(System.Object)`
Determine if 2 `TouchUserInput` are equal comparing against another `object`.
##### Parameters
- `obj` - The other `object` to compare with.
##### Returns
`true` if equal, otherwise `false`.
---
#### `GetHashCode`
`GetHashCode()` in order to implement `IEquatable<TouchUserInput>`
##### Returns
An unique hashcode for the current value.
---
#### `op_Equality(UnityAtoms.Mobile.TouchUserInput,UnityAtoms.Mobile.TouchUserInput)`
Equality operator
##### Parameters
- `touch1` - First `TouchUserInput`.
- `touch2` - Other `TouchUserInput`.
##### Returns
`true` if equal, otherwise `false`.
---
#### `op_Inequality(UnityAtoms.Mobile.TouchUserInput,UnityAtoms.Mobile.TouchUserInput)`
Inequality operator
##### Parameters
- `touch1` - First `TouchUserInput`.
- `touch2` - Other `TouchUserInput`.
##### Returns
`true` if they are not equal, otherwise `false`.
---
## `TouchUserInput.State`
Enum for different touch user input states.
---
## `TouchUserInputTouchUserInputUnityEvent`
Unity Event x 2 of type `TouchUserInput`. Inherits from `UnityEvent<TouchUserInput, TouchUserInput>`.
---
## `TouchUserInputUnityEvent`
Unity Event of type `TouchUserInput`. Inherits from `UnityEvent<TouchUserInput>`.
---
## `TouchUserInputVariable`
Variable of type `TouchUserInput`. Inherits from `EquatableAtomVariable<TouchUserInput, TouchUserInputEvent, TouchUserInputTouchUserInputEvent>`.
---

View File

@ -7,8 +7,4 @@ sidebar_label: Mobile
# Unity Atoms / Mobile
Unity Atoms for your mobile project.
## API
[**TODO**]
Unity Atoms specific for mobile projects. See the [API](../api/unityatoms.mobile) for more info.

View File

@ -22,7 +22,8 @@
"publish:mobile": "npm publish ./Packages/Mobile --tag beta",
"publish:scene": "npm publish ./Packages/SceneMgmt --tag beta",
"publish:tags": "npm publish ./Packages/Tags --tag beta",
"publish:ui": "npm publish ./Packages/UI --tag beta"
"publish:ui": "npm publish ./Packages/UI --tag beta",
"generate:docs": "node scripts/generateDocs.js"
},
"files": [
"/LICENSE.md",

View File

@ -5,38 +5,6 @@
"previous": "Previous",
"tagline": "Tiny modular pieces utilizing the power of Scriptable Objects",
"docs": {
"api/actions": {
"title": "Actions",
"sidebar_label": "Actions"
},
"api/constants": {
"title": "Constants",
"sidebar_label": "Constants"
},
"api/events": {
"title": "Events",
"sidebar_label": "Events"
},
"api/functions": {
"title": "Functions",
"sidebar_label": "Functions"
},
"api/listeners": {
"title": "Listeners",
"sidebar_label": "Listeners"
},
"api/lists": {
"title": "Lists",
"sidebar_label": "Lists"
},
"api/references": {
"title": "References",
"sidebar_label": "References"
},
"api/unity-events": {
"title": "Unity Events",
"sidebar_label": "Unity Events"
},
"api/unityatoms.editor": {
"title": "UnityAtoms.Editor",
"sidebar_label": "UnityAtoms.Editor"
@ -45,6 +13,10 @@
"title": "UnityAtoms",
"sidebar_label": "UnityAtoms"
},
"api/unityatoms.mobile": {
"title": "UnityAtoms.Mobile",
"sidebar_label": "UnityAtoms.Mobile"
},
"api/unityatoms.tags": {
"title": "UnityAtoms.Tags",
"sidebar_label": "UnityAtoms.Tags"

View File

@ -10,7 +10,8 @@
"API Reference": [
"api/unityatoms",
"api/unityatoms.editor",
"api/unityatoms.tags"
"api/unityatoms.tags",
"api/unityatoms.mobile"
],
"Subpackages": [
"subpackages/mobile",