Game Development Reference
In-Depth Information
{
actionName = "StopPatrolling";
}
public override void Start(AI ai)
{
base.Start(ai);
}
public override ActionResult Execute(AI ai)
{
return ActionResult.SUCCESS;
}
public override void Stop(AI ai)
{
base.Stop(ai);
}
}
This contains the three basic methods you would expect to see in an action: one to
call when the action is started, another when it is stopped, and an Execute method
that is called when running the action that returns the state of the action node: suc-
cess, failure, or running. With this outline, you can create all kinds of custom actions,
but for now, all you need to do is set the donePatrolling variable in the memory
to true . Change the Start method to the following:
public override void Start(AI ai)
{
base.Start(ai);
ai.WorkingMemory.SetItem("donePatrolling",
true);
}
This code does what we need, setting the donePatrolling variable to true . The
AI object in this code, just called ai , is the AI for the character. It contains access
Search WWH ::




Custom Search