您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
29 行
628 B
29 行
628 B
using UnityEngine;
|
|
using UOP1.StateMachine;
|
|
using UOP1.StateMachine.ScriptableObjects;
|
|
|
|
[CreateAssetMenu(fileName = "DestroyCritter", menuName = "State Machines/Actions/Destroy Critter")]
|
|
public class DestroyCritterSO : StateActionSO
|
|
{
|
|
protected override StateAction CreateAction() => new DestroyCritter();
|
|
}
|
|
|
|
public class DestroyCritter : StateAction
|
|
{
|
|
private Critter _critter;
|
|
|
|
public override void Awake(StateMachine stateMachine)
|
|
{
|
|
_critter = stateMachine.GetComponent<Critter>();
|
|
}
|
|
|
|
public override void OnUpdate()
|
|
{
|
|
|
|
}
|
|
|
|
public override void OnStateEnter()
|
|
{
|
|
GameObject.Destroy(_critter.gameObject);
|
|
}
|
|
}
|