FSM状态机
This commit is contained in:
30
client/assets/scripts/Framework/FSM/IState.ts
Normal file
30
client/assets/scripts/Framework/FSM/IState.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 状态接口
|
||||
* 定义状态机中状态的标准接口
|
||||
*/
|
||||
export interface IState {
|
||||
/**
|
||||
* 状态名称
|
||||
* 用于标识和切换状态
|
||||
*/
|
||||
readonly name: string;
|
||||
|
||||
/**
|
||||
* 进入状态时调用
|
||||
* @param params 可选参数,用于传递状态切换时的数据
|
||||
*/
|
||||
onEnter(params?: any): void;
|
||||
|
||||
/**
|
||||
* 更新状态(可选)
|
||||
* 如果状态需要每帧更新,可以实现此方法
|
||||
* @param dt 距离上一帧的时间增量(秒)
|
||||
*/
|
||||
onUpdate?(dt: number): void;
|
||||
|
||||
/**
|
||||
* 退出状态时调用
|
||||
* 用于清理状态相关的资源
|
||||
*/
|
||||
onExit(): void;
|
||||
}
|
||||
Reference in New Issue
Block a user