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>
|
2020-03-01 15:32:52 -05:00
|
|
|
/// <typeparam name="P">A IPair of type T.</typeparam>
|
|
|
|
/// <typeparam name="C">A Constant class of type `T` to set.</typeparam>
|
|
|
|
/// <typeparam name="R">A Reference of type `T`.</typeparam>
|
|
|
|
/// <typeparam name="E1">An Event of type `T`.</typeparam>
|
|
|
|
/// <typeparam name="E2">An Event x 2 of type `T`.</typeparam>
|
|
|
|
/// <typeparam name="F">A Function x 2 of type `T`.</typeparam>
|
|
|
|
/// <typeparam name="VI">A Variable Instancer of type `T`.</typeparam>
|
2020-03-04 18:48:39 -05:00
|
|
|
public abstract class SetVariableValue<T, P, V, C, R, E1, E2, F, VI, CO, L> : AtomAction
|
2020-03-01 20:26:06 -05:00
|
|
|
where P : struct, IPair<T>
|
2019-09-25 15:05:06 -04:00
|
|
|
where E1 : AtomEvent<T>
|
2020-03-01 15:32:52 -05:00
|
|
|
where E2 : AtomEvent<P>
|
2020-02-16 06:44:46 -05:00
|
|
|
where F : AtomFunction<T, T>
|
2020-03-01 15:32:52 -05:00
|
|
|
where V : AtomVariable<T, P, E1, E2, F>
|
2019-10-16 12:02:08 -04:00
|
|
|
where C : AtomBaseVariable<T>
|
2020-03-01 20:26:06 -05:00
|
|
|
where R : AtomReference<T, P, C, V, E1, E2, F, VI, CO, L>
|
|
|
|
where VI : AtomVariableInstancer<V, P, T, E1, E2, F, CO, L>
|
|
|
|
where CO : IGetValue<IAtomCollection>
|
|
|
|
where L : IGetValue<IAtomList>
|
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
|
|
|
}
|