Esempio n. 1
0
        public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
        {
            dstManager.AddComponent <Spline2DBenchmarkData>(entity);

            // convert prefab to entity
            World defaultWorld = World.DefaultGameObjectInjectionWorld;
            GameObjectConversionSettings settings = GameObjectConversionSettings.FromWorld(defaultWorld, null);
            Entity converted = GameObjectConversionUtility.ConvertGameObjectHierarchy(Prefab, settings);

            dstManager.SetComponentData(entity, new Spline2DBenchmarkData
            {
                Quantity = Quantity,
                Prefab   = converted
            });

            if (Spline != null)
            {
                if (!m_spline.SplineEntityData2D.HasValue)
                {
                    m_spline.Convert(dstManager.CreateEntity(), dstManager, conversionSystem);
                }

                dstManager.AddSharedComponentData(entity, m_spline.SplineEntityData2D.Value);
            }
        }
Esempio n. 2
0
        public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
        {
            dstManager.AddComponent <SplineProgress>(entity);
            dstManager.SetComponentData(entity, new SplineProgress()
            {
                Progress = Progress
            });

            dstManager.AddComponent <TraversalSpeed>(entity);
            dstManager.SetComponentData(entity, new TraversalSpeed {
                Speed = Speed
            });

            if (Spline != null)
            {
                // make sure that there is spline data to look at
                if (!Spline.SplineEntityData2D.HasValue)
                {
                    Spline.Convert(dstManager.CreateEntity(), dstManager, conversionSystem);
                }

                dstManager.AddSharedComponentData(entity, Spline.SplineEntityData2D.Value);
            }
            else
            {
                Debug.LogWarning(
                    $"Unable to create functioning Entity Spline Traverser without a set spline! Gameobject: {gameObject.name}");
            }
        }