动作的执行方式主要有两种,一种是作为动作直接执行,一种是作为事物模型的行为来执行。
import org.xmeta.Thing;
import org.xmeta.Action;
import org.xmeta.ActionContext;
//动作由模型转化而来
Thing thing = world.getThing("xxx"); //获取xxx模型
//转化为动作
Action action = thing.getAction();
//执行,ActionContext是变量上下文
action.run(new ActionContext());
import org.xmeta.Thing;
import org.xmeta.Action;
import org.xmeta.ActionContext;
//获取xxx模型
Thing thing = world.getThing("xxx");
//执行xxx模型的xxx方法
thing.doAction("xxx", new ActionContext();
执行动作是执行模型run方法或由引擎直接解释执行模型,而执行行为是执行模型的指定名字的行为模型,并且会把模型以self变量名放到变量上下文中。