This commit is contained in:
gongxh
2025-06-04 23:10:59 +08:00
commit 0d9f048f39
18 changed files with 1538 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import { Status } from "../header";
import { Ticker } from "../Ticker";
import { Action } from "./Action";
/**
* 条件节点
*/
export class Condition extends Action {
/** 执行函数 @internal */
private _func: (subject: any) => boolean = null;
constructor(func: (subject: any) => boolean) {
super();
this._func = func;
}
/**
* 执行
* @param {Ticker} ticker
* @returns {Status}
*/
public tick(ticker: Ticker): Status {
return this._func(ticker.subject) ? Status.SUCCESS : Status.FAILURE;
}
}