public void OnNewEudiComponent(EudiComponentBehaviour component) { ComponentsList.Add(component); if (ReflectionUtility.IsOverride(component, "UnityFixedUpdate")) { m_ComponentsWithFixedUpdate.Add(component); } if (ReflectionUtility.IsOverride(component, "UnityUpdate")) { m_ComponentsWithUpdate.Add(component); } if (ReflectionUtility.IsOverride(component, "UnityLateUpdate")) { m_ComponentsWithLateUpdate.Add(component); } }
public void OnRemoveEudiComponent(EudiComponentBehaviour component) { ComponentsList.Remove(component); if (m_ComponentsWithFixedUpdate.Contains(component)) { m_ComponentsWithFixedUpdate.Remove(component); } if (m_ComponentsWithUpdate.Contains(component)) { m_ComponentsWithUpdate.Remove(component); } if (m_ComponentsWithLateUpdate.Contains(component)) { m_ComponentsWithLateUpdate.Remove(component); } Eudi.EntitiesManager._removeEntity(component.gameObject); //< we do a blind remove (the 'try remove' function will check if we can remove the entity) }
internal void _initComponent(GameObject go, EudiComponentBehaviour component) { var wrapper = component.GetComponent <WrapperEudiEntity>(); component.EudiEntityId = wrapper.Instance.Id; component.EudiEntity = wrapper.Instance; if (!wrapper.Instance.EudiComponents.Contains(component)) { wrapper.Instance.EudiComponents.Add(component); } wrapper.Instance._updateMap(); // Key is Map, Value is Entity foreach (var mapEntities in MapManager.AllMaps) { if (!_isValidForMapping(go, mapEntities.Key)) { continue; } var entitiesList = mapEntities.Value; if (!entitiesList.Contains(wrapper.Instance)) { entitiesList.Add(wrapper.Instance); var obj = mapEntities.Key.GetAssignedObject(typeof(TransformAccessArray)); if (obj != null) { var castedObj = (TransformAccessArray)obj; castedObj.Capacity += 1; castedObj.Add(go.transform); } } // Add the objects /* DEPRECATED: We use a shared map now on each entity * TuplesInstanceInjector.AddObjectToNativeArray(component, map); * TuplesInstanceInjector.AddObjectToDataArray(component, map);*/ } }
public void Destroy() { var cleanFields = WorkerOnDestroy(); parent = null; // No need to perform this if we are ending the application, the initiatorEngine is already removing that for us if (!Eudi.ApplicationIsEnding) { foreach (var workerTask in m_workerTasks) { workerTask.Workers.Remove(this); if (workerTask.Workers.Count == 0) { var group = m_threadGroups[workerTask.TaskId]; EudiThreading.RemoveThreadGroup(group, group.MetaCreationType, group.MetaCreationGroupId); } } } m_threadGroups.Clear(); m_threadGroups = null; m_workerTasks.Clear(); m_workerTasks = null; if (!cleanFields) { var type = GetType(); var fields = type.GetFields(); var fieldsCount = fields.Length; for (int i = 0; i < fieldsCount; i++) { var field = fields[i]; field.SetValue(this, null); } } }
public void ForceUnityUpdate(EudiComponentBehaviour componentBehaviour) { componentBehaviour._DoUpdate(); }