std::vector<SharedEntity> EnemyTorpedo::getNew(SharedResourceManager r) { std::vector<SharedEntity> v; v.push_back(SharedEntity(new PlayerTorpedoTrail( r->getShape("enemy_torpedo_trail"), rot, pos))); //add explosion if (shouldRemove) { v.push_back(SharedEntity(new Explosion( r->getShape("enemy_torpedo_ex"), pos, 0.1, 10))); } return v; }
SharedEntity FactoryBase::createEntity(const Core::Type &t, const Core::Identifier &i, EntitySceneLayer &l) const { if (t == Entity::Type()) return(new Entity(i, l)); return(SharedEntity()); }
std::vector<SharedEntity> Drone::getNew(SharedResourceManager r) { std::vector<SharedEntity> v; if (shouldRemove) { v.push_back(SharedEntity(new Explosion( r->getShape("drone_explosion"), pos, 0.2, 10))); unsigned pickup = rand() % 24; if (pickup >= 2 && pickup <= 6) { v.push_back(SharedEntity( new Missle(r->getShape("missle"), pos))); } if (pickup == 1) { v.push_back(SharedEntity( new Health(r->getShape("health"), pos))); } } else { float x = 0.0; float y = ((rand() % 45)) - 22; float z = 0.0; util::vec::Vector3D rot(x, y, z); v.push_back(SharedEntity( new EnemyTorpedo(r->getShape("enemy_torpedo"), rot, pos, up))); } return v; }
std::vector<SharedEntity> Boss::getNew(SharedResourceManager r) { std::vector<SharedEntity> v; if (shouldRemove) { v.push_back(SharedEntity(new Explosion( r->getShape("station_explosion"), pos, 6.0, 100, true))); } else { unsigned pickup = rand() % 1000; if (pickup == 2 || pickup == 3) { v.push_back(SharedEntity( new Missle(r->getShape("missle"), pos))); } if (pickup == 1) { v.push_back(SharedEntity( new Health(r->getShape("health"), pos))); } if (fire) { if (torp) { float x = 0.0; float y = ((rand() % 45)) - 22; float z = 0.0; util::vec::Vector3D rot(x, y, z); v.push_back(SharedEntity( new EnemyTorpedo(r->getShape("enemy_torpedo"), rot, pos, up))); } else { for (int i = 0; i < 180; i += 35) { float x = 0.0; float y = (i - 90) * util::val::degreesToRadians; float z = 0.0; float rotMatrix[] = {cos(y)*cos(z), sin(x)*sin(y)*cos(z)-cos(x)*sin(z), sin(x)*sin(z)+cos(x)*sin(y)*cos(z), cos(y)*sin(z), cos(x)*cos(z)+sin(x)*sin(y)*sin(z), cos(x)*sin(y)*sin(z)-sin(x)*cos(z), -sin(y), sin(x)*cos(y), cos(x)*cos(y)}; util::vec::Vector3D mS(0.1 * rotMatrix[2], 0.1 * rotMatrix[5], (0.5 * rotMatrix[8])); v.push_back(SharedEntity( new EnemyLasor(r->getShape("enemy_lasor"), pos, mS))); } } } } return v; }