开发者

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));
  }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜