本文整理汇总了C++中DamageInfo::getDamageColor方法的典型用法代码示例。如果您正苦于以下问题:C++ DamageInfo::getDamageColor方法的具体用法?C++ DamageInfo::getDamageColor怎么用?C++ DamageInfo::getDamageColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DamageInfo
的用法示例。
在下文中一共展示了DamageInfo::getDamageColor方法的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: dealDamage
void Virus::dealDamage(const DamageInfo &damage) {
if (!isActive()) {
return;
}
double modifier = 0.0;
unsigned char proteinTypes = virusData->getProteinTypes();
if (proteinTypes & damage.getDamageType()) {
modifier = 1.0;
}
VirusColor color = virusData->getVirusColor();
if (color == damage.getDamageColor()) {
modifier *= 2.0;
}
if (modifier > 1.0) {
flash = 45;
flashColor = Color(1.0, 1.0, 1.0);
} else if (modifier > 0.0) {
flash = 22;
flashColor = Color(1.0, 1.0, 1.0);
}
this->hp -= (modifier * damage.getDamageValue());
if (hp <= 0.0) {
hp = 0.0;
dead = true;
VisualEffect *effect = new ShockwaveEffect(position, 10.0, 60,
virusData->getColor());
map->addVisualEffect(effect);
effect = new BubbleEffect(position, position, CELL_RADIUS / 3.0,
60, virusData->getColor());
map->addVisualEffect(effect);
}
}