System.register(["cc"], function (_export, _context) { "use strict"; var _cclegacy, FMS, _crd; /**注册一个继承IFMS的状态类型 */ function FMSRegister(name) { return function (target) { var instance = new target(); instance.type = name; FMS.IFMS.set(name, instance); }; } /**状态接口*/ function get_new_fms() { return new FMS(); } _export({ FMSRegister: FMSRegister, default: get_new_fms }); return { setters: [function (_cc) { _cclegacy = _cc.cclegacy; }], execute: function () { _crd = true; _cclegacy._RF.push({}, "bbc25Bst09Pm7REKGq+Wn2J", "FMS", undefined); /**全局状态机,游戏流程 (私有有行为机更灵活)*/ FMS = class FMS { constructor() { this._current = void 0; } /**当前状态*/ get Current() { return this._current; } get CurrentTaype() { return this._current ? null : this._current.type; } /**初始1个状态*/ Init(type) { this.Change(type); } /**切换状态*/ Change(type) { if (this._current) this._current.onExit(); this._current = FMS.IFMS.get(type); if (this._current) this._current.onEntry(); } }; /**例子: @FMSRegister("Init") export class FMSInit implements IFMS{ type: string; onExit: () => void; onEntry():void{ console.log(this.type,"---------------------"); } } */ FMS.IFMS = new Map(); _cclegacy._RF.pop(); _crd = false; } }; }); //# sourceMappingURL=b601769373047d5119da5c4cb4b3a4bba6a651af.js.map