void EnemySpawner::spawnCountOfEnemy(const SpawnerInfo& enemyToSpawnNow, GameData * _gameData ) { for(int i = enemyToSpawnNow.amount; i > 0; i --) { //EnemyCollection& enemysColl = _gameData->getEnemys(); BaseCollection<ShipPrefab, EnemyObject>& enemiesCollection = _gameData->getEnemies(); EnemyObject * tmpEnemy = _gameData->instantiateEnemy(enemyToSpawnNow.prefabID, AI_TYPE::fighter); Vector3 newPosition = myPosition + Vector3(200.0*(i-1), 0.0, 0.0); tmpEnemy->setPosition(newPosition); EffectObject * spawnEffect = _gameData->instantiateEffect(enemyToSpawnNow.spawnEffectID); spawnEffect->setPosition(newPosition); } }
void LoginLayerUC::initLoadingEffect() { CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("skill/loading.plist"); AnimationManager::sharedAction()->ParseAnimation("loading"); //loading贴图 EffectObject* pLoadEffect = EffectObject::create("loading", BattleSpace::sPlayType::eRepeat); pLoadEffect->setPosition(VCENTER); pLoadEffect->setEffAnchorPoint(0.5f,0.5f); pLoadEffect->setScale(0.6f); this->addChild(pLoadEffect, 999); m_pLoading = pLoadEffect; m_pLoading->setVisible(false); }
void ObjectStateUpdateSystem::createExplosionFor( GameObject_WithCollider * removedObject, GameData& mGameData ) { GameObjectType objectType = removedObject->getType(); if (objectType == GameObjectType::effectObject) { return; } unsigned effectId = removedObject->getExpolsionEffectID(); if (effectId == 0) { return; // Some objects may not have own explosion effect } EffectObject * effect = mGameData.instantiateEffect(effectId); effect->setPosition(removedObject->getPosition()); effect->setOrientation(removedObject->getOrientation()); return; }