Changeset 2822 in orxonox.OLD for orxonox/trunk/src/world_entity.cc
- Timestamp:
- Nov 12, 2004, 1:33:25 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entity.cc
r2190 r2822 36 36 WorldEntity::WorldEntity (bool isFree) : bFree(isFree) 37 37 { 38 collisioncluster = NULL; 39 owner = NULL; 38 this->bDraw = true; 39 collisioncluster = NULL; 40 owner = NULL; 40 41 } 41 42 … … 45 46 WorldEntity::~WorldEntity () 46 47 { 47 48 if( collisioncluster != NULL) delete collisioncluster; 48 49 } 49 50 50 51 /** 51 52 52 \brief get the Location of the WorldEntity 53 \return a pointer to location 53 54 */ 54 55 Location* WorldEntity::get_location () 55 56 { 56 57 return &loc; 57 58 } 58 59 59 60 /** 60 61 61 \brief get the Placement of the WorldEntity 62 \return a pointer to placement 62 63 */ 63 64 Placement* WorldEntity::get_placement () 64 65 { 65 66 return &place; 66 67 } 67 68 68 69 /** 69 70 70 \brief query whether the WorldEntity in question is free 71 \return true if the WorldEntity is free or false if it isn't 71 72 */ 72 73 bool WorldEntity::isFree () … … 76 77 77 78 /** 78 79 80 81 79 \brief set the WorldEntity's collision hull 80 \param newhull: a pointer to a completely assembled CollisionCluster 81 82 Any previously assigned collision hull will be deleted on reassignment 82 83 */ 83 84 void WorldEntity::set_collision (CollisionCluster* newhull) 84 85 { 85 86 87 86 if( newhull == NULL) return; 87 if( collisioncluster != NULL) delete collisioncluster; 88 collisioncluster = newhull; 88 89 } 89 90 90 91 /** 91 92 93 94 92 \brief this method is called every frame 93 \param time: the time in seconds that has passed since the last tick 94 95 Handle all stuff that should update with time inside this method (movement, animation, etc.) 95 96 */ 96 97 void WorldEntity::tick(float time) … … 100 101 /** 101 102 \brief the entity is drawn onto the screen with this function 102 103 103 104 This is a central function of an entity: call it to let the entity painted to the screen. Just override this function with whatever you want to be drawn. 104 105 */ … … 108 109 109 110 /** 110 111 112 113 111 \brief this function is called, when two entities collide 112 \param other: the world entity with whom it collides 113 \param ownhitflags: flags to the CollisionCluster subsections that registered an impact 114 \param otherhitflags: flags to the CollisionCluster subsections of the other entity that registered an impact 114 115 115 116 Implement behaviour like damage application or other miscellaneous collision stuff in this function 116 117 */ 117 118 void WorldEntity::collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags) {} … … 135 136 136 137 /** 137 138 \brief basic initialisation for bound Entities 138 139 */ 139 140 void WorldEntity::init( Location* spawnloc, WorldEntity* spawnowner) 140 141 { 141 142 142 loc = *spawnloc; 143 owner = spawnowner; 143 144 } 144 145 145 146 /** 146 147 \brief basic initialisation for free Entities 147 148 */ 148 149 void WorldEntity::init( Placement* spawnplc, WorldEntity* spawnowner) 149 150 { 150 151 151 place = *spawnplc; 152 owner = spawnowner; 152 153 } 153 154 154 155 /** 155 156 157 158 156 \brief this is called immediately after the Entity has been constructed and initialized 157 158 Put any initialisation code that requires knowledge of location (placement if the Entity is free) and owner of the entity here. 159 DO NOT place such code in the constructor, those variables are set AFTER the entity is constucted. 159 160 */ 160 161 void WorldEntity::post_spawn () … … 163 164 164 165 /** 165 166 167 168 169 166 \brief this handles incoming command messages 167 \param cmd: a pointer to the incoming Command structure 168 169 Put all code that handles Command messages here, this will mainly be called by the assigned CommandNode but can also be used 170 to send commands from one WorldEntity to another. 170 171 */ 171 172 void WorldEntity::command (Command* cmd) … … 174 175 175 176 /** 176 177 177 \brief this is called by the local Camera to determine the point it should look at on the WorldEntity 178 \param locbuf: a pointer to the buffer to fill with a location to look at 178 179 179 180 180 You may put any Location you want into locbuf, the Camera will determine via the corresponding Track how 181 to look at the location you return with this. 181 182 */ 182 183 void WorldEntity::get_lookat (Location* locbuf) … … 185 186 186 187 /** 187 188 189 190 188 \brief this method is called by the world if the WorldEntity leaves valid gamespace 189 190 For free entities this means it left the Track boundaries. With bound entities it means its Location adresses a 191 place that is not in the world anymore. In both cases you might have to take extreme measures (a.k.a. call destroy). 191 192 */ 192 193 void WorldEntity::left_world ()
Note: See TracChangeset
for help on using the changeset viewer.