August 2018
Beginner
334 pages
10h 19m
English
This approach is very similar to the one used in the previous recipe. We must add a new member variable to our AgentBehaviour class. We should also refactor the Update function to incorporate priority as a parameter to the Agent class's SetSteering function. The new AgentBehaviour class should look something like this:
public class AgentBehaviour : MonoBehaviour
{
public int priority = 1;
// ... everything else stays the same
public virtual void Update ()
{
agent.SetSteering(GetSteering(), priority);
}
}
Read now
Unlock full access