提交 24f4cd99 编写于 作者: T tanghai

Component<World>子类如果实现IAssemblyLoader接口话,World.Load()会统一调用该接口

上级 b94cd2ba
......@@ -20,10 +20,9 @@ namespace Model
private World()
{
this.Assembly = Assembly.Load(File.ReadAllBytes(@"./Controller.dll"));
}
public void ReLoad()
public void Load()
{
this.Assembly = Assembly.Load(File.ReadAllBytes(@"./Controller.dll"));
......
......@@ -23,18 +23,12 @@ namespace MongoDBTest
World world = World.Instance;
// 加载配置
world.AddComponent<ConfigComponent>().Load(world.Assembly);
// 事件管理器
world.AddComponent<EventComponent<WorldEventAttribute>>().Load(world.Assembly);
world.AddComponent<ConfigComponent>();
world.AddComponent<EventComponent<WorldEventAttribute>>();
world.AddComponent<UnitComponent>();
// 构造工厂
world.AddComponent<FactoryComponent<Unit>>().Load(world.Assembly);
// 构造行为树
world.AddComponent<BehaviorTreeComponent>().Load(world.Assembly);
world.AddComponent<FactoryComponent<Unit>>();
world.AddComponent<BehaviorTreeComponent>();
world.Load();
Unit player1 = world.GetComponent<FactoryComponent<Unit>>().Create(1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册