protected async ETTask CreateTrapViewAsync(DUnit trap) { URoleConfig config = trap.GetComponent <URoleConfigComponent>().RoleConfig; GameObject go = trap.AddComponent <DGameObjectComponent>().Init("Trap.unity3d", "Trap", config.Model, GlobalComponent.Instance.Unit); go.AddComponent <ComponentView>().Component = trap; go.transform.position = trap.Position; trap.AddComponent <DAnimatorComponent>(); await ETTask.CompletedTask; }
private async ETTask CreateRoleViewAsync(DUnit role) { URoleConfig config = role.GetComponent <URoleConfigComponent>().RoleConfig; GameObject go = role.AddComponent <DGameObjectComponent>().Init("Role.unity3d", "Role", config.Model, GlobalComponent.Instance.Unit); go.AddComponent <ComponentView>().Component = role; go.transform.position = role.Position; // 声音组件 role.AddComponent <SoundComponent>(); // 动画组件 role.AddComponent <DAnimatorComponent>(); await ETTask.CompletedTask; }