本文整理汇总了C++中Enemy::Respawn方法的典型用法代码示例。如果您正苦于以下问题:C++ Enemy::Respawn方法的具体用法?C++ Enemy::Respawn怎么用?C++ Enemy::Respawn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enemy
的用法示例。
在下文中一共展示了Enemy::Respawn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadXmlEnemy
/*
* Create and add multiple enemies specified by xml, ensures enemies
* arent placed on top of each other. Will probably infinite loop if you
* try to put too many enemies in too small an area, need to check that
*/
void CharacterManager::loadXmlEnemy(const string &name){
Enemy *tmp;
std::list<Enemy *>::iterator enemy;
int howMany = Gamedata::getInstance().getXmlInt(name+"Num");
for(int i = 0; i < howMany; ++i){
tmp = new Enemy(name);
tmp->Respawn();
monsters.push_back(tmp);
}
}
示例2: respawn
void CharacterManager::respawn(){
std::list<Enemy *>::iterator enemy;
for(enemy = dead.begin(); enemy != dead.end(); enemy++){
Uint32 sinceDeath = Clock::getInstance().getTicks() - (*enemy)->getTimeOfDeath();
if(sinceDeath/1000 > (*enemy)->getRespawnRate()){
Enemy *tmp = new Enemy((*enemy)->getName());
tmp->Respawn();
monsters.push_back(tmp);
tmp = *enemy;
enemy = dead.erase(enemy);
delete tmp;
}
}
}