本文整理汇总了C++中Agent::GetStrategy方法的典型用法代码示例。如果您正苦于以下问题:C++ Agent::GetStrategy方法的具体用法?C++ Agent::GetStrategy怎么用?C++ Agent::GetStrategy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Agent
的用法示例。
在下文中一共展示了Agent::GetStrategy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GoToPoint
/** 以最快的方式跑到目标点
* Run to the destination point with the fastest method.
* \param agent the agent itself.
* \param pos the destination point.
* \param buffer point buffer, means the real destinantion is a cycle with the certer
* of pos and radius of buffer.
* \param power the intend power to use.
* \param can_inverse true means can run in the inverse direction of the agent's body.
* \param turn_first true means that the agent should turn first to adjust the direction.
* \return true if the action excuted successfully.
*/
bool Dasher::GoToPoint(Agent & agent, Vector pos, double buffer, double power, bool can_inverse, bool turn_first)
{
AtomicAction act;
GoToPoint(agent, act, agent.GetStrategy().AdjustTargetForSetplay(pos), buffer, power, can_inverse, turn_first);
return act.Execute(agent);
}
示例2: mWorldState
BehaviorAttackData::BehaviorAttackData(Agent & agent):
mAgent ( agent ),
mWorldState ( agent.GetWorldState() ),
mBallState ( agent.GetWorldState().GetBall() ),
mSelfState ( agent.Self() ),
mPositionInfo ( agent.Info().GetPositionInfo()),
mInterceptInfo ( agent.Info().GetInterceptInfo()),
mStrategy (agent.GetStrategy()),
mFormation ( agent.GetFormation() )
{
mFormation.Update(Formation::Offensive, "Offensive");
}
示例3: GetBall
/**
* Caculate the get ball cycles and actions.
* @param agent the agent itself.
* @param act the atomic action to execute this cycle to get the ball.
* @param int_cycle the beginning cycle to do the action, while -1 means now.
* @param can_inverse true means allow runnning backwards to get the ball.
* @param turn_first true means the agent turn first to get the ball.
* @return a double to show the cycles needed and if it less than 0, that is to say impossible.
*/
double Dasher::GetBall(Agent & agent, AtomicAction & act, int int_cycle , bool can_inverse, bool turn_first)
{
Assert(int_cycle == -1 || int_cycle >= 0);
if (int_cycle == -1) {
double min_diff = HUGE_VALUE;
const int max_consider_cycle = Min(int(MobileState::Predictor::MAX_STEP), agent.GetStrategy().GetSureOppInterCycle() - 1);
for (int i = 0; i <= max_consider_cycle; ++i) {
Vector target = agent.GetWorldState().GetBall().GetPredictedPos(i);
double my_cycle = RealCycleNeedToPoint(agent.GetSelf(), target, can_inverse);
double diff = fabs(my_cycle - i + 1.0);
if (diff < min_diff) {
min_diff = diff;
int_cycle = i;
}
}
}
if (int_cycle == -1) {
int_cycle = Max(0, agent.GetStrategy().GetMyInterCycle());
}
//int_cycle = 1;
//std::cout << "Max consider cycle " << int_cycle << std::endl;
//std::cout << "Predicted Ball position " << agent.GetWorldState().GetBall().GetPredictedPos(int_cycle).X() << " " << agent.GetWorldState().GetBall().GetPredictedPos(int_cycle).Y() << std::endl;
//std::cout << "Ball position " << agent.GetWorldState().GetBall().GetPos().X() << " " << agent.GetWorldState().GetBall().GetPos().Y() << std::endl;
GoToPoint(
agent,
act,
agent.GetWorldState().GetBall().GetPredictedPos(int_cycle),
agent.GetSelf().GetKickableArea() - GETBALL_BUFFER,
agent.GetSelf().CorrectDashPowerForStamina(ServerParam::instance().maxDashPower()),
can_inverse,
turn_first
);
return RealCycleNeedToPoint(agent.GetSelf(), agent.GetWorldState().GetBall().GetPredictedPos(int_cycle), can_inverse);
}