Bomb::NormalBomb::NormalBomb() { this->ctor(NormalBomb_o); TimerComponent *timer = new TimerComponent(NORMAL_BOMB_TIMER); timer->AssignEntity(this); this->AddComponent(timer); PhysicComponent *physic = new PhysicComponent(0.5); physic->AssignEntity(this); this->AddComponent(physic); MeshComponent *graphic = new MeshComponent(MODEL, new std::string("bombe"), new std::string(MODELPATH"bombe/bombe.fbx"), BombMeshInit, BombMeshDraw, G_Renderer); graphic->AssignEntity(this); this->AddComponent(graphic); ExplodeComponent *explode = new ExplodeComponent(NORMAL_BOMB_POWER, NORMAL_BOMB_SIZE); explode->AssignEntity(this); this->AddComponent(explode); this->_isDestroy = true; // AudioComponent AudioComponent* audio = new AudioComponent(Event::COMMON); audio->AssignEntity(this); this->AddComponent(audio); _sound = new std::string("explosion"); _soundpath = new std::string(SOUNDPATH"BOMB_01.wav"); audio->AddSound(_soundpath, _sound); }
Bomb::Image::Image(int posX, int posY, int width, int height, std::string name, std::string path) { this->ctor(Image_o); PositionComponent *pos = new PositionComponent(); pos->AssignEntity(this); this->AddComponent(pos); /* PhysicComponent *physic = new PhysicComponent(UNDESTRUCTIBLE_BOX_HITBOX); physic->AssignEntity(this); this->AddComponent(physic); */ this->posX = posX; this->posY = posY; this->width = width; this->height = height; this->path = path; this->name = name; MeshComponent *graphic = new MeshComponent(GEOMETRY, new std::string(this->name), new std::string(this->path), ImageMeshInit, ImageMeshDraw, G_Renderer); graphic->AssignEntity(this); this->AddComponent(graphic); }
Bomb::DestructibleBox::DestructibleBox() { this->ctor(DestructibleBox_o); PositionComponent *pos = new PositionComponent(); pos->AssignEntity(this); this->AddComponent(pos); LifeComponent *life = new LifeComponent(1); life->AssignEntity(this); this->AddComponent(life); PhysicComponent *physic = new PhysicComponent(DESTRUCTIBLE_BOX_HITBOX); physic->AssignEntity(this); this->AddComponent(physic); DropBonusComponent *dropBonus = new DropBonusComponent(); dropBonus->AssignEntity(this); this->AddComponent(dropBonus); MeshComponent *graphic = new MeshComponent(GEOMETRY, new std::string("box2"), new std::string(MODELPATH"box2.tga"), DestructibleBoxMeshInit, DestructibleBoxMeshDraw, G_Renderer); graphic->AssignEntity(this); this->AddComponent(graphic); this->_isDestroy = true; /*AudioComponent *audio = new AudioComponent(); audio->AssignEntity(this); this->AddComponent(audio);*/ }