32 lines
766 B
C#
32 lines
766 B
C#
using System;
|
|
using BehaviorDesigner.Runtime.Tasks;
|
|
using DDD.Players;
|
|
using UnityEngine;
|
|
using Action = BehaviorDesigner.Runtime.Tasks.Action;
|
|
|
|
namespace DDD.BehaviorTrees.Actions
|
|
{
|
|
[Serializable]
|
|
[TaskCategory("Custom")]
|
|
public class PlaySpineAnimation : Action
|
|
{
|
|
[SerializeField]
|
|
private string _animationName;
|
|
|
|
[SerializeField]
|
|
private bool _loop;
|
|
|
|
private SpineController _spineController;
|
|
|
|
public override void OnAwake()
|
|
{
|
|
_spineController = GetComponent<SpineController>();
|
|
}
|
|
|
|
public override TaskStatus OnUpdate()
|
|
{
|
|
_spineController.PlayAnimation(_animationName, _loop);
|
|
return TaskStatus.Success;
|
|
}
|
|
}
|
|
} |