2020-03-08 08:24:46 -04:00
|
|
|
using UnityEngine;
|
|
|
|
using UnityAtoms.BaseAtoms;
|
|
|
|
|
|
|
|
namespace UnityAtoms.FSM
|
|
|
|
{
|
|
|
|
[EditorIcon("atom-icon-hotpink")]
|
2020-03-08 19:16:40 -04:00
|
|
|
[AddComponentMenu("Unity Atoms/FSM/Finite State Machine Instancer")]
|
2020-03-11 16:11:27 -04:00
|
|
|
public class FiniteStateMachineInstancer : StringVariableInstancer
|
2020-03-08 08:24:46 -04:00
|
|
|
{
|
2020-03-11 16:11:27 -04:00
|
|
|
public override StringVariable Base { get => (StringVariable)_fsmBase; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The variable that the in memory copy will be based on when created at runtime.
|
|
|
|
/// </summary>
|
|
|
|
[SerializeField]
|
|
|
|
private FiniteStateMachine _fsmBase = null;
|
|
|
|
|
2020-03-08 08:24:46 -04:00
|
|
|
protected override void ImplSpecificSetup()
|
|
|
|
{
|
2020-03-11 16:11:27 -04:00
|
|
|
if (((FiniteStateMachine)Base).TransitionStarted != null)
|
2020-03-08 08:24:46 -04:00
|
|
|
{
|
2020-03-11 16:11:27 -04:00
|
|
|
((FiniteStateMachine)_inMemoryCopy).TransitionStarted = Instantiate(((FiniteStateMachine)Base).TransitionStarted);
|
2020-03-08 08:24:46 -04:00
|
|
|
}
|
2020-03-11 16:11:27 -04:00
|
|
|
if (((FiniteStateMachine)Base).CompleteCurrentTransition != null)
|
2020-03-08 08:24:46 -04:00
|
|
|
{
|
2020-03-11 16:11:27 -04:00
|
|
|
((FiniteStateMachine)_inMemoryCopy).CompleteCurrentTransition = Instantiate(((FiniteStateMachine)Base).CompleteCurrentTransition);
|
2020-03-08 08:24:46 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|