Ejemplo n.º 1
0
void
LaneRoadItem::init()
{
    // ElevationEditor //
    //
    laneEditor_ = dynamic_cast<LaneEditor *>(getProjectGraph()->getProjectWidget()->getProjectEditor());
    if (!laneEditor_)
    {
        qDebug("Warning 1006241105! ElevationRoadItem not created by an ElevationEditor");
    }
    // SectionItems //
    //
    foreach (LaneSection *section, getRoad()->getLaneSections())
    {
        new LaneSectionItem(laneEditor_, this, section);
    }
Ejemplo n.º 2
0
void
CrossfallRoadPolynomialItem::init()
{
    // CrossfallEditor //
    //
    crossfallEditor_ = dynamic_cast<CrossfallEditor *>(getProfileGraph()->getProjectWidget()->getProjectEditor());
    if (!crossfallEditor_)
    {
        qDebug("Warning 1006241105! CrossfallRoadPolynomialItem not created by an CrossfallEditor");
    }

    foreach (CrossfallSection *section, getRoad()->getCrossfallSections())
    {
        // SectionItem //
        //
        new CrossfallSectionPolynomialItem(this, section);
    }
Ejemplo n.º 3
0
void
SuperelevationRoadItem::init()
{
    // SuperelevationEditor //
    //
    superelevationEditor_ = dynamic_cast<SuperelevationEditor *>(getProjectGraph()->getProjectWidget()->getProjectEditor());
    if (!superelevationEditor_)
    {
        qDebug("Warning 1007141555! SuperelevationRoadItem not created by an SuperelevationEditor");
    }

    // SectionItems //
    //
    foreach (SuperelevationSection *section, getRoad()->getSuperelevationSections())
    {
        new SuperelevationSectionItem(superelevationEditor_, this, section);
    }
void
SuperelevationRoadPolynomialItem::init()
{
    // SuperelevationEditor //
    //
    superelevationEditor_ = dynamic_cast<SuperelevationEditor *>(getProfileGraph()->getProjectWidget()->getProjectEditor());
    if (!superelevationEditor_)
    {
        qDebug("Warning 1006241105! SuperelevationRoadPolynomialItem not created by an SuperelevationEditor");
    }

    foreach (SuperelevationSection *section, getRoad()->getSuperelevationSections())
    {
        // SectionItem //
        //
        new SuperelevationSectionPolynomialItem(this, section);
    }
Ejemplo n.º 5
0
void BaseMap::addMonsters(float dt)
{ 
	//waveVector.size()为波束
	//waveVector.at()保存该wave怪物,size为怪物个数
	//waveVector.at().at()保存该0.5s内需要创建的怪物,.size为怪物个数
	if( time < waveVector.at(wave).size())
	{
		for(int i=0 ;i<waveVector.at(wave).at(time).size();i++)
		{
			auto monsterData = waveVector.at(wave).at(time).at(i);
			switch (monsterData->getType())
			{
			case(0):{
				auto thug = Thug::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				addChild(thug);
				GameManager::getInstance()->monsterVector.pushBack(thug);}
				break;
			case(1):{
				auto raider = Raider::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				addChild(raider);
				GameManager::getInstance()->monsterVector.pushBack(raider);}
				break;
			case(2):{
				auto wolf = Wolf::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(wolf);
				addChild(wolf);}
				break;
			case(3):{
				auto Immortal = Immortal::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(Immortal);
				addChild(Immortal);}
				break;
			case(4):{
				auto fallen = Fallen::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(fallen);
				addChild(fallen);}
				break;
			case(5):{
				auto waspHornet = WaspHornet::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(waspHornet);
				addChild(waspHornet);}
				break;
			case(6):{
				auto waspQueen = WaspQueen::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(waspQueen);
				addChild(waspQueen);}
				break;
			case(7):{
				auto scorpion = Scorpion::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(scorpion);
				addChild(scorpion);}
				break;
			case(8):{
				auto tremor = Tremor::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(tremor);
				addChild(tremor);}
				break;
			case(9):{
				auto munra = Munra::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(munra);
				addChild(munra);}
				break;
			case(10):{
				auto executioner = Executioner::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(executioner);
				addChild(executioner);}
				break;
			case(11):{
				auto canibal = Canibal::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(canibal);
				addChild(canibal);}
				break;
			case(12):{
				auto gorilla = Gorilla::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(gorilla);
				addChild(gorilla);}
				break;
			case(13):{
				auto hunter = Hunter::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(hunter);
				addChild(hunter);}
				break;
			case(14):{
				auto priest = Priest::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(priest);
				addChild(priest);}
				break;
			case(15):{
				auto shaman = Shaman::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(shaman);
				addChild(shaman);}
				break;
			case(16):{
				auto shield = Shield::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(shield);
				addChild(shield);}
				break;
			case(17):{
				auto wingRider = WingRider::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(wingRider);
				addChild(wingRider);}
				break;
			case(18):{
				auto blazefang = Blazefang::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(blazefang);
				addChild(blazefang);}
				break;
			case(19):{
				auto broodguard = Broodguard::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(broodguard);
				addChild(broodguard);}
				break;
			case(20):{
				auto elite = Elite::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(elite);
				addChild(elite);}
				break;
			case(21):{
				auto myrmidon = Myrmidon::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(myrmidon);
				addChild(myrmidon);}
				break;
			case(22):{
				auto nightscale = Nightscale::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(nightscale);
				addChild(nightscale);}
				break;
			case(23):{
				auto quetzal = Quetzal::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()));
				GameManager::getInstance()->monsterVector.pushBack(quetzal);
				addChild(quetzal);}
				break;
			case(100):{
				auto Boss_Efreeti = Boss_Efreeti::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()),path);
				GameManager::getInstance()->monsterVector.pushBack(Boss_Efreeti);
				addChild(Boss_Efreeti);}
				break;
			case(101):{
				auto Boss_Canibal = Boss_Canibal::createMonster(path.at(monsterData->getRoad()).at(monsterData->getPath()),path);
				GameManager::getInstance()->monsterVector.pushBack(Boss_Canibal);
				addChild(Boss_Canibal);}
				break;
			default:
				break;
			}
		}	
		time ++;
	}else{
		time = 0;
		if(wave!=maxWave-1)
		//15秒后显示WaveProgressBar
		{
			SoundManager::playNextWaveReady();
			scheduleOnce(schedule_selector(BaseMap::showWaveProgressBars),15.0f);
		}else{
			isEnd = true;
		}
	}
}