Changeset 4881 in orxonox.OLD
- Timestamp:
- Jul 17, 2005, 4:46:19 AM (19 years ago)
- Location:
- orxonox/branches/weaponSystem/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/weaponSystem/src/defs/debug.h
r4852 r4881 69 69 #define DEBUG_MODULE_LIGHT 0 70 70 #define DEBUG_MODULE_PLAYER 1 71 #define DEBUG_MODULE_WEAPON 071 #define DEBUG_MODULE_WEAPON 4 72 72 #define DEBUG_MODULE_MATH 0 73 73 #define DEBUG_MODULE_FONT 1 -
orxonox/branches/weaponSystem/src/world_entities/weapons/test_gun.cc
r4880 r4881 98 98 // ObjectManager::getInstance()->cache(CL_TEST_BULLET, 100, p); 99 99 //ObjectManager::getInstance()->debug(); 100 101 this->setStateDuration(WS_SHOOTING, 2); 100 102 } 101 103 … … 144 146 void TestGun::fire() 145 147 { 146 if( !this->stateTimeElapsed()) 147 { 148 this->weaponIdle(); 149 return; 150 } 151 152 Projectile* pj = new TestBullet(this);//dynamic_cast<Projectile*>(ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET & CL_MASK_LOWLEVEL_CLASS)); 153 weaponSource->play(); 148 Projectile* pj = new TestBullet(this);//dynamic_cast<Projectile*>(ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET & CL_MASK_LOWLEVEL_CLASS)); 149 // weaponSource->play(); 154 150 155 151 pj->setAbsCoor(this->getAbsCoor() + this->projectileOffset); -
orxonox/branches/weaponSystem/src/world_entities/weapons/weapon.cc
r4880 r4881 16 16 2005-07-15: Benjamin Grauer: restructurating the entire Class 17 17 */ 18 19 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON 18 20 19 21 #include "weapon.h" … … 74 76 this->maxCharge = 0.0; 75 77 76 this->active = false;78 this->active = true; 77 79 this->projectile = NULL; 78 80 } … … 104 106 void Weapon::requestAction(WeaponAction action) 105 107 { 108 printf("next action will be %d\n", action); 106 109 this->requestedAction = action; 107 110 } 108 111 109 bool Weapon::execute(WeaponAction action) 110 { 111 this->stateDuration = this->times[action] + this->stateDuration; 112 113 switch (action) 112 bool Weapon::execute() 113 { 114 this->stateDuration = this->times[this->requestedAction] + this->stateDuration; 115 116 PRINT(3)("executing action %d\n", this->requestedAction); 117 118 switch (this->requestedAction) 114 119 { 115 120 case WA_SHOOT: … … 129 134 break; 130 135 } 136 this->requestedAction = WA_NONE; 131 137 } 132 138 … … 146 152 void Weapon::fire() 147 153 { 148 149 154 } 150 155 … … 174 179 void Weapon::tick(float dt) 175 180 { 181 // setting up the timing properties 182 this->stateDuration -= dt; 183 176 184 if (this->isActive()) 177 185 { 178 this->stateDuration -= dt; 179 180 if (this->stateDuration < 0.0) 181 this->execute(this->requestedAction); 186 if (this->stateDuration <= 0.0 && this->requestedAction != WA_NONE) 187 this->execute(); 182 188 } 183 189 else -
orxonox/branches/weaponSystem/src/world_entities/weapons/weapon.h
r4880 r4881 113 113 114 114 115 bool execute( WeaponAction action);115 bool execute(); 116 116 virtual void activate(); 117 117 virtual void deactivate();
Note: See TracChangeset
for help on using the changeset viewer.