예제 #1
0
            /// <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);
            }
예제 #2
0
            /// <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);
            }
예제 #3
0
            /// <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);
            }
예제 #4
0
            /// <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));
            }
예제 #5
0
            /// <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);
                }
            }
예제 #6
0
            /// <inheritdoc/>
            public override void SetObject(IntPtr obj, object data)
            {
                var parameterCollection = UpdateEngineHelper.PtrToObject <ParameterCollection>(obj);

                parameterCollection.SetObject(parameterKey, data);
            }
예제 #7
0
            /// <inheritdoc/>
            public override object GetObject(IntPtr obj)
            {
                var parameterCollection = UpdateEngineHelper.PtrToObject <ParameterCollection>(obj);

                return(parameterCollection.GetObject(parameterKey));
            }
예제 #8
0
            /// <inheritdoc/>
            public override void SetObject(IntPtr obj, object data)
            {
                var entity = UpdateEngineHelper.PtrToObject <Entity>(obj);

                entity.Components[propertyKey] = data;
            }
예제 #9
0
            /// <inheritdoc/>
            public override object GetObject(IntPtr obj)
            {
                var entity = UpdateEngineHelper.PtrToObject <Entity>(obj);

                return(entity.Components[propertyKey]);
            }