Accomodate new VRCAnimatorPlayAudio requirements:

- Nodes need to know the Animator Root, so that relative paths can be resolved during the creation of State behaviours (i.e. Relative path of an AudioSource).
- Nodes need to have the ability to create a New Behaviour, even if one already exists.
This commit is contained in:
Haï~
2024-06-30 13:58:54 +02:00
parent a9e1b62818
commit 582b109a82
4 changed files with 33 additions and 12 deletions
@@ -13,11 +13,13 @@ namespace AnimatorAsCode.V1
{
protected readonly AacFlStateMachine ParentMachine;
protected readonly IAacDefaultsProvider DefaultsProvider;
protected readonly Transform AnimatorRoot;
protected AacAnimatorNode(AacFlStateMachine parentMachine, IAacDefaultsProvider defaultsProvider)
protected AacAnimatorNode(AacFlStateMachine parentMachine, IAacDefaultsProvider defaultsProvider, Transform animatorRoot)
{
ParentMachine = parentMachine;
DefaultsProvider = defaultsProvider;
AnimatorRoot = animatorRoot;
}
public TNode LeftOf(AacAnimatorNode otherNode) => MoveNextTo(otherNode, -1, 0);
@@ -60,6 +62,13 @@ namespace AnimatorAsCode.V1
return (TNode) this;
}
public string ResolveRelativePath(Transform item)
{
return AacInternals.ResolveRelativePath(AnimatorRoot, item);
}
public abstract TBehaviour EnsureBehaviour<TBehaviour>() where TBehaviour : StateMachineBehaviour;
public abstract TBehaviour CreateNewBehaviour<TBehaviour>() where TBehaviour : StateMachineBehaviour;
}
}