Пример #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
    public override DT_Node MakeDecision()
    {
        DT_Node branch = GetBranch();

        return(branch.MakeDecision());
    }