Beispiel #1
0
    /*
     * Function: Enemy Pathing
     * Description: Pathing for NPC
     * Author: Kevin Ho
     */
    public void pathing()
    {
        //Debug.Log(u);		//Use this debug to check pathing speed
        //Currently moving through path
        if ((u += Time.deltaTime * speed) < (ctl.Length))
        {
            targetPosition = catmull.Evaluate(u);
        }
        //Reached destination. Reset to loop
        else
        {
            u -= ctl.Length;
        }

        if (!inRange())
        {
            FaceTarget(targetPosition);                                 //Look at target points

            agent.SetDestination(targetPosition);                       //Move through path
        }

        //If in range and not a horse
        else
        {
            if (this.tag != "Horse")
            {
                state = AIC_State.INRANGE;
            }
        }
    }