示例#1
0
    bool tick(){
        for(unsigned int i=0; i<velocity; i++){ // TODO: Put here new enemies with RoundsManager
            auto it1 = enemies.begin();
            while(it1 != enemies.end()){
                bool lost = life<=0;
                Enemy* e = *it1;
                if(e->tick()){
                    life -= e->getDamage();
                    delete e;
                    it1 = enemies.erase(it1);
                }else it1++;

                if(life<=0 && !lost){
                    money = 0;
                    clearEntities();

                    for(Tower* t:towers){
                        entities.push_back(new ExplosionEntity(getRealPosition(t->getPosition()), pixelsPerSquare, 200));
                    }

                    clearTowers();
                }
            }
            auto it2 = entities.begin();
            while(it2 != entities.end()){
                Entity* e = *it2;
                if(e->tick()){
                    delete e;
                    it2 = entities.erase(it2);
                }else it2++;
            }
            for(Tower* t : towers){
                t->tick();
            }

            if(life>0){
                if(tickCount%400 == 1)
                    enemies.push_back(new InhibitorEnemy(1.0, 30+tickCount/500, 1));
                else if(tickCount%20 == 1)
                    enemies.push_back(new BasicEnemy(1.0 + (double)(rand()%10)/10.0, 15+tickCount/500, 1));
            }
            ++tickCount;
        }

        return false;
    }
void DRW_Hatch::parseCode(int code, dxfReader *reader){
    switch (code) {
    case 2:
        name = reader->getString();
        break;
    case 70:
        solid = reader->getInt32();
        break;
    case 71:
        associative = reader->getInt32();
        break;
    case 72:        /*edge type*/
        if (ispol){ //if is polyline is a as_bulge flag
            break;
        } else if (reader->getInt32() == 1){ //line
            addLine();
        } else if (reader->getInt32() == 2){ //arc
            addArc();
        } else if (reader->getInt32() == 3){ //elliptic arc
            addEllipse();
        } else if (reader->getInt32() == 4){ //spline
            addSpline();
        }
        break;
    case 10:
        if (pt) pt->basePoint.x = reader->getDouble();
        else if (pline) {
            plvert = pline->addVertex();
            plvert->x = reader->getDouble();
        }
        break;
    case 20:
        if (pt) pt->basePoint.y = reader->getDouble();
        else if (plvert) plvert ->y = reader->getDouble();
        break;
    case 11:
        if (line) line->secPoint.x = reader->getDouble();
        else if (ellipse) ellipse->secPoint.x = reader->getDouble();
        break;
    case 21:
        if (line) line->secPoint.y = reader->getDouble();
        else if (ellipse) ellipse->secPoint.y = reader->getDouble();
        break;
    case 40:
        if (arc) arc->radious = reader->getDouble();
        else if (ellipse) ellipse->ratio = reader->getDouble();
        break;
    case 41:
        scale = reader->getDouble();
        break;
    case 42:
        if (plvert) plvert ->bulge = reader->getDouble();
        break;
    case 50:
        if (arc) arc->staangle = reader->getDouble();
        else if (ellipse) ellipse->staparam = reader->getDouble();
        break;
    case 51:
        if (arc) arc->endangle = reader->getDouble();
        else if (ellipse) ellipse->endparam = reader->getDouble();
        break;
    case 52:
        angle = reader->getDouble();
        break;
    case 73:
        if (arc) arc->isccw = reader->getInt32();
        else if (pline) pline->flags = reader->getInt32();
        break;
    case 75:
        hstyle = reader->getInt32();
        break;
    case 76:
        hpattern = reader->getInt32();
        break;
    case 77:
        doubleflag = reader->getInt32();
        break;
    case 78:
        deflines = reader->getInt32();
        break;
    case 91:
        loopsnum = reader->getInt32();
        looplist.reserve(loopsnum);
        break;
    case 92:
        loop = new DRW_HatchLoop(reader->getInt32());
        looplist.push_back(loop);
        if (reader->getInt32() & 2) {
            ispol = true;
            clearEntities();
            pline = new DRW_LWPolyline;
            loop->objlist.push_back(pline);
        } else ispol = false;
        break;
    case 93:
        if (pline) pline->vertexnum = reader->getInt32();
        else loop->numedges = reader->getInt32();//aqui reserve
        break;
    case 98: //seed points ??
        clearEntities();
        break;
    default:
        DRW_Point::parseCode(code, reader);
        break;
    }
}
示例#3
0
void MainWorld::handleInput() {
	//TODO move all input functions into update
	if(ts::Keyboard::checkKeyEvent(ts::Keyboard::C) == ts::Keyboard::keyPressed){
		clearEntities();
	}
}
示例#4
0
Renderer::~Renderer() {
  clearController();
  clearEntities();
  delete effectManager_;
}
示例#5
0
//Destrcutor
EntityZone::~EntityZone()
{
	clearEntities();
}
示例#6
0
Wallbreaker::~Wallbreaker()
{
	clearEntities();
}
示例#7
0
EntityManager::~EntityManager()
{
	clearEntities();
}