开发者

how to make a method for this code

开发者 https://www.devze.com 2023-02-24 18:47 出处:网络
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?

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

精彩评论

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