nottvlike / behavior3_lua

60 stars 32 forks source link

东西很好,谢谢。 #1

Open ttwings opened 6 years ago

ttwings commented 6 years ago

功能很全面了。我这边运行的时候,有点小错误。就是在一些继承的地方, 有多处有这样的情况,我这自行修改了一下。 举例说明:

require 'src.core.Decorator'

local inverter = b3.Class("Inverter", b3.Decorator) b3.Inverter = inverter

function inverter:ctor(...) -- b3.Inverter.ctor(self) b3.Decorator.ctor(self) self.name = "Inverter" end

注释的,是你原有的,后面的是按你其他的代码,和自己的理解改的。 运行后,正确输出。同时加了个直接读取 json文件。

function behaviorTree:load(jsonData, names) names = names or {} -- local data = json.decode(jsonData) local data if type(jsonData) == 'table' then data = jsonData end if type(jsonData) == 'string' then local f = assert(io.open(jsonData,"r")) local t = f:read("*all") f:close() data = json.decode(t) end

只是个 lua 菜鸟。有什么不对的地方,麻烦教一下。 再次感谢,大神的努力。 将这么好用的工具lua 化。

donneyluckS commented 2 years ago

@ttwings 感谢指出错误