public T CreateGroup <T>() where T : GroupComponent { T component = GroupRegistry.FindOrCreateGroup <T>(this.Id); this.AddComponent(component); return(component); }
public override object Decode(ProtocolBuffer protocolBuffer) { long uid = (long)this.longCodec.Decode(protocolBuffer); Type typeByUid = this.protocol.GetTypeByUid(uid); return(GroupRegistry.FindOrCreateGroup(typeByUid, (long)this.longCodec.Decode(protocolBuffer))); }
private void AutoAddComponents(EntityInternal newEntity, TemplateDescription templateDescription) { foreach (Type type in templateDescription.GetAutoAddedComponentTypes()) { Component component = !typeof(GroupComponent).IsAssignableFrom(type) ? newEntity.CreateNewComponentInstance(type) : GroupRegistry.FindOrCreateGroup(type, newEntity.Id); newEntity.AddComponent(component); } }
private void AddJoinComponent <T>(Platform.Kernel.ECS.ClientEntitySystem.API.Entity key) where T : GroupComponent { GroupComponent component = GroupRegistry.FindOrCreateGroup <T>(key.Id); this.Entity.AddComponent(component); }