Changeset 2497 for code/branches/presentation/src/orxonox/objects
- Timestamp:
- Dec 17, 2008, 5:41:29 AM (16 years ago)
- Location:
- code/branches/presentation/src/orxonox/objects
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/BillboardProjectile.cc
r2493 r2497 32 32 #include <OgreBillboardSet.h> 33 33 34 #include "core/Core.h" 34 35 #include "core/CoreIncludes.h" 35 36 #include "objects/Scene.h" … … 43 44 RegisterObject(BillboardProjectile); 44 45 45 assert(this->getScene()->getSceneManager()); // getScene() was already checked by WorldEntity 46 if (Core::showsGraphics()) 47 { 48 assert(this->getScene()->getSceneManager()); // getScene() was already checked by WorldEntity 49 this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(0.5, 0.5, 0.7, 0.8), 1); 50 this->attachOgreObject(this->billboard_.getBillboardSet()); 51 } 46 52 47 this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(0.5, 0.5, 0.7, 0.8), 1); 48 this->attachOgreObject(this->billboard_.getBillboardSet()); 49 this->scale(0.2); 53 this->setScale(0.2); 50 54 } 51 55 52 56 BillboardProjectile::~BillboardProjectile() 53 57 { 54 //if (this->isInitialized() && this->owner_)55 //this->detachObject(this->billboard_.getBillboardSet());58 if (this->isInitialized() && Core::showsGraphics() && this->billboard_.getBillboardSet()) 59 this->detachOgreObject(this->billboard_.getBillboardSet()); 56 60 } 57 61 … … 64 68 { 65 69 SUPER(BillboardProjectile, changedVisibility); 70 66 71 this->billboard_.setVisible(this->isVisible()); 67 72 } -
code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.cc
r2493 r2497 33 33 #include <OgreParticleEmitter.h> 34 34 35 #include " ../../worldentities/pawns/SpaceShip.h"35 #include "core/Core.h" 36 36 #include "core/CoreIncludes.h" 37 37 #include "core/ConfigValueIncludes.h" … … 46 46 RegisterObject(ParticleProjectile); 47 47 48 this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot3_small", LODParticle::normal); 49 this->attachOgreObject(this->particles_->getParticleSystem()); 50 this->particles_->setKeepParticlesInLocalSpace(0); 48 if (Core::showsGraphics()) 49 { 50 this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot3_small", LODParticle::normal); 51 this->attachOgreObject(this->particles_->getParticleSystem()); 52 this->particles_->setKeepParticlesInLocalSpace(0); 51 53 52 this->particles_->getAllEmitters()->setDirection(-WorldEntity::FRONT); 53 /* 54 if (this->owner_) 55 { 54 this->particles_->getAllEmitters()->setDirection(-WorldEntity::FRONT); 56 55 } 57 // else 58 // { 59 // this->particles_ = 0; 60 // } 61 */ 62 63 this->setConfigValues(); 56 else 57 this->particles_ = 0; 64 58 } 65 59 … … 73 67 } 74 68 75 void ParticleProjectile::setConfigValues()76 {77 //SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback((Projectile*)this, &ParticleProjectile::speedChanged);78 }79 80 69 void ParticleProjectile::changedVisibility() 81 70 { 82 71 SUPER(ParticleProjectile, changedVisibility); 83 this->particles_->setEnabled(this->isVisible()); 72 73 if (this->particles_) 74 this->particles_->setEnabled(this->isVisible()); 84 75 } 85 76 } -
code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.h
r2493 r2497 44 44 virtual ~ParticleProjectile(); 45 45 virtual void changedVisibility(); 46 void setConfigValues();47 46 48 47 private: -
code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/Projectile.cc
r2494 r2497 40 40 #include "objects/worldentities/Model.h" 41 41 #include "objects/worldentities/ParticleSpawner.h" 42 #include "objects/worldentities/pawns/Pawn.h"43 42 #include "objects/collisionshapes/SphereCollisionShape.h" 44 43 #include "core/Core.h" … … 63 62 this->attachCollisionShape(shape); 64 63 65 if( !Core::isClient()) //only if not on client64 if(Core::isMaster()) 66 65 this->destroyTimer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&Projectile::destroyObject))); 67 66 } … … 91 90 void Projectile::destroyObject() 92 91 { 93 delete this; 92 if (Core::isMaster()) 93 delete this; 94 94 } 95 95 96 96 bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 97 97 { 98 if (!this->bDestroy_ )98 if (!this->bDestroy_ && Core::isMaster()) 99 99 { 100 100 this->bDestroy_ = true; 101 Pawn* victim = dynamic_cast<Pawn*>(otherObject);102 if (victim)103 victim->damage(this->damage_, this->owner_);104 105 101 106 102 if (this->owner_) … … 123 119 } 124 120 } 121 122 Pawn* victim = dynamic_cast<Pawn*>(otherObject); 123 if (victim) 124 victim->damage(this->damage_, this->owner_); 125 125 } 126 126 return false; 127 127 } 128 129 void Projectile::destroyedPawn(Pawn* pawn) 130 { 131 if (this->owner_ == pawn) 132 this->owner_ = 0; 133 } 128 134 } -
code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/Projectile.h
r2494 r2497 33 33 34 34 #include "objects/worldentities/MovableEntity.h" 35 #include "objects/worldentities/pawns/Pawn.h" 35 36 #include "tools/Timer.h" 36 37 37 38 namespace orxonox 38 39 { 39 class _OrxonoxExport Projectile : public MovableEntity 40 class _OrxonoxExport Projectile : public MovableEntity, public PawnListener 40 41 { 41 42 public: … … 48 49 virtual void tick(float dt); 49 50 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 51 virtual void destroyedPawn(Pawn* pawn); 50 52 51 53 inline void setOwner(Pawn* owner) -
code/branches/presentation/src/orxonox/objects/worldentities/Camera.cc
r2493 r2497 112 112 this->cameraNode_->translate(coeff * offset); 113 113 114 this->cameraNode_->setOrientation(Quaternion::Slerp(coeff, this->cameraNode_->getWorldOrientation(), this->getWorldOrientation(), false));114 this->cameraNode_->setOrientation(Quaternion::Slerp(coeff, this->cameraNode_->getWorldOrientation(), this->getWorldOrientation(), true)); 115 115 //this->cameraNode_->setOrientation(this->getWorldOrientation()); 116 116 } -
code/branches/presentation/src/orxonox/objects/worldentities/ParticleEmitter.cc
r2485 r2497 102 102 { 103 103 if (this->particles_) 104 { 104 105 delete this->particles_; 106 this->particles_ = 0; 107 } 105 108 106 109 if (this->getScene() && this->getScene()->getSceneManager()) … … 119 122 } 120 123 } 121 else122 this->particles_ = 0;123 124 } 124 125 -
code/branches/presentation/src/orxonox/objects/worldentities/WorldEntity.cc
r2494 r2497 104 104 this->node_->removeAllChildren(); 105 105 106 if (this->physicalBody_) 107 { 108 this->deactivatePhysics(); 109 delete this->physicalBody_; 110 } 111 delete this->collisionShape_; 112 106 113 if (this->getScene()->getSceneManager()) 107 114 this->getScene()->getSceneManager()->destroySceneNode(this->node_->getName()); 108 109 // TODO: Detach from parent and detach all children.110 111 if (this->physicalBody_)112 {113 this->deactivatePhysics();114 delete this->physicalBody_;115 }116 delete this->collisionShape_;117 115 } 118 116 }
Note: See TracChangeset
for help on using the changeset viewer.