2018-10-30 15:05:06 -04:00
|
|
|
using UnityEngine;
|
2019-04-07 10:03:16 -04:00
|
|
|
using UnityEngine.Serialization;
|
2018-10-30 15:05:06 -04:00
|
|
|
|
|
|
|
namespace UnityAtoms
|
|
|
|
{
|
2019-10-15 14:44:25 -04:00
|
|
|
/// <summary>
|
|
|
|
/// Base class for all SetVariableValue Actions. Inherits from `VoidAction`.
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="T">The type of the Variable to set.</typeparam>
|
|
|
|
/// <typeparam name="V">A Variable class of type `type` to set.</typeparam>
|
2019-10-16 12:02:08 -04:00
|
|
|
/// <typeparam name="C">A Constant class of type `type` to set.</typeparam>
|
2019-10-15 14:44:25 -04:00
|
|
|
/// <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>
|
2019-10-16 12:02:08 -04:00
|
|
|
public abstract class SetVariableValue<T, V, C, R, E1, E2> : VoidAction
|
2019-09-25 15:05:06 -04:00
|
|
|
where E1 : AtomEvent<T>
|
|
|
|
where E2 : AtomEvent<T, T>
|
|
|
|
where V : AtomVariable<T, E1, E2>
|
2019-10-16 12:02:08 -04:00
|
|
|
where C : AtomBaseVariable<T>
|
|
|
|
where R : AtomReference<T, V, C>
|
2018-10-30 15:05:06 -04:00
|
|
|
{
|
2019-10-15 14:44:25 -04:00
|
|
|
/// <summary>
|
|
|
|
/// The Variable to set.
|
|
|
|
/// </summary>
|
2018-10-30 15:05:06 -04:00
|
|
|
[SerializeField]
|
2019-04-08 10:14:50 -04:00
|
|
|
private V _variable = null;
|
2018-10-30 15:05:06 -04:00
|
|
|
|
2019-10-15 14:44:25 -04:00
|
|
|
/// <summary>
|
|
|
|
/// The value to set.
|
|
|
|
/// </summary>
|
2018-10-30 15:05:06 -04:00
|
|
|
[SerializeField]
|
2019-04-08 10:14:50 -04:00
|
|
|
private R _value = null;
|
2018-10-30 15:05:06 -04:00
|
|
|
|
2019-10-15 14:44:25 -04:00
|
|
|
/// <summary>
|
|
|
|
/// Perform the action.
|
|
|
|
/// </summary>
|
2018-10-30 15:05:06 -04:00
|
|
|
public override void Do()
|
|
|
|
{
|
2019-04-07 10:03:16 -04:00
|
|
|
_variable.Value = _value.Value;
|
2018-10-30 15:05:06 -04:00
|
|
|
}
|
|
|
|
}
|
2019-03-17 18:43:20 -04:00
|
|
|
}
|