Exemplo n.º 1
0
    public override void AddGraphSetupComponent(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        var blendTreeIndex = BlendTreeConversion.Convert(BlendTree, entity, dstManager);

        var graphSetup = new BlendTree2DSetup
        {
            BlendTreeIndex = blendTreeIndex,
        };

        dstManager.AddComponentData(entity, graphSetup);
    }
    public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        if (blendTree == null)
        {
            return;
        }

        conversionSystem.DeclareAssetDependency(gameObject, blendTree);

        var rig = dstManager.GetComponentData <Rig>(entity);

        var clipConfiguration = new ClipConfiguration
        {
            Mask = ClipConfigurationMask.LoopValues
        };

        var bakeOptions = new BakeOptions
        {
            ClipConfiguration = clipConfiguration,
            RigDefinition     = rig.Value,
            SampleRate        = 60.0f
        };

        var blendTreeIndex       = BlendTreeConversion.Convert(blendTree, entity, dstManager, bakeOptions);
        var blendTree2DResources = dstManager.GetBuffer <BlendTree2DResource>(entity);

        var blendTreeAsset =
            BlendTreeBuilder.CreateBlendTree2DFromComponents(blendTree2DResources[blendTreeIndex], dstManager, entity);

        conversionSystem.BlobAssetStore.AddUniqueBlobAsset(ref blendTreeAsset);

        var blendTree2DData = new BlendTree2DRuntime
        {
            BlendTreeAsset = blendTreeAsset
        };

        dstManager.AddComponentData(entity, blendTree2DData);

        var blendTree2DParam = new BlendTree2DParamRuntime
        {
            InputMapping = float2.zero,
            StepMapping  = paramStep
        };

        dstManager.AddComponentData(entity, blendTree2DParam);

        dstManager.AddComponent <DeltaTimeRuntime>(entity);
        dstManager.AddComponent <ProcessDefaultAnimationGraph.AnimatedRootMotion>(entity);
    }
Exemplo n.º 3
0
    public override void AddGraphSetupComponent(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        var rigDefinition     = dstManager.GetComponentData <Rig>(entity);
        var clipConfiguration = new ClipConfiguration {
            Mask = ClipConfigurationMask.LoopValues
        };
        var bakeOptions = new BakeOptions {
            RigDefinition = rigDefinition.Value, ClipConfiguration = clipConfiguration, SampleRate = 60.0f
        };

        var blendTreeIndex = BlendTreeConversion.Convert(BlendTree, entity, dstManager, bakeOptions);

        var graphSetup = new BlendTree1DSetup
        {
            BlendTreeIndex = blendTreeIndex,
        };

        dstManager.AddComponentData(entity, graphSetup);
    }
    public void Convert(Entity entity, EntityManager dstManager, [NotNull] GameObjectConversionSystem conversionSystem)
    {
        conversionSystem.DeclareAssetDependency(gameObject, blendTree);

        var rigComponent      = dstManager.GetComponentData <Rig>(entity);
        var clipConfiguration = new ClipConfiguration {
            Mask = ClipConfigurationMask.LoopValues
        };
        var bakeOptions = new BakeOptions
        {
            RigDefinition = rigComponent.Value, ClipConfiguration = clipConfiguration, SampleRate = 60.0f
        };

        var blendTreeIndex = BlendTreeConversion.Convert(blendTree, entity, dstManager, bakeOptions);

        var blendTreeComponents = dstManager.GetBuffer <BlendTree1DResource>(entity);
        var blobBlendTreeRef    =
            BlendTreeBuilder.CreateBlendTree1DFromComponents(blendTreeComponents[blendTreeIndex], dstManager, entity);

        conversionSystem.BlobAssetStore.AddUniqueBlobAsset(ref blobBlendTreeRef);

        var blendTreeRuntime = new BlendTree1DRuntime
        {
            BlendTree = blobBlendTreeRef
        };

        dstManager.AddComponentData(entity, blendTreeRuntime);

        var blendTreeParamRuntime = new BlendTree1DParamRuntime
        {
            VelocityStep = velocityStep,
            VelocityX    = 0.0f
        };

        dstManager.AddComponentData(entity, blendTreeParamRuntime);

        dstManager.AddComponent <DeltaTimeRuntime>(entity);
    }