Changeset 8185
- Timestamp:
- Apr 4, 2011, 3:12:49 PM (14 years ago)
- Location:
- code/branches/dockingsystem
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/dockingsystem/data/levels/docking.oxw
r8151 r8185 32 32 33 33 34 <!-- stolen from underAttack.oxw --> 34 <Dock> 35 <effects> 36 <DockToShip /> 37 </effects> 38 <events> 39 <execute> 40 <EventListener event="dockMe" /> 41 </execute> 42 </events> 43 <attached> 44 <DistanceTrigger position="0,0,0" distance="20" target="ControllableEntity" name="dockMe" /> 45 <Billboard material="Examples/Flare" colour="1.0, 0, 0" /> 46 </attached> 47 </Dock> 35 48 49 50 <!-- 36 51 <Destroyer 37 52 position = "100,150,0" … … 46 61 47 62 <attached> 48 49 <Dock>50 <effects>51 <DockToShip />52 </effects>53 <events>54 <execute>55 <EventListener event="dockMe" />56 </execute>57 </events>58 <attached>59 <DistanceTrigger position="0,0,0" distance=2 target="ControllableEntity" name="dockMe" />60 </attached>61 </Dock>62 63 63 <TeamSpawnPoint team=1 position="150,0,7" direction="-1,0,0" roll=90 yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /> 64 64 <TeamSpawnPoint team=1 position="0,0,7" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /> … … 147 147 </collisionShapes> 148 148 </Destroyer> 149 149 //--> 150 150 151 151 </Scene> -
code/branches/dockingsystem/src/modules/docking/Dock.cc
r8151 r8185 37 37 namespace orxonox 38 38 { 39 40 CreateFactory(Dock); 39 CreateFactory(Dock); 41 40 42 41 Dock::Dock(BaseObject* creator) : StaticEntity(creator) 43 42 { 44 43 RegisterObject(Dock); 45 44 COUT(0) << "Registering dock..." << std::endl; 46 45 } 47 46 … … 70 69 71 70 bool Dock::execute(bool bTriggered, BaseObject* trigger) 72 { 73 COUT(0) << "Dock executed (bTriggered = " << (bTriggered? "true":"false") << ").." << std::endl; 74 return true; 75 } 71 { 72 COUT(0) << "Dock executed (bTriggered = " << (bTriggered? "true":"false") << ").." << std::endl; 73 74 //TODO: Handle MultiDistanceTrigger 75 76 //TODO: This way too oversimplified 77 if(bTriggered) { 78 DockingEffect::invokeEffect(docking::DOCKING, NULL, effects_); 79 DockingEffect::invokeEffect(docking::ATTACH, NULL, effects_); 80 } else { 81 DockingEffect::invokeEffect(docking::RELEASE, NULL, effects_); 82 } 76 83 77 84 78 bool Dock::addEffect(DockingEffect* effect) { 79 assert(effect); 80 effects_.push_back(effect); 81 return true; 82 } 83 84 const DockingEffect* Dock::getEffect(unsigned int index) const { 85 int i = index; 85 return true; 86 } 87 88 89 bool Dock::addEffect(DockingEffect* effect) { 90 assert(effect); 91 effects_.push_back(effect); 92 return true; 93 } 94 95 const DockingEffect* Dock::getEffect(unsigned int index) const { 96 int i = index; 86 97 for (std::list<DockingEffect*>::const_iterator effect = this->effects_.begin(); effect != this->effects_.end(); ++effect) 87 98 { … … 92 103 } 93 104 return NULL; 94 } 95 105 } 96 106 } -
code/branches/dockingsystem/src/modules/docking/Dock.h
r8151 r8185 47 47 48 48 49 50 51 49 class _DockingExport Dock : public StaticEntity { 50 public: 51 Dock(BaseObject* creator); 52 52 virtual ~Dock(); 53 53 … … 57 57 bool execute(bool bTriggered, BaseObject* trigger); 58 58 59 private:60 std::list<DockingEffect*> effects_; //!< The list of DockingEffects to be executed when a player docks.61 62 59 bool addEffect(DockingEffect* effect); //!< Add a DockingEffect to the Dock. 63 60 const DockingEffect* getEffect(unsigned int index) const; //!< Get the DockingEffect at a given index. 64 }; 61 62 private: 63 std::list<DockingEffect*> effects_; //!< The list of DockingEffects to be executed when a player docks. 64 }; 65 65 66 66 -
code/branches/dockingsystem/src/modules/docking/DockToShip.cc
r8151 r8185 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * > www.orxonox.net < 4 * 5 * 6 * License notice: 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * 22 * Author: 23 * Damian 'Mozork' Frick 24 * Co-authors: 25 * ... 26 * 27 */ 28 29 /** 30 @file DockToShip.cc 31 @brief Implementation of the DockToShip class. 32 */ 33 34 #include "DockingEffect.h" 35 #include "DockToShip.h" 36 #include "core/CoreIncludes.h" 37 38 namespace orxonox 39 { 40 CreateFactory(DockToShip); 41 42 DockToShip::DockToShip(BaseObject* creator) : DockingEffect(creator) 43 { 44 RegisterObject(DockToShip); 45 COUT(0) << "DockToShip instance created.." << endl; 46 } 47 48 DockToShip::~DockToShip() 49 { 50 51 } 52 53 bool DockToShip::docking(PlayerInfo* player) 54 { 55 COUT(0) << "DockToShip::docking" << endl; 56 return true; 57 } 58 59 bool DockToShip::attach(PlayerInfo* player) 60 { 61 COUT(0) << "DockToShip::attach" << endl; 62 return true; 63 } 64 65 bool DockToShip::release(PlayerInfo* player) 66 { 67 COUT(0) << "DockToShip::release" << endl; 68 return true; 69 } 70 } -
code/branches/dockingsystem/src/modules/docking/DockToShip.h
r8151 r8185 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * > www.orxonox.net < 4 * 5 * 6 * License notice: 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * 22 * Author: 23 * Sven Stucki 24 * Co-authors: 25 * ... 26 * 27 */ 28 29 /** 30 @file DockToShip.h 31 @brief DockingEffect which transfers control from spaceship to docked ship ASDF 32 @ingroup Docking 33 */ 34 35 #ifndef _DockToShip_H__ 36 #define _DockToShip_H__ 37 38 #include "DockingPrereqs.h" 39 #include "DockToShip.h" 40 41 42 namespace orxonox 43 { 44 45 /** 46 @brief 47 Allows players to dock onto a ship 48 49 @author 50 Sven Stucki 51 52 @ingroup Docking 53 */ 54 class _DockingExport DockToShip : public DockingEffect 55 { 56 public: 57 DockToShip(BaseObject* creator); 58 virtual ~DockToShip(); 59 60 virtual bool docking(PlayerInfo* player); //!< Called when docking starts 61 virtual bool attach(PlayerInfo* player); //!< Called after docking animation 62 virtual bool release(PlayerInfo* player); //!< Called when player wants undock 63 }; 64 65 } 66 67 #endif /* _DockToShip_H__ */ -
code/branches/dockingsystem/src/modules/docking/DockingEffect.cc
r8153 r8185 47 47 } 48 48 49 bool DockingEffect::invokeEffect s(PlayerInfo* player, std::list<DockingEffect*> & effects)49 bool DockingEffect::invokeEffect(docking::event event, PlayerInfo* player, std::list<DockingEffect*> & effects) 50 50 { 51 51 bool check = true; … … 53 53 COUT(4) << "Invoking DockingEffects on player: " << player << " ." << std::endl; 54 54 55 for (std::list<DockingEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++) 56 check = check ;// && (*effect)->invoke(player); TODO 55 for (std::list<DockingEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++) { 56 switch(event) { 57 case docking::DOCKING: 58 check &= (*effect)->docking(player); 59 break; 60 case docking::ATTACH: 61 check &= (*effect)->attach(player); 62 break; 63 case docking::RELEASE: 64 check &= (*effect)->release(player); 65 break; 66 default: 67 assert(0); 68 } 69 } 57 70 58 71 return check; -
code/branches/dockingsystem/src/modules/docking/DockingEffect.h
r8151 r8185 43 43 namespace orxonox 44 44 { 45 namespace docking { 46 enum event { 47 DOCKING, 48 ATTACH, 49 RELEASE 50 }; 51 } 45 52 46 53 /** … … 60 67 61 68 virtual bool docking(PlayerInfo* player) = 0; //!< Called when docking starts 62 63 69 virtual bool attach(PlayerInfo* player) = 0; //!< Called after docking animation 70 virtual bool release(PlayerInfo* player) = 0; //!< Called when player wants undock 64 71 65 static bool invokeEffect s(PlayerInfo* player, std::list<DockingEffect*> & effects); //!< Invokes all DockingEffects in the list.72 static bool invokeEffect(docking::event event, PlayerInfo* player, std::list<DockingEffect*> & effects); //!< Invokes the event specific method of all DockingEffects in the list 66 73 }; 67 74 -
code/branches/dockingsystem/src/modules/docking/DockingPrereqs.h
r8151 r8185 66 66 { 67 67 class Dock; 68 class DockingEffect; 68 class DockingEffect; 69 class DockToShip; 69 70 } 70 71 -
code/branches/dockingsystem/src/orxonox/infos/PlayerInfo.cc
r7163 r8185 224 224 225 225 this->controllableEntity_->setController(0); 226 226 227 227 this->controllableEntity_ = this->oldControllableEntity_; 228 228 this->controllableEntityID_ = this->controllableEntity_->getObjectID();
Note: See TracChangeset
for help on using the changeset viewer.