コード例 #1
0
    protected override void OnCreate()
    {
        base.OnCreate();
        m_GraphSystem = World.GetOrCreateSystem <AnimationGraphSystem>();
        m_GraphSystem.AddRef();

        if (m_GraphSystem.Set.RendererModel != RenderExecutionModel.Islands)
        {
            m_GraphSystem.Set.RendererModel = RenderExecutionModel.Islands;
        }

        m_CreateLambda = (Entity e, ref TSampleSetup setup) =>
        {
            var data = CreateGraph(e, m_GraphSystem.Set, ref setup);
            PostUpdateCommands.AddComponent(e, data);
        };

        m_DestroyLambda = (Entity e, ref TSampleData data) =>
        {
            DestroyGraph(e, m_GraphSystem.Set, ref data);
            PostUpdateCommands.RemoveComponent(e, typeof(TSampleData));
        };

        m_UpdateLambda = (Entity e, ref TSampleData data) =>
        {
            UpdateGraph(e, m_GraphSystem.Set, ref data);
        };
    }
コード例 #2
0
        protected override void OnCreate()
        {
            base.OnCreate();

            OutgoingGroup = GetEntityQuery(typeof(LOD), ComponentType.Exclude <Settings>());

            m_AnimationGraphSystem = World.GetExistingSystem <AnimationGraphSystem>();
            m_AnimationGraphSystem.AddRef();
            m_AnimationGraphSystem.Set.RendererModel = RenderExecutionModel.Islands;
        }
コード例 #3
0
    public static void DestroyNode <T>(AnimationGraphSystem animGraphSys, NodeHandle <T> handle) where T : INodeDefinition, new()
    {
        animGraphSys.Set.Destroy(handle);
        GameDebug.Log(animGraphSys.World, ShowLifetime, "Destroy node. hash:{0}", handle.GetHashCode());

        if (!GetData(animGraphSys).Nodes.ContainsKey(handle.GetHashCode()))
        {
            GameDebug.LogError("Node is not registered");
            return;
        }

        GetData(animGraphSys).Nodes.Remove(handle.GetHashCode());
    }
コード例 #4
0
    static NodeSetData GetData(AnimationGraphSystem animGraphSys)
    {
        NodeSetData data;

        if (g_AnimationGraphSystems.TryGetValue(animGraphSys, out data))
        {
            return(data);
        }

        data = new NodeSetData();
        g_AnimationGraphSystems.Add(animGraphSys, data);
        return(data);
    }
コード例 #5
0
    public static NodeHandle <T> CreateNode <T>(AnimationGraphSystem animGraphSys, string name) where T : INodeDefinition, new()
    {
        var handle = animGraphSys.Set.Create <T>();

        GameDebug.Log(animGraphSys.World, ShowLifetime, "Create node. hash:{0} name:{1} ", handle.GetHashCode(), name);

        var data = new NodeData
        {
            name = name,
        };

        GetData(animGraphSys).Nodes.Add(handle.GetHashCode(), data);

        return(handle);
    }
コード例 #6
0
 protected override void OnCreate()
 {
     base.OnCreate();
     m_AnimationGraphSystem = World.GetExistingSystem <AnimationGraphSystem>();
     m_AnimationGraphSystem.AddRef();
 }
コード例 #7
0
        static void Deinitialize(World world, EntityCommandBuffer cmdBuffer, Entity entity, AnimationGraphSystem animGraphSys, SystemState state)
        {
            GameDebug.Log(world,AnimSource.ShowLifetime,"Deinit Run8Dir entity:{0}", entity);

            AnimationGraphHelper.DestroyNode(animGraphSys,state.AimVertical);
            AnimationGraphHelper.DestroyNode(animGraphSys,state.AimHorizontal);
            AnimationGraphHelper.DestroyNode(animGraphSys,state.AimVerticalDelta);
            AnimationGraphHelper.DestroyNode(animGraphSys,state.AimHorizontalDelta);
            AnimationGraphHelper.DestroyNode(animGraphSys,state.AdditiveRefPoseA);
            AnimationGraphHelper.DestroyNode(animGraphSys,state.AdditiveRefPoseB);
            AnimationGraphHelper.DestroyNode(animGraphSys,state.Mixer);
            AnimationGraphHelper.DestroyNode(animGraphSys,state.BlendTreeNode);

            cmdBuffer.RemoveComponent<SystemState>(entity);
        }