28 lines
808 B
C#
28 lines
808 B
C#
using Opsive.BehaviorDesigner.Runtime.Tasks;
|
|
using Opsive.GraphDesigner.Runtime.Variables;
|
|
using Opsive.Shared.Utility;
|
|
using UnityEngine;
|
|
|
|
namespace Cielonos.MainGame.Characters.AI
|
|
{
|
|
[Category("Cielonos")]
|
|
[Description("检查当前能量是否足够")]
|
|
public class IsEnoughEnergy : AutomataConditionalBase
|
|
{
|
|
private AttributeSubmodule attributeSm;
|
|
|
|
public SharedVariable<float> valueForCheck;
|
|
|
|
public override void OnAwake()
|
|
{
|
|
base.OnAwake();
|
|
attributeSm = self.attributeSm;
|
|
}
|
|
|
|
public override TaskStatus OnUpdate()
|
|
{
|
|
float attributeValue = attributeSm["Energy"];
|
|
return attributeValue >= valueForCheck.Value ? TaskStatus.Success : TaskStatus.Failure;
|
|
}
|
|
}
|
|
} |