public void DefaultValueSanityCheck()
        {
            var component = m_Entity.GetComponent((UTinyType.Reference)m_ComponentType);
            var value     = component["TestTexture2DField"];

            Assert.AreEqual(null, value);
        }
Example #2
0
        public void DefaultValueSanityCheck()
        {
            var component     = m_Entity.GetComponent((UTinyType.Reference)m_ComponentType);
            var enumReference = (UTinyEnum.Reference)component["TestEnumField"];

            // The default value has not been explicitly defined.
            // It should be set the the first field
            Assert.AreEqual(m_EnumType.Fields[0].Id, enumReference.Id);
            Assert.AreEqual(1, enumReference.Value);
        }
Example #3
0
        public static UTinyEntity.Reference Parent(this UTinyEntity self)
        {
            var transform = self.GetComponent(self.Registry.GetTransformType());

            Assert.IsNotNull(transform);
            return((UTinyEntity.Reference)transform["parent"]);
        }
Example #4
0
        public static void SetParent(this UTinyEntity self, UTinyEntity.Reference parentRef)
        {
            var parent = parentRef.Dereference(self.Registry);

            Assert.AreNotEqual(self, parent);
            var transform = self.GetComponent(self.Registry.GetTransformType());

            Assert.IsNotNull(transform);

            // Set new parent
            transform["parent"] = parentRef;

            if (UTinyEntity.Reference.None.Id == parentRef.Id)
            {
                return;
            }

            // Rebind groups
            if (parent.EntityGroup != self.EntityGroup)
            {
                var selfRef = AsReference(self);
                self.EntityGroup.RemoveEntityReference(selfRef);;
                parent.EntityGroup.AddEntityReference(selfRef);
            }
        }
Example #5
0
 public static bool HasTransform(this UTinyEntity self)
 {
     if (null == self)
     {
         return(false);
     }
     return(null != self.GetComponent(self.Registry.GetTransformType()));
 }
        public void DefaultValueSanityCheck()
        {
            {
                var c = m_DefaultEntity.GetComponent((UTinyType.Reference)m_ComponentType);

                // TestIntField should be defaulted to 7 and marked flagged as unchanged
                Assert.IsFalse(c.IsOverridden);
                Assert.AreEqual(KTestFieldDefaultValue, c["TestIntField"]);
            }

            {
                var c = m_OverridenEntity.GetComponent((UTinyType.Reference)m_ComponentType);

                // TestIntField should be overriden to 10 and marked flagged as changed
                Assert.IsTrue(c.IsOverridden);
                Assert.AreEqual(KTestFieldOverrideValue, c["TestIntField"]);
            }
        }