/// <inheritdoc/> public override void SetBlittable(IntPtr obj, IntPtr data) { var parameterCollection = UpdateEngineHelper.PtrToObject <ParameterCollection>(obj); // TODO: Avoid unecessary copy using assembly processor var value = Utilities.Read <T>(data); parameterCollection.Set(parameterKey, ref value); }
/// <inheritdoc/> public override IntPtr GetStructAndUnbox(IntPtr obj, object data) { var parameterCollection = UpdateEngineHelper.PtrToObject <ParameterCollection>(obj); var valuePtr = UpdateEngineHelper.Unbox <T>(data); // TODO: Avoid unecessary copy using assembly processor var value = parameterCollection.Get(parameterKey); Utilities.Write(valuePtr, ref value); return(valuePtr); }
/// <inheritdoc/> public override object GetObject(IntPtr obj) { var entity = UpdateEngineHelper.PtrToObject <Entity>(obj); var components = entity.Components; for (int i = 0; i < components.Count; i++) { var component = components[i]; if (componentTypeInfo.IsAssignableFrom(component.GetType().GetTypeInfo())) { return(component); } } return(null); }
/// <inheritdoc/> public override object GetObject(IntPtr obj) { var entity = UpdateEngineHelper.PtrToObject <Entity>(obj); foreach (var child in entity.Transform.Children) { var childEntity = child.Entity; if (childEntity.Name == childName) { return(childEntity); } } // TODO: Instead of throwing an exception, we could just skip it // If we do that, we need to add how many entries to skip in the state machine throw new InvalidOperationException(string.Format("Could not find child entity named {0}", childName)); }
/// <inheritdoc/> public override void SetObject(IntPtr obj, object data) { var entity = UpdateEngineHelper.PtrToObject <Entity>(obj); var components = entity.Components; bool notSet = true; for (int i = 0; i < components.Count; i++) { var component = components[i]; if (componentTypeInfo.IsAssignableFrom(component.GetType().GetTypeInfo())) { components[i] = (EntityComponent)data; notSet = false; } } if (notSet) { components.Add((EntityComponent)data); } }
/// <inheritdoc/> public override void SetObject(IntPtr obj, object data) { var parameterCollection = UpdateEngineHelper.PtrToObject <ParameterCollection>(obj); parameterCollection.SetObject(parameterKey, data); }
/// <inheritdoc/> public override object GetObject(IntPtr obj) { var parameterCollection = UpdateEngineHelper.PtrToObject <ParameterCollection>(obj); return(parameterCollection.GetObject(parameterKey)); }
/// <inheritdoc/> public override void SetObject(IntPtr obj, object data) { var entity = UpdateEngineHelper.PtrToObject <Entity>(obj); entity.Components[propertyKey] = data; }
/// <inheritdoc/> public override object GetObject(IntPtr obj) { var entity = UpdateEngineHelper.PtrToObject <Entity>(obj); return(entity.Components[propertyKey]); }