public void Load(uint uid, uint presentid) { _uid = uid; _present = XTableMgr.GetTable <XEntityPresentation>().GetItemID(presentid); _path = "Prefabs/" + present.Prefab; _go = XResources.LoadInPool(_path); _go.name = present.Name; components = new Dictionary <uint, NativeComponent>(); anim = AttachComponent <NativeAnimComponent>(); base.Initilize(); OnInitial(); InitAnim(); }
private T PrepareEntity <T>(XAttributes attr) where T : XEntity { T x = Activator.CreateInstance <T>(); GameObject o = XResources.LoadInPool("Prefabs/" + attr.Prefab); o.name = attr.id.ToString(); o.transform.position = attr.AppearPostion; o.transform.rotation = attr.AppearQuaternion; x.Initilize(o, attr); if (!_dic_entities.ContainsKey(attr.id) && !x.IsPlayer) { _dic_entities.Add(attr.id, x); } if (!_hash_entitys.Add(x) && !x.IsPlayer) { XDebug.Log("has exist entity: ", attr.id); } SetRelation <T>(x); return(x); }