how to make a method for this code
I have simple question: I dont know how to make a method for codes like this开发者_C百科:
//how should i put these two lines in a method?
if (agent.GetWorldState().GetPlayMode() == PM_Before_Kick_Off)
{
agent.Move(Vector(-1, -1));
}
Thanks.
It sounds like you're asking how to write a method to wrap that code. If so I think you want the following (assuming the type of agent
is Agent
)
void TheMethod(Agent& agent) {
if (agent.GetWorldState().GetPlayMode() == PM_Before_Kick_Off) {
agent.Move(Vector(-1, -1));
}
}
精彩评论