Esempio n. 1
0
void World::spawnWave(const cocos2d::ValueVector &waveData) {
    for (unsigned int i = 0; i < waveData.size(); i++) {
        const auto &model = getModel((unsigned int) waveData.at(i).asInt());
        _gameplayLayer->addEnemyShip(model, i, _mapLayer->_path, _spawnManager->getCurrentWave());
    }

    _hudLayer->updateWaveIndicators(_spawnManager->getCurrentWave(), _spawnManager->getMaxWave());
}
Esempio n. 2
0
void Json_Parser::write_a_array(cocos2d::ValueVector &temp,rapidjson::Value &val2,rapidjson::Document::AllocatorType&allocator){
     rapidjson::Value array2(rapidjson::kArrayType);
    for (int i=0; i<temp.size(); i++) {
        rapidjson::Value v;
        if(temp.at(i).getType()==Value::Type::DOUBLE){
            v.SetDouble(temp.at(i).asDouble());
            val2.PushBack(v,allocator);
        }
        else if(temp.at(i).getType()==Value::Type::STRING){
            v.SetString(temp.at(i).asString().c_str(),allocator);
            val2.PushBack(v,allocator);
        }
        else if(temp.at(i).getType()==Value::Type::BOOLEAN){
            v.SetBool(temp.at(i).asBool());
            val2.PushBack(v,allocator);
        }
        else if(temp.at(i).getType()==Value::Type::INTEGER){
            v.SetInt(temp.at(i).asInt());
           val2.PushBack(v,allocator);
        }
        else if(temp.at(i).getType()==Value::Type::NONE){
            v.SetNull();
           val2.PushBack(v,allocator);
        }
        else if(temp.at(i).getType()==Value::Type::MAP){
            ValueMap chmap=temp.at(i).asValueMap();
            v.SetObject();
                write_a_map(chmap,v,allocator);
             val2.PushBack(v,allocator);
        }
        else if(temp.at(i).getType()==Value::Type::VECTOR){
            
            ValueVector chvec=temp.at(i).asValueVector();
            v.SetArray();
                write_a_array(chvec, v, allocator);
            val2.PushBack(v, allocator);
        }

    }
    
}