本文整理汇总了C++中DamageInfo::getRange方法的典型用法代码示例。如果您正苦于以下问题:C++ DamageInfo::getRange方法的具体用法?C++ DamageInfo::getRange怎么用?C++ DamageInfo::getRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DamageInfo
的用法示例。
在下文中一共展示了DamageInfo::getRange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DamageInfo
Antibody::Antibody(DamageInfo damage, Vector position,
Virus *target, int frame) {
this->damage = DamageInfo(damage);
this->position = position;
this->map = 0;
this->orientation = (double)(frame % 360);
this->lifetime = ((damage.getRange()) / CELL_RADIUS) * 90;
this->target = target;
this->target->addToNotifyOnDeath(this);
this->dead = false;
switch (damage.getDamageColor()) {
case VIRUS_COLOR_RED:
this->color = Color(1.0, 0.0, 0.0);
break;
case VIRUS_COLOR_GREEN:
this->color = Color(0.0, 1.0, 0.0);
break;
case VIRUS_COLOR_BLUE:
this->color = Color(0.0, 0.0, 1.0);
break;
case VIRUS_COLOR_YELLOW:
this->color = Color(1.0, 1.0, 0.0);
break;
}
}
示例2: updateAI
void Virus::updateAI() {
if (!data) {
return;
}
if (!attackCooldown) {
DamageInfo damage = virusData->getDamageInfo();
VirusFilter targetFilter;
targetFilter.setOwnerFaction(owner);
targetFilter.setPosition(position);
std::vector<Virus *> *targets = targetFilter.filter(data->nearbyEntities,
damage.getRange());
if (targets->size() > 0) {
Entity *antibody = new Antibody(damage, position, (*targets)[0], frame);
map->addEntity(antibody);
attackCooldown = damage.getDamageCooldown();
}
delete targets;
}
if (state == VIRUSSTATE_IDLE) {
executeCurrentCommand();
}
if (currentPath.empty()) {
state = VIRUSSTATE_IDLE;
} else {
state = VIRUSSTATE_MOVING;
}
}