本文整理汇总了C++中Boss::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ Boss::getName方法的具体用法?C++ Boss::getName怎么用?C++ Boss::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Boss
的用法示例。
在下文中一共展示了Boss::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawBlobHealthShieldInfo
void drawBlobHealthShieldInfo()
{
float healthPercent;
float healthBar, shieldBar, oxygenBar;
int fade;
int y, bossX;
String s;
GLColor c;
Texture *t;
static GLColor darkRed = GLColor::red.darker();
static GLColor darkYellow = GLColor::yellow.darker();
static GLColor darkCyan = GLColor::cyan.darker();
static GLColor darkGreen = GLColor::green.darker();
y = 20;
bool flashBar = ((((int)graphics->getAnimTimer()) % 100) < 50);
bool showDanger;
for (Unit *unit = (Unit*)entityManager->blobList.getFirstElement() ; unit != NULL ; unit = (Unit*)unit->next)
{
if ((unit->health <= -100) || (unit->definition->type == BLOB_MIA) || (!unit->showHealthData))
{
continue;
}
switch (unit->definition->type)
{
case BLOB_MIA:
case BLOB_ASSIMILATING:
case BLOB_SOLDIER:
continue;
break;
default:
break;
}
showDanger = false;
fade = 35;
if (unit->maxShield > 0)
{
fade = 40;
}
if (unit->oxygen < MAX_OXYGEN_IND)
{
fade = 45;
}
graphics->fade(0.5, 30, y - 5, 210, fade);
s.setText("str_%s", unit->getName());
if ((t = textureManager->getTexture(s.getText())) == NULL)
{
t = graphics->getGLString("%s", unit->getName());
textureManager->addTexture(s.getText(), t);
}
glColor3f(1.0, 1.0, 1.0);
graphics->blit(t, 35, y, false);
healthPercent = unit->getHealthPercent();
healthBar = 200;
shieldBar = 200;
oxygenBar = 200;
healthBar /= unit->maxHealth;
shieldBar /= unit->maxShield;
oxygenBar /= MAX_OXYGEN;
healthBar *= unit->health;
shieldBar *= unit->shield;
oxygenBar *= unit->oxygen;
y += 16;
if (healthPercent >= 75)
{
c = darkGreen;
}
else if (healthPercent >= 25)
{
c = darkYellow;
}
else
{
c = darkRed;
}
graphics->drawRect(35, y, 200, 8, c, true);
if (unit == player)
{
glColor4f(1.0, 1.0, 1.0, (!game->autoLockTarget) ? 1.0 : 0.15);
//.........这里部分代码省略.........
示例2: doExplosion
void doExplosion(Vector position, int size, Entity *owner)
{
audio->playSound(SND_GRENADE_EXPLODE, CH_EXPLODE, camera->getSoundDistance(position));
addExplosionParticles(size, position);
addExplosionMark(position, size * 2);
if (game->cutsceneType != CUTSCENE_NONE)
{
return;
}
float distance;
for (Unit *unit = (Unit*)entityManager->enemyList.getFirstElement() ; unit != NULL ; unit = (Unit*)unit->next)
{
if (!unit->canBeDamaged())
{
continue;
}
distance = Math::getDistance(unit->position, position);
if (distance > (size * 4))
{
continue;
}
explosionHarmUnit(unit, size, (int)distance, position, owner);
}
for (Unit *unit = (Unit*)entityManager->blobList.getFirstElement() ; unit != NULL ; unit = (Unit*)unit->next)
{
if (!unit->canBeDamaged())
{
continue;
}
distance = Math::getDistance(unit->position, position);
if (distance > (size * 4))
{
continue;
}
explosionHarmUnit(unit, size, (int)distance, position, owner);
}
float damage;
for (Entity *entity = (Entity*)entityManager->structureList.getFirstElement() ; entity != NULL ; entity = (Entity*)entity->next)
{
if (!(entity->flags & EF_IMMORTAL))
{
distance = Math::getDistance(entity->position, position);
damage = (size * 4);
if (distance > (size * 4))
{
continue;
}
if (distance > (damage / 10))
{
for (int i = (size * 4) ; i < distance ; i++)
{
damage *= 0.95;
}
}
if (damage < 1)
{
continue;
}
entity->health -= damage;
debug(("Structure (%s) took %.2f damage from explosion\n", (entity->name != "" ? entity->getName() : "unnamed"), damage));
}
}
Entity *oldSelf;
for (Boss *boss = (Boss*)entityManager->bossList.getFirstElement() ; boss != NULL ; boss = (Boss*)boss->next)
{
if (boss == owner)
{
continue;
}
if (boss->flags & (EF_IMMORTAL|EF_VANISHED))
{
continue;
}
distance = Math::getDistance(boss->position, position);
damage = (size * 4);
//.........这里部分代码省略.........