コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        npcAnimator.SetFloat(hashSpeed, navMeshAgent.velocity.magnitude);

        DT_Action dt_NewAction = null;

        if (!useHardcodedDT)
        {
            dt_NewAction = dtNode_Root.MakeDecision() as DT_Action;
        }
        else
        {
            //TODO: YOUR CODE HERE (Q2)
        }
        if (dt_NewAction != null)
        {
            if (dt_NewAction != dt_LastAction)
            {
                if (dt_LastAction != null)
                {
                    dt_LastAction.end();
                }
                dt_NewAction.init();
            }
            else
            {
                dt_NewAction.update();
            }
        }
        dt_LastAction = dt_NewAction;

        //canHearPlayer = false;
    }
コード例 #2
0
ファイル: Core_DT.cs プロジェクト: donamin/2021-ai-in-games
    public override DT_Node MakeDecision()
    {
        DT_Node branch = GetBranch();

        return(branch.MakeDecision());
    }