您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
24 行
684 B
24 行
684 B
using UnityEngine;
|
|
using UOP1.StateMachine;
|
|
using UOP1.StateMachine.ScriptableObjects;
|
|
|
|
[CreateAssetMenu(fileName = "IsTargetDeadCondition", menuName = "State Machines/Conditions/Is Target Dead Condition")]
|
|
public class IsTargetDeadConditionSO : StateConditionSO
|
|
{
|
|
protected override Condition CreateCondition() => new IsTargetDeadCondition();
|
|
}
|
|
|
|
public class IsTargetDeadCondition : Condition
|
|
{
|
|
private Critter _critterScript;
|
|
|
|
public override void Awake(StateMachine stateMachine)
|
|
{
|
|
_critterScript = stateMachine.GetComponent<Critter>();
|
|
}
|
|
|
|
protected override bool Statement()
|
|
{
|
|
return _critterScript.currentTarget == null || _critterScript.currentTarget.IsDead;
|
|
}
|
|
}
|