Changeset 2986
- Timestamp:
- May 18, 2009, 6:00:13 PM (16 years ago)
- Location:
- code/branches/gametypes/src/orxonox/objects
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gametypes/src/orxonox/objects/gametypes/Asteroids.cc
r2978 r2986 44 44 RegisterObject(Asteroids); 45 45 this->firstCheckpointReached_ = false; 46 this->firstTimeSpawned_ = false; 46 47 } 47 48 … … 59 60 this->end(); 60 61 } 61 62 62 } 63 63 64 void Asteroids::spawnPlayer(PlayerInfo* player) 65 { 66 if (this->timerIsActive_ && this->firstTimeSpawned_) 67 { 68 this->end(); 69 return; 70 } 71 72 this->firstTimeSpawned_ = true; 73 Gametype::spawnPlayer(player); 74 } 64 75 65 76 void Asteroids::start() -
code/branches/gametypes/src/orxonox/objects/gametypes/Asteroids.h
r2970 r2986 50 50 { this->firstCheckpointReached_ = reached; } 51 51 52 protected: 53 virtual void spawnPlayer(PlayerInfo* player); 54 52 55 private: 53 56 bool firstCheckpointReached_; 54 57 bool gameEnded_; 58 bool firstTimeSpawned_; 55 59 56 60 }; -
code/branches/gametypes/src/orxonox/objects/quest/QuestEffectBeacon.cc
r2662 r2986 41 41 42 42 #include "orxonox/objects/infos/PlayerInfo.h" 43 #include "orxonox/objects/worldentities/ ControllableEntity.h"43 #include "orxonox/objects/worldentities/pawns/Pawn.h" 44 44 #include "orxonox/objects/worldentities/triggers/PlayerTrigger.h" 45 45 #include "QuestEffect.h" … … 120 120 121 121 //! Extracting the ControllableEntity form the PlayerTrigger. 122 ControllableEntity* entity= trigger->getTriggeringPlayer();123 124 if( entity== NULL)125 { 126 COUT(2) << "The QuestEffectBeacon was triggered by an entity other than a ControllableEntity." << std::endl;122 Pawn* pawn = trigger->getTriggeringPlayer(); 123 124 if(pawn == NULL) 125 { 126 COUT(2) << "The QuestEffectBeacon was triggered by an entity other than a Pawn." << std::endl; 127 127 return false; 128 128 } 129 129 130 130 //! Extract the PlayerInfo from the ControllableEntity. 131 PlayerInfo* player = entity->getPlayer();131 PlayerInfo* player = pawn->getPlayer(); 132 132 133 133 if(player == NULL) -
code/branches/gametypes/src/orxonox/objects/worldentities/MovableEntity.cc
r2662 r2986 35 35 #include "core/Executor.h" 36 36 #include "core/Core.h" 37 #include "objects/worldentities/pawns/Pawn.h" 37 38 38 39 namespace orxonox … … 67 68 { 68 69 SUPER(MovableEntity, XMLPort, xmlelement, mode); 70 71 XMLPortParam(MovableEntity, "enablecollisiondamage", setEnableCollisionDamage, getEnableCollisionDamage, xmlelement, mode).defaultValues(false); 72 XMLPortParam(MovableEntity, "collisiondamage", setCollisionDamage, getCollisionDamage, xmlelement, mode).defaultValues(1); 69 73 } 74 75 bool MovableEntity::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 76 { 77 if (Core::isMaster() && enableCollisionDamage_) 78 { 79 Pawn* victim = dynamic_cast<Pawn*>(otherObject); 80 if (victim) 81 { 82 COUT(0) << "colission"; 83 84 victim->damage(this->collisionDamage_ * victim->getVelocity().dotProduct(this->getVelocity())); 85 } 86 } 87 88 return false; 89 } 90 70 91 71 92 void MovableEntity::registerVariables() -
code/branches/gametypes/src/orxonox/objects/worldentities/MovableEntity.h
r2662 r2986 46 46 47 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 48 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 48 49 void registerVariables(); 49 50 … … 55 56 inline void setOrientation(const Quaternion& orientation) 56 57 { MobileEntity::setOrientation(orientation); this->overwrite_orientation_ = this->getOrientation(); } 58 59 inline void setOwner(Pawn* owner) 60 { this->owner_ = owner; } 61 inline Pawn* getOwner() const 62 { return this->owner_; } 63 64 inline void setCollisionDamage(float c) 65 { this->collisionDamage_ = c; } 66 67 inline float getCollisionDamage() 68 { return this->collisionDamage_; } 69 70 inline void setEnableCollisionDamage(bool c) 71 { 72 this->enableCollisionDamage_ = c; 73 this->enableCollisionCallback(); 74 } 75 76 inline bool getEnableCollisionDamage() 77 { return this->enableCollisionDamage_; } 57 78 58 79 private: … … 76 97 Timer<MovableEntity> resynchronizeTimer_; 77 98 Timer<MovableEntity>* continuousResynchroTimer_; 99 100 Pawn* owner_; 101 float collisionDamage_; 102 bool enableCollisionDamage_; 78 103 }; 79 104 } -
code/branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.cc
r2978 r2986 37 37 38 38 #include "orxonox/objects/worldentities/ControllableEntity.h" 39 #include "orxonox/objects/worldentities/pawns/Pawn.h" 39 40 40 41 namespace orxonox … … 51 52 this->bIsDestination_ = false; 52 53 //this->setVisible(true); 54 55 this->notifyMaskUpdate(); 53 56 } 54 57 … … 87 90 } 88 91 } 92 93 void CheckPoint::notifyMaskUpdate() 94 { 95 this->targetMask_.exclude(Class(BaseObject)); 96 this->targetMask_.include(Class(Pawn)); 97 } 89 98 } -
code/branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.h
r2970 r2986 57 57 private: 58 58 virtual void triggered(bool bIsTriggered); 59 virtual void notifyMaskUpdate(); 59 60 60 61 inline void setDestination(bool isDestination) -
code/branches/gametypes/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc
r2826 r2986 35 35 #include "core/XMLPort.h" 36 36 37 #include "orxonox/objects/worldentities/ ControllableEntity.h"37 #include "orxonox/objects/worldentities/pawns/Pawn.h" 38 38 39 39 namespace orxonox … … 109 109 WEMask.include(Class(WorldEntity)); 110 110 this->targetMask_ *= WEMask; 111 112 this->notifyMaskUpdate(); 111 113 } 112 114 … … 133 135 if(this->isForPlayer()) 134 136 { 135 ControllableEntity* player = dynamic_cast<ControllableEntity*>(entity);137 Pawn* player = dynamic_cast<Pawn*>(entity); 136 138 this->setTriggeringPlayer(player); 137 139 } -
code/branches/gametypes/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h
r2826 r2986 63 63 protected: 64 64 virtual bool isTriggered(TriggerMode mode); 65 virtual void notifyMaskUpdate() {} 66 67 ClassTreeMask targetMask_; 65 68 66 69 private: 67 ClassTreeMask targetMask_;68 70 std::set<Ogre::Node*> targetSet_; 69 71 float distance_; -
code/branches/gametypes/src/orxonox/objects/worldentities/triggers/PlayerTrigger.h
r2662 r2986 60 60 @return Returns a pointer to the ControllableEntity that triggered the PlayerTrigger. 61 61 */ 62 inline ControllableEntity* getTriggeringPlayer(void) const62 inline Pawn* getTriggeringPlayer(void) const 63 63 { return this->player_; } 64 64 … … 77 77 @param player A pointer to the ControllableEntity that triggered the PlayerTrigger. 78 78 */ 79 inline void setTriggeringPlayer( ControllableEntity* player)79 inline void setTriggeringPlayer(Pawn* player) 80 80 { this->player_ = player; } 81 81 … … 88 88 89 89 private: 90 ControllableEntity* player_; //!< The player that triggered the PlayerTrigger.90 Pawn* player_; //!< The player that triggered the PlayerTrigger. 91 91 bool isForPlayer_; //!< Is true when the PlayerTrigger schould be set to normally be triggered by ControllableEntities. 92 92
Note: See TracChangeset
for help on using the changeset viewer.