Changeset 10022 for code/branches/pickupsFS14/src/modules/jump
- Timestamp:
- Apr 3, 2014, 4:05:52 PM (11 years ago)
- Location:
- code/branches/pickupsFS14/src/modules/jump
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickupsFS14/src/modules/jump/Jump.cc
r10017 r10022 46 46 #include "JumpCenterPoint.h" 47 47 #include "JumpShip.h" 48 #include "JumpPlatform.h"49 48 /* 50 49 #include "JumpEnemy.h" … … 65 64 // init(); 66 65 //this->setHUDTemplate("JumpHUD"); 66 67 67 } 68 68 -
code/branches/pickupsFS14/src/modules/jump/Jump.h
r10005 r10022 37 37 38 38 #include "jump/JumpPrereqs.h" 39 40 39 #include "gametypes/Deathmatch.h" 41 42 40 #include "JumpCenterPoint.h" 43 44 41 #include "tools/Timer.h" 42 #include "JumpPlatform.h" 45 43 46 44 namespace orxonox -
code/branches/pickupsFS14/src/modules/jump/JumpPlatform.cc
r10017 r10022 36 36 #include "graphics/ParticleSpawner.h" 37 37 #include "graphics/Model.h" 38 #include "MovableEntity.h" 38 #include "worldentities/MovableEntity.h" 39 #include "chat/ChatManager.h" 40 #include "OrxonoxPrereqs.h" 39 41 40 42 namespace orxonox … … 45 47 { 46 48 RegisterObject(JumpPlatform); 47 /*48 if ( GameMode::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) )49 ThrowException(AbortLoading, "Can't create BigExplosion, no scene or no scene manager given.");50 49 51 this->bStop_ = false;52 this->LOD_ = LODParticle::Normal;53 50 54 if ( GameMode::showsGraphics() ) 55 { 56 try 57 { 58 this->init(); 59 } 60 catch (const std::exception& ex) 61 { 62 orxout(internal_error) << "Couldn't load particle effect in BigExplosion: " << ex.what() << endl; 63 this->initZero(); 64 } 65 } 66 else 67 { 68 this->initZero(); 69 } 51 model = new Model(getContext()); 52 model->setSyncMode(0); 53 model->setMeshSource("drone.mesh"); 70 54 71 if (GameMode::isMaster()) 72 { 73 this->destroyTimer_.setTimer(rnd(2, 4), false, createExecutor(createFunctor(&BigExplosion::stop, this))); 74 } 55 movableEntity = new MovableEntity(getContext()); 56 movableEntity->attach(model); 75 57 76 this->registerVariables(); 77 */ 58 movableEntity->setScale(100); 59 //movableEntity->setPosition(Vector3(0,0,0)); 60 //movableEntity->setVelocity(Vector3(0,0,1)); 61 62 78 63 } 79 64 80 /*void BigExplosion::init()81 {82 this->debrisEntity1_ = new MovableEntity(this->getContext());83 this->debrisEntity2_ = new MovableEntity(this->getContext());84 this->debrisEntity3_ = new MovableEntity(this->getContext());85 this->debrisEntity4_ = new MovableEntity(this->getContext());86 87 this->debrisEntity1_->setSyncMode(0);88 this->debrisEntity2_->setSyncMode(0);89 this->debrisEntity3_->setSyncMode(0);90 this->debrisEntity4_->setSyncMode(0);91 92 this->debris1_ = new Model(this->getContext());93 this->debris2_ = new Model(this->getContext());94 this->debris3_ = new Model(this->getContext());95 this->debris4_ = new Model(this->getContext());96 97 this->debris1_->setSyncMode(0);98 this->debris2_->setSyncMode(0);99 this->debris3_->setSyncMode(0);100 this->debris4_->setSyncMode(0);101 102 this->explosion_ = new StaticEntity(this->getContext());103 this->explosion_->setSyncMode(0);104 105 this->debrisSmoke1_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_);106 this->debrisSmoke2_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_);107 this->debrisSmoke3_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_);108 this->debrisSmoke4_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_);109 110 this->debrisFire1_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/fire4", this->LOD_);111 this->debrisFire2_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/fire4", this->LOD_);112 this->debrisFire3_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/fire4", this->LOD_);113 this->debrisFire4_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/fire4", this->LOD_);114 115 this->debris1_->attachOgreObject(this->debrisSmoke1_->getParticleSystem());116 this->debris1_->attachOgreObject(this->debrisFire1_->getParticleSystem());117 this->debris2_->attachOgreObject(this->debrisSmoke2_->getParticleSystem());118 this->debris2_->attachOgreObject(this->debrisFire2_->getParticleSystem());119 this->debris3_->attachOgreObject(this->debrisSmoke3_->getParticleSystem());120 this->debris3_->attachOgreObject(this->debrisFire3_->getParticleSystem());121 this->debris4_->attachOgreObject(this->debrisSmoke4_->getParticleSystem());122 this->debris4_->attachOgreObject(this->debrisFire4_->getParticleSystem());123 124 this->debris1_->setMeshSource("CockpitDebris.mesh");125 this->debris2_->setMeshSource("WingDebris1.mesh");126 this->debris3_->setMeshSource("BodyDebris1.mesh");127 this->debris4_->setMeshSource("WingDebris2.mesh");128 129 this->debrisEntity1_->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(50,100));130 this->debrisEntity1_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());131 this->debrisEntity1_->setScale(4);132 133 this->debrisEntity2_->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(50,100));134 this->debrisEntity2_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());135 this->debrisEntity2_->setScale(4);136 137 this->debrisEntity3_->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(50,100));138 this->debrisEntity3_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());139 this->debrisEntity3_->setScale(4);140 141 this->debrisEntity4_->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(50,100));142 this->debrisEntity4_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());143 this->debrisEntity4_->setScale(4);144 145 this->debrisEntity1_->attach(debris1_);146 this->debrisEntity2_->attach(debris2_);147 this->debrisEntity3_->attach(debris3_);148 this->debrisEntity4_->attach(debris4_);149 150 ParticleSpawner* effect = new ParticleSpawner(this->getContext());151 effect->setDestroyAfterLife(true);152 effect->setSource("Orxonox/explosion2b");153 effect->setLifetime(4.0f);154 effect->setSyncMode(0);155 156 ParticleSpawner* effect2 = new ParticleSpawner(this->getContext());157 effect2->setDestroyAfterLife(true);158 effect2->setSource("Orxonox/smoke6");159 effect2->setLifetime(4.0f);160 effect2->setSyncMode(0);161 162 this->explosion_->attach(effect);163 this->explosion_->attach(effect2);164 165 this->attach(explosion_);166 this->attach(debrisEntity1_);167 this->attach(debrisEntity2_);168 this->attach(debrisEntity3_);169 this->attach(debrisEntity4_);170 65 171 66 172 for(int i=0;i<10;i++)173 {174 Model* part1 = new Model(this->getContext());175 Model* part2 = new Model(this->getContext());176 177 MovableEntity* partEntity1 = new MovableEntity(this->getContext());178 MovableEntity* partEntity2 = new MovableEntity(this->getContext());179 180 part1->setSyncMode(0);181 part2->setSyncMode(0);182 partEntity1->setSyncMode(0);183 partEntity2->setSyncMode(0);184 185 partEntity1->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10,100));186 partEntity1->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());187 partEntity1->setScale(rnd(1, 3));188 189 partEntity2->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10, 100));190 partEntity2->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());191 partEntity2->setScale(rnd(1, 3));192 193 part1->setMeshSource("SmallPart1.mesh");194 part2->setMeshSource("SmallPart2.mesh");195 196 partEntity1->attach(part1);197 partEntity2->attach(part2);198 199 this->attach(partEntity1);200 this->attach(partEntity2);201 }202 }203 204 void BigExplosion::initZero()205 {206 this->debrisFire1_ = 0;207 this->debrisFire2_ = 0;208 this->debrisFire3_ = 0;209 this->debrisFire4_ = 0;210 211 this->debrisSmoke1_ = 0;212 this->debrisSmoke2_ = 0;213 this->debrisSmoke3_ = 0;214 this->debrisSmoke4_ = 0;215 216 this->explosionSmoke_=0;217 this->explosionFire_=0;218 }219 220 BigExplosion::~BigExplosion()221 {222 if (this->isInitialized())223 {224 if (this->debrisFire1_)225 {226 this->debris1_->detachOgreObject(this->debrisFire1_->getParticleSystem());227 delete this->debrisFire1_;228 }229 if (this->debrisSmoke1_)230 {231 this->debris1_->detachOgreObject(this->debrisSmoke1_->getParticleSystem());232 delete this->debrisSmoke1_;233 }234 235 if (this->debrisFire2_)236 {237 this->debris2_->detachOgreObject(this->debrisFire2_->getParticleSystem());238 delete this->debrisFire2_;239 }240 if (this->debrisSmoke2_)241 {242 this->debris2_->detachOgreObject(this->debrisSmoke2_->getParticleSystem());243 delete this->debrisSmoke2_;244 }245 246 if (this->debrisFire3_)247 {248 this->debris3_->detachOgreObject(this->debrisFire3_->getParticleSystem());249 delete this->debrisFire3_;250 }251 if (this->debrisSmoke3_)252 {253 this->debris3_->detachOgreObject(this->debrisSmoke3_->getParticleSystem());254 delete this->debrisSmoke3_;255 }256 257 if (this->debrisFire4_)258 {259 this->debris4_->detachOgreObject(this->debrisFire4_->getParticleSystem());260 delete this->debrisFire4_;261 }262 if (this->debrisSmoke4_)263 {264 this->debris4_->detachOgreObject(this->debrisSmoke4_->getParticleSystem());265 delete this->debrisSmoke4_;266 }267 }268 }269 270 void BigExplosion::registerVariables()271 {272 registerVariable((int&)(this->LOD_), VariableDirection::ToClient, new NetworkCallback<BigExplosion>(this, &BigExplosion::LODchanged));273 registerVariable(this->bStop_, VariableDirection::ToClient, new NetworkCallback<BigExplosion>(this, &BigExplosion::checkStop));274 }275 276 void BigExplosion::LODchanged()277 {278 if (this->debrisFire1_)279 this->debrisFire1_->setDetailLevel(this->LOD_);280 if (this->debrisSmoke1_)281 this->debrisSmoke1_->setDetailLevel(this->LOD_);282 283 if (this->debrisFire2_)284 this->debrisFire2_->setDetailLevel(this->LOD_);285 if (this->debrisSmoke2_)286 this->debrisSmoke2_->setDetailLevel(this->LOD_);287 288 if (this->debrisFire3_)289 this->debrisFire3_->setDetailLevel(this->LOD_);290 if (this->debrisSmoke3_)291 this->debrisSmoke3_->setDetailLevel(this->LOD_);292 293 if (this->debrisFire4_)294 this->debrisFire4_->setDetailLevel(this->LOD_);295 if (this->debrisSmoke4_)296 this->debrisSmoke4_->setDetailLevel(this->LOD_);297 }298 299 void BigExplosion::checkStop()300 {301 if (this->bStop_)302 this->stop();303 }304 305 void BigExplosion::stop()306 {307 if (this->debrisFire1_)308 this->debrisFire1_->setEnabled(false);309 if (this->debrisSmoke1_)310 this->debrisSmoke1_->setEnabled(false);311 312 if (this->debrisFire2_)313 this->debrisFire2_->setEnabled(false);314 if (this->debrisSmoke2_)315 this->debrisSmoke2_->setEnabled(false);316 317 if (this->debrisFire3_)318 this->debrisFire3_->setEnabled(false);319 if (this->debrisSmoke3_)320 this->debrisSmoke3_->setEnabled(false);321 322 if (this->debrisFire4_)323 this->debrisFire4_->setEnabled(false);324 if (this->debrisSmoke4_)325 this->debrisSmoke4_->setEnabled(false);326 327 if (GameMode::isMaster())328 {329 this->bStop_ = true;330 this->destroyTimer_.setTimer(1.0f, false, createExecutor(createFunctor(&BigExplosion::destroy, this)));331 }332 }*/333 67 334 68 } -
code/branches/pickupsFS14/src/modules/jump/JumpPlatform.h
r10017 r10022 37 37 #include "jump/JumpPrereqs.h" 38 38 39 #include " MobileEntity.h"39 #include "worldentities/MobileEntity.h" 40 40 41 41 namespace orxonox … … 48 48 49 49 private: 50 Model* model; 51 MovableEntity* movableEntity; 50 52 51 53 }; -
code/branches/pickupsFS14/src/modules/jump/JumpShip.cc
r10017 r10022 141 141 else if (downPressed == true) 142 142 { 143 platform = new JumpPlatform(getContext()); 144 platform->setPosition(Vector3(0, 0, 0)); 145 platform->setVelocity(Vector3(0, 0, 0)); 146 platform->setScale(100); 147 143 148 movement -= Vector3(0, 0, 0); 144 149 downPressed = false; -
code/branches/pickupsFS14/src/modules/jump/JumpShip.h
r10017 r10022 40 40 #include "graphics/Camera.h" 41 41 #include "weapons/projectiles/Projectile.h" 42 #include "JumpPlatform.h" 42 43 43 44 namespace orxonox … … 103 104 const float yAcceleration = 10.0f; 104 105 const float ySpeedAfterJump = 300.0f; 106 107 JumpPlatform* platform; 105 108 }; 106 109 }
Note: See TracChangeset
for help on using the changeset viewer.