Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 25, 2009, 3:26:43 AM (16 years ago)
Author:
landauf
Message:
  • Added option to add a Controller to a ControllableEntity in the XML file
  • Added two new classes: WaypointController (follows waypoints) and WaypointPatrolController (follows waypoints and kills enemies within a given radius)
  • Radarpoints in TeamDeathmatch are now coloured
Location:
code/trunk/src/orxonox/objects/worldentities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/objects/worldentities/ControllableEntity.cc

    r3038 r3049  
    4040#include "objects/Scene.h"
    4141#include "objects/infos/PlayerInfo.h"
     42#include "objects/controllers/Controller.h"
    4243#include "objects/worldentities/Camera.h"
    4344#include "objects/worldentities/CameraPosition.h"
     
    6162        this->hud_ = 0;
    6263        this->camera_ = 0;
     64        this->xmlcontroller_ = 0;
    6365        this->bDestroyWhenPlayerLeft_ = false;
    6466        this->cameraPositionRootNode_ = this->node_->createChildSceneNode();
     
    9395                this->getPlayer()->stopControl();
    9496
     97            if (this->xmlcontroller_)
     98                delete this->xmlcontroller_;
     99
    95100            if (this->hud_)
    96101                delete this->hud_;
     
    115120
    116121        XMLPortObject(ControllableEntity, CameraPosition, "camerapositions", addCameraPosition, getCameraPosition, xmlelement, mode);
     122        XMLPortObject(ControllableEntity, Controller,     "controller",      setXMLController,  getXMLController,  xmlelement, mode);
    117123    }
    118124
     
    304310    }
    305311
     312    void ControllableEntity::setXMLController(Controller* controller)
     313    {
     314        if (!this->xmlcontroller_)
     315        {
     316            this->xmlcontroller_ = controller;
     317            this->bHasLocalController_ = true;
     318            this->xmlcontroller_->setControllableEntity(this);
     319        }
     320        else
     321            COUT(2) << "Warning: ControllableEntity \"" << this->getName() << "\" already has a Controller." << std::endl;
     322    }
     323
    306324    void ControllableEntity::parentChanged()
    307325    {
  • code/trunk/src/orxonox/objects/worldentities/ControllableEntity.h

    r3038 r3049  
    130130                { return this->mouseLookSpeed_; }
    131131
     132            inline Controller* getXMLController() const
     133                { return this->xmlcontroller_; }
     134
    132135        protected:
    133136            virtual void setPlayer(PlayerInfo* player); // don't call this directly, use friend class PlayerInfo instead
     
    142145
    143146        private:
     147            void setXMLController(Controller* controller);
     148
    144149            void overwrite();
    145150            void processOverwrite();
     
    188193            std::list<CameraPosition*> cameraPositions_;
    189194            std::string cameraPositionTemplate_;
     195            Controller* xmlcontroller_;
    190196    };
    191197}
Note: See TracChangeset for help on using the changeset viewer.