本人已经不再用cocoscreator开发游戏了, 发布一款之前写的fsm工具吧,希望帮助到初学者

  • 测试工程 https://gitee.com/scober/ccstate-machine
  • 导入state-machine
  • 安装setup/staruml-5.0-with-cm.exe
  • 新建uml文件,编辑uml文件中的状态机,初始状态名称必须为 none
    ccTest
    TestState
  • 点击tools/ccstate-machine 生成js文件xx.js,将xx.js拷贝到自己需要的目录
  • 拖入xx.js到编辑器
  • 使用
cc.Class({
	extends: cc.Component,

    properties: {
    	TestStateNode: cc.Node
	},

	onLoad() {
		let TestStateComp = this.TestStateNode.getComponent("TestState");
		TestStateComp.bindTargetActions(this);

		this.teststatefsm = TestStateComp.fsm;
	},

	// 第一步
    onEnterStep1(fsm, name, from, to, args) {
       fsm.to_step2(); //第二步
    },

    // 第二步
    onEnterStep2(fsm, name, from, to, args) {
    },

});
1赞

啥东西。。。

一款状态机代码生成工具

有点懵,先点个star:joy:

忘记写个测试工程
这里 https://gitee.com/scober/ccstate-machine
你可以看下

一脸懵逼~~~~~

只是个状态机自动生成工具,惭愧

有点懵,怎么用的?

重新编辑了下,使用方法,你clone下gitee就行

重新编辑了下,你下载下来可以看看,一个工具

呵呵,重新编辑了下,可以不懵了

好奇你是换什么引擎了,还是改行了