本文整理汇总了C++中Enemy::Activate方法的典型用法代码示例。如果您正苦于以下问题:C++ Enemy::Activate方法的具体用法?C++ Enemy::Activate怎么用?C++ Enemy::Activate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enemy
的用法示例。
在下文中一共展示了Enemy::Activate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SpawnBoss
void EnemySpawner:: SpawnBoss()
{
Enemy* lEnemy;
lEnemy = dynamic_cast<Enemy*>(_Game->Spawn(new Enemy(), _Game->_Settings->EnemyBossTexture, true, nullptr));
lEnemy->SetHealth(_Game->_Settings->EnemyBossHealth);
lEnemy->SetSpeed(_Game->_Settings->EnemyBossSpeed);
lEnemy->Activate();
lEnemy->SetText("");
}
示例2: GenerateEnemy
void EnemyGenerator::GenerateEnemy()
{
Enemy* enemy;
// Get all the % values for the colors
vector<float> allColorKeys = KeysInVector(allColorTypeChances);
float colorTypeChance = randomPourcentageGenerator();
//Get a random key from the Vector of keys and use it to get it's paired color enum
Enemy::ColorType color = allColorTypeChances[GetEnumKey(allColorKeys, colorTypeChance)];
// Create proper enemy depending on color
switch (color)
{
case Enemy::green:
enemy = GreenEnemy::Create();
break;
case Enemy::orange:
enemy = OrangeEnemy::Create();
break;
case Enemy::red:
enemy = RedEnemy::Create();
break;
default:
break;
}
enemy->color = color;
// Same concept for color but with the shape
vector<float> allShapeKeys = KeysInVector(allShapeTypeChances);
float shapeTypeChance = randomPourcentageGenerator();
enemy->shape = allShapeTypeChances[GetEnumKey(allShapeKeys, shapeTypeChance)];
enemy->enemySprite = Sprite::create(textBank->enemyTexture);
enemy->enemySprite->setTag(ENEMY_TAG);
// Used for referencing object to delete
enemy->enemySprite->setUserData(enemy);
// Find the proper rect on the enemy spritesheat
enemy->SetupEnemySpriteRect(enemy);
// Apply proper collider geometry
enemy->SetupCollisionShape(enemy);
// Move above the screen with random X pos
enemy->SetStartingPos(enemy->enemySprite);
enemyLayer->addChild(enemy->enemySprite);
enemy->Activate();
}
示例3: SpawnEnemy
void EnemySpawner:: SpawnEnemy()
{
Enemy* lEnemy;
if (Wave == 1)
{
lEnemy = dynamic_cast<Enemy*>(_Game->Spawn(new Enemy(), _Game->_Settings->Enemy1Texture, true, nullptr));
lEnemy->SetHealth(_Game->_Settings->Enemy1Health);
lEnemy->SetSpeed(_Game->_Settings->Enemy1Speed);
lEnemy->SetSound(_Game->_Settings->EnemyDeathSound);
}
if (Wave >= 2)
{
lEnemy = dynamic_cast<Enemy*>(_Game->Spawn(new Enemy(), _Game->_Settings->Enemy2Texture, true, nullptr));
lEnemy->SetHealth(_Game->_Settings->Enemy2Health);
lEnemy->SetSpeed(_Game->_Settings->Enemy2Speed);
lEnemy->SetSound(_Game->_Settings->EnemyDeathSound);
}
lEnemy->Activate();
}