protected override void OneTimeSetUp()
        {
            base.OneTimeSetUp();

            var motionData = new BlendTree1DMotionData[]
            {
                new BlendTree1DMotionData {
                    MotionThreshold = 0.2f, MotionSpeed = 1.0f
                },
                new BlendTree1DMotionData {
                    MotionThreshold = 0.4f, MotionSpeed = 0.8f
                },
                new BlendTree1DMotionData {
                    MotionThreshold = 0.6f, MotionSpeed = 0.6f
                },
                new BlendTree1DMotionData {
                    MotionThreshold = 0.8f, MotionSpeed = 0.4f
                },
                new BlendTree1DMotionData {
                    MotionThreshold = 1.0f, MotionSpeed = 0.2f
                },
            };

            m_BlendTree = BlendTreeBuilder.CreateBlendTree(motionData);
        }
Ejemplo n.º 2
0
    public static BlobAssetReference <BlendTree1D> CreateBlendTree1DFromComponents(EntityManager entityManager, Entity entity)
    {
        var data             = entityManager.GetComponentData <BlendTree1DData>(entity);
        var motionData       = entityManager.GetBuffer <BlendTree1DMotionData>(entity);
        var targetMotionData = new Unity.Animation.BlendTree1DMotionData[motionData.Length];

        for (int i = 0; i < motionData.Length; i++)
        {
            targetMotionData[i].MotionThreshold = motionData[i].MotionThreshold;
            targetMotionData[i].MotionSpeed     = motionData[i].MotionSpeed;
            targetMotionData[i].Motion.Clip     = motionData[i].Motion;
            targetMotionData[i].MotionType      = motionData[i].MotionType;
        }

        return(BlendTreeBuilder.CreateBlendTree(targetMotionData, data.BlendParameter));
    }
Ejemplo n.º 3
0
        public void CreateBlendTree1DCanSortMotionData()
        {
            var motionData = new []
            {
                new BlendTree1DMotionData {
                    MotionThreshold = 1.0f, MotionSpeed = 1.0f
                },
                new BlendTree1DMotionData {
                    MotionThreshold = 0.8f, MotionSpeed = 1.0f
                },
                new BlendTree1DMotionData {
                    MotionThreshold = 0.1f, MotionSpeed = 1.0f
                },
                new BlendTree1DMotionData {
                    MotionThreshold = 0.9f, MotionSpeed = 1.0f
                },
                new BlendTree1DMotionData {
                    MotionThreshold = 0.5f, MotionSpeed = 1.0f
                },
                new BlendTree1DMotionData {
                    MotionThreshold = 0.6f, MotionSpeed = 1.0f
                },
                new BlendTree1DMotionData {
                    MotionThreshold = 0.7f, MotionSpeed = 1.0f
                },
                new BlendTree1DMotionData {
                    MotionThreshold = 0.3f, MotionSpeed = 1.0f
                },
                new BlendTree1DMotionData {
                    MotionThreshold = 0.2f, MotionSpeed = 1.0f
                },
                new BlendTree1DMotionData {
                    MotionThreshold = 0.0f, MotionSpeed = 1.0f
                },
            };

            var blendTree = BlendTreeBuilder.CreateBlendTree(motionData);

            for (int i = 1; i < blendTree.Value.MotionThresholds.Length; i++)
            {
                Assert.That(blendTree.Value.MotionThresholds[i], Is.GreaterThanOrEqualTo(blendTree.Value.MotionThresholds[i - 1]));
            }
        }
Ejemplo n.º 4
0
        public void BlendTree1DCreatedWithoutMotionDataReturnNull()
        {
            var blendTree = BlendTreeBuilder.CreateBlendTree(null);

            Assert.That(blendTree, Is.EqualTo(BlobAssetReference <BlendTree1D> .Null));
        }