本文整理汇总了C++中PlayerState::GetEffortMax方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerState::GetEffortMax方法的具体用法?C++ PlayerState::GetEffortMax怎么用?C++ PlayerState::GetEffortMax使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerState
的用法示例。
在下文中一共展示了PlayerState::GetEffortMax方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CyclePredictedToPoint
//.........这里部分代码省略.........
{
return i;
}
last_position = position;
/*decide if we should turn*/
double targ_ang;
if (dash_power > 0)
{
targ_ang = (target - position).Dir() - myang;
}
else
{
targ_ang = (target - position).Dir() - GetNormalizeAngleDeg(myang + 180);
}
double max_go_to_point_angle_err = 4; //见08CP_max_go_to_point_angle_err
if (fabs(GetNormalizeAngleDeg(targ_ang)) > max_go_to_point_angle_err)
{
/*turnint*/
double this_turn = MinMax(-player.GetMaxTurnAngle(), GetNormalizeAngleDeg(targ_ang) , player.GetMaxTurnAngle());
myang += this_turn;
corrected_dash_power = 0;
last_action = 0;
}
else
{
corrected_dash_power = player.CorrectDashPowerForStamina(dash_power);
if (fabs(corrected_dash_power) > predicted_stamina)
{
effective_power = Sign(corrected_dash_power) * predicted_stamina;
}
else
{
effective_power = corrected_dash_power;
}
effective_power *= predicted_effort;
effective_power *= player.GetDashPowerRate();
velocity += Polar2Vector(effective_power , myang);
last_action = 1;
}
if (velocity.Mod() > player.GetEffectiveSpeedMax())
{
velocity *= (player.GetEffectiveSpeedMax()/ velocity.Mod());
}
position += velocity;
velocity *= player.GetPlayerDecay();
//08 内UpdatePredictStaminaWithDash函数 直接写入此函数
if (dash_power > 0)
{
predicted_stamina -= dash_power;
}
else
{
predicted_stamina -= 2 * dash_power;
}
if (predicted_stamina < 0)
{
predicted_stamina = 0;
}
if (predicted_stamina < ServerParam::instance().recoverDecStamina() && predicted_recovery > ServerParam::instance().recoverMin())
{
predicted_recovery -= ServerParam::instance().recoverDec();
}
if (predicted_stamina < ServerParam::instance().effortDecStamina() && predicted_effort > player.GetEffortMin())
{
predicted_effort -= ServerParam::instance().effortDec();
}
if (predicted_stamina > ServerParam::instance().effortIncStamina() && predicted_effort < player.GetEffortMax())
{
predicted_effort += ServerParam::instance().effortDec();
}
//增加capacity改进
double stamina_inc = Min(predicted_recovery * player.GetStaminaIncMax() , predicted_capacity);
predicted_stamina += stamina_inc;
if (predicted_stamina > ServerParam::instance().staminaMax())
{
predicted_stamina = ServerParam::instance().staminaMax();
}
predicted_capacity -= stamina_inc;
if (predicted_capacity < 0)
{
predicted_capacity = 0;
}
}
return max_cyc;
}