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