void HealSkillComponent::fireSkill(void) { if(this->_target != nullptr) { GameEntity* healingbolt = new GameEntity(this->_game, D3DXVECTOR3(5, 5, 5)); healingbolt->SetType(Projectile); healingbolt->setPosition(this->_entity->getPosition()); healingbolt->setDirection(D3DXVECTOR3(this->_entity->getDirection().x, 0, this->_entity->getDirection().z)); healingbolt->setVelocity(5); ScaledBoxGraphicsComponent* graphics = new ScaledBoxGraphicsComponent(this->_game, healingbolt, D3DCOLOR_RGBA(0,255,0,150)); RadiusBasedCollisionComponent* collision = new RadiusBasedCollisionComponent(this->_game, healingbolt, 10, this->_group, Heal); AIControllerComponent* aiController = new AIControllerComponent(this->_game, healingbolt); LinearPathfindingComponent* pathfinding = new LinearPathfindingComponent(this->_game, healingbolt, aiController); pathfinding->FollowEntity(this->_target); collision->SetTarget(this->_target); healingbolt->AddComponent(aiController); healingbolt->AddComponent(pathfinding); healingbolt->AddComponent(collision); healingbolt->AddGraphicsComponent(graphics); healingbolt->Initialize(); this->_children.push_back(healingbolt); } }
void FireboltSkillComponent::fireSkill(void) { if(this->_children.size() < 4) { GameEntity* firebolt = new GameEntity(this->_game, D3DXVECTOR3(5, 5, 5)); firebolt->SetType(Projectile); firebolt->setPosition(this->_entity->getPosition()); firebolt->setDirection(D3DXVECTOR3(this->_entity->getDirection().x, 0, this->_entity->getDirection().z)); firebolt->setVelocity(5); ScaledBoxGraphicsComponent* graphics = new ScaledBoxGraphicsComponent(this->_game, firebolt, D3DCOLOR_RGBA(255,100,0,150)); RadiusBasedCollisionComponent* collision = new RadiusBasedCollisionComponent(this->_game, firebolt, 10, this->_group, MinusLife); PointLightComponent* light = new PointLightComponent(this->_game, firebolt, D3DXCOLOR(1.0f, 0.1f, 0.0f, 1.0f), 50); firebolt->AddComponent(collision); firebolt->AddComponent(light); firebolt->AddGraphicsComponent(graphics); firebolt->Initialize(); this->_children.push_back(firebolt); } else { this->_children[this->_indexBuffer%this->_children.size()]->setPosition(this->_entity->getPosition()); this->_children[this->_indexBuffer%this->_children.size()]->setDirection(D3DXVECTOR3(this->_entity->getDirection().x, 0, this->_entity->getDirection().z)); this->_children[this->_indexBuffer%this->_children.size()]->Enable(); this->_indexBuffer++; } }