1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- 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=60b06ae900f4cd994af68bc3e1b2e92c44cd1dae.js.map
|