Exemple #1
0
        protected override void OnCreate()
        {
            base.OnCreate();
            var availableComponentTypes = TypeUtility.GetTypes(typeof(IDynamicBufferProperty <>));

            m_query = GetEntityQuery(new EntityQueryDesc {
                All = new ComponentType[] {
                    ComponentType.ReadOnly <SpriteAnimation>(),
                    ComponentType.ReadOnly <SpriteAnimationTimeSpeedState>()
                },
                Any = availableComponentTypes.Select(t => (ComponentType)t).ToArray()
            });

            m_spriteAnimators = SpritePropertyAnimatorUtility.CreatePossibleInstances(this, m_query)
                                .ToList();
        }
Exemple #2
0
        public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
        {
            var animationBufferEntity = dstManager.CreateEntity();

#if UNITY_EDITOR
            dstManager.SetName(animationBufferEntity, $"{gameObject.name} - SpriteAnimationBuffer");
#endif
            foreach (var converter in SpritePropertyAnimatorUtility.CreateConverters())
            {
                converter.Convert(gameObject, dstManager, animationBufferEntity, Clips);
            }

            dstManager.AddSharedComponentData(entity, new SpriteAnimation {
                ClipSetEntity = animationBufferEntity,
                ClipIndex     = ClipIndex,
                ClipCount     = Clips.Length
            });

            dstManager.AddComponentData(entity, new SpriteAnimationTimeSpeedState {
                Speed = Speed,
                Time  = StartTime
            });
        }