public static void SyncRenderer(SpriteRenderer from, UTinyEntityView view)
        {
            var registry = view.Registry;
            var entity   = view.EntityRef.Dereference(registry);

            var tinyRenderer = entity.GetComponent(registry.GetSprite2DRendererType());

            if (null != tinyRenderer)
            {
                SyncRenderer(from, tinyRenderer);
            }

            if (from.drawMode == SpriteDrawMode.Simple)
            {
                entity.RemoveComponent(registry.GetSprite2DRendererOptionsType());
            }
            else
            {
                var rendererOptions = entity.GetOrAddComponent(registry.GetSprite2DRendererOptionsType());
                if (null != rendererOptions)
                {
                    SyncRendererOptions(from, rendererOptions);
                }
            }
            TransformInversedBindings.SyncTransform(from.transform, view);
        }
コード例 #2
0
        private void UpdateTransform(EntityNode node, EntityNode parent)
        {
            var entity        = node.Entity.Dereference(Registry);
            var transform     = entity.View.transform;
            var tinyTransform = entity.GetComponent(Registry.GetTransformType());

            if (null == parent)
            {
                transform.SetParent(null, true);
            }
            else
            {
                transform.SetParent(parent.Entity.Dereference(Registry).View.transform, true);
            }
            TransformInversedBindings.SyncTransform(transform, tinyTransform);
        }