public BaseComponent CopyComponent(BaseComponent resComponent) { if (resComponent == null) { return(null); } int entityId = resComponent.GetEntityId(); int componentId = resComponent.GetComponentId(); ECSDefine.ComponentType componentType = resComponent.GetComponentType(); BaseComponent.ComponentExpandData componentExpandData = resComponent.GetComponentExpandData(); int newComponentId = copyComponentIdDistributionChunk.Pop(); OperationObject operationObject = componentOperation.CreateOperationObject((int)componentType, newComponentId); if (operationObject == null) { Debug.LogError($"[ECSModule] CopyComponent Fail. componentType:{Enum.GetName(typeof(ECSDefine.ComponentType), componentType)}"); return(null); } BaseComponent newComponent = operationObject as BaseComponent; newComponent.SetGlobalUnionId(GlobalUnionId); newComponent.SetEntityId(entityId); newComponent.SetComponentId(componentId); newComponent.SetComponentType(componentType); newComponent.SetComponentExpandData(componentExpandData.Copy()); return(newComponent); }
public void SetExpandData(BaseComponent.ComponentExpandData expandData) { synchroValueRspStructure.expandData = expandData; }