本文整理汇总了C++中Character::GetTeamIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ Character::GetTeamIndex方法的具体用法?C++ Character::GetTeamIndex怎么用?C++ Character::GetTeamIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Character
的用法示例。
在下文中一共展示了Character::GetTeamIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RateExplosion
float AIIdea::RateExplosion(const Character & shooter, const Point2i& position,
const ExplosiveWeaponConfig& config,
const float& expected_additional_distance)
{
float rating = 0.0f;
FOR_ALL_LIVING_CHARACTERS(team, character) {
float distance = position.Distance(character->GetCenter());
distance += expected_additional_distance;
if (distance < 1.0f)
distance = 1.0f;
Double Dist = distance;
float min_damage = GetDamageFromExplosion(config, Dist);
float max_damage = min_damage;
if (Dist <= config.blast_range) {
float force = GetForceFromExplosion(config, Dist).tofloat();
min_damage += MIN_DAMAGE_PER_FORCE_UNIT * force;
max_damage += MAX_DAMAGE_PER_FORCE_UNIT * force;
}
bool is_friend = shooter.GetTeamIndex() == character->GetTeamIndex();
if (is_friend) {
rating -= RateDamageDoneToEnemy(min_damage, max_damage, *character);
} else {
rating += RateDamageDoneToEnemy(min_damage, max_damage, *character);
}
}