Changeset 4881 in orxonox.OLD for orxonox/branches/weaponSystem/src/world_entities/weapons/weapon.cc
- Timestamp:
- Jul 17, 2005, 4:46:19 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.