public override IGameComponent AddComponent(int componentId) { var component = GameCompoentInfo.Allocate(componentId); SetComponent(componentId, component); return(component); }
public override void RemoveComponent(int componentId) { var comp = GetComponent(componentId); if (comp != null) { GameCompoentInfo.Free(comp); _components.Remove(componentId); } }
protected override void OnCleanUp() { foreach (var component in _components.Values) { GameCompoentInfo.Free(component.GetComponentId(), component); } _components.Clear(); ObjectAllocatorHolder <CompensatioSnapshotGameEntity> .Free(this); }
public override IGameComponent AddComponent(int componentId) { var component = GameCompoentInfo.Allocate(componentId); _list.Add(component); var wrapper = ComponentWrapper.Allocate(component); _wrapperLists.Add(wrapper); _componentListDirty = true; return(component); }
public override IGameComponent AddComponent(int componentId, IGameComponent copyValue) { var component = GameCompoentInfo.Allocate(componentId); if (component is ICloneableComponent && copyValue is ICloneableComponent) { ((ICloneableComponent)component).CopyFrom(copyValue); } SetComponent(componentId, component); return(component); }
public override IGameComponent AddComponent(int componentId, IGameComponent copyValue) { var component = GameCompoentInfo.Allocate(componentId); ((ICloneableComponent)component).CopyFrom(copyValue); _list.Add(component); var wrapper = ComponentWrapper.Allocate(component); _wrapperLists.Add(wrapper); _componentListDirty = true; return(component); }