- A* version: 5.3.8
- Unity version: 6.1.9
- Behavior Graph: 1.11
- FollowerEntity
I am trying to figure out how to flee. I’m setting the Construct then using SetPath. Is that right? I think my agent working, but not sure of all the steps.
FollowerEntity follower;
GameObject fleeActor;
FleePath fleePath;
protected override Status OnStart()
{
if (follower == null)
{
follower = Agent.Value.GetComponent<FollowerEntity>();
if (follower == null)
{
Debug.LogError("Agent does not have a FollowerEntity component.");
return Status.Failure;
}
}
fleePath = FleePath.Construct(follower.destination, follower.endOfPath, 20000);
fleePath.aimStrength = 1;
fleePath.spread = 4000;
follower.SetPath(fleePath);
return Status.Running;
}
protected override Status OnUpdate()
{
if (!follower.pathPending && (follower.reachedEndOfPath || follower.hasPath))
{
// If the agent has reached the destination or is still moving towards it, we can return running.
return Status.Success;
}
return Status.Running;
}
protected override void OnEnd()
{
}