上QQ阅读APP看书,第一时间看更新
Getting ready
We must add a new member variable to our AgentBehaviour class called weight and preferably assign a default value. In this case, this is 1.0f. We should refactor the Update function to incorporate weight as a parameter for the Agent class's SetSteering function. All in all, the new AgentBehaviour class should look something like this:
public class AgentBehaviour : MonoBehaviour { public float weight = 1.0f; // ... the rest of the class public virtual void Update () { agent.SetSteering(GetSteering(), weight); } }