- Timestamp:
- May 11, 2017, 3:18:27 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBGumba.cc
r11412 r11416 21 21 * 22 22 * Author: 23 * Fabien Vultier23 * Julien Kindle 24 24 * Co-authors: 25 * ...25 * 26 26 * 27 27 */ … … 76 76 bool SOBGumba::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) { 77 77 78 78 //Every object with mass -1 does not change the direction of the Gumba. For example the ground floor! The other objects switch the direction of the gumba. 79 79 if (changeAllowed_ && otherObject->getMass() != -1) { 80 80 goesRight_ = !goesRight_; … … 91 91 } 92 92 93 void SOBGumba::touchFigure()94 {95 93 96 }97 94 98 95 void SOBGumba::tick(float dt) … … 102 99 if (!changeAllowed_) { 103 100 changedOn_+= dt; 104 if (changedOn_> 200) { 101 // After a collision, we don't listen for collisions for 200ms - that's because one wall can cause several collisions! 102 if (changedOn_> 0.200) { 105 103 changeAllowed_ = true; 106 104 changedOn_ = 0.0; … … 119 117 setVelocity(velocity); 120 118 121 122 123 119 lastPos_ = getPosition(); 124 120 } … … 126 122 127 123 } 128 /*129 * ORXONOX - the hottest 3D action shooter ever to exist130 * > www.orxonox.net <131 *132 *133 * License notice:134 *135 * This program is free software; you can redistribute it and/or136 * modify it under the terms of the GNU General Public License137 * as published by the Free Software Foundation; either version 2138 * of the License, or (at your option) any later version.139 *140 * This program is distributed in the hope that it will be useful,141 * but WITHOUT ANY WARRANTY; without even the implied warranty of142 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the143 * GNU General Public License for more details.144 *145 * You should have received a copy of the GNU General Public License146 * along with this program; if not, write to the Free Software147 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.148 *149 * Author:150 * Fabien Vultier151 * Co-authors:152 * ...153 *154 */155 156 /**157 @file SOBGumba.h158 @brief Declaration of the SOBGumba class.159 @ingroup SOB160 */161 162 #ifndef _SOBGumba_H__163 #define _SOBGumba_H__164 165 #include "superorxobros/SOBPrereqs.h"166 #include "worldentities/MovableEntity.h"167 168 169 namespace orxonox170 {171 class _SOBExport SOBGumba : public MovableEntity172 {173 public:174 SOBGumba(Context* context);175 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;176 virtual void setFigure(SOBFigure* newFigure);177 virtual void touchFigure();178 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;179 virtual void tick(float dt) override;180 181 182 bool attachedToFigure_;183 184 void setSpeed(const float speed)185 { this->speed_ = speed; }186 float getSpeed() const187 { return speed_; }188 189 bool hasCollided_;190 protected:191 float gravityAcceleration_;192 float speed_;193 WeakPtr<SOBFigure> figure_;194 bool goesRight_;195 Vector3 lastPos_;196 bool changeAllowed_;197 float changedOn_;198 199 };200 }201 202 #endif /* _SOBGumba_H__ */
Note: See TracChangeset
for help on using the changeset viewer.