Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 9, 2008, 2:16:49 AM (16 years ago)
Author:
landauf
Message:
  • Added Bot (the artifical counterpart to HumanPlayer)
  • Added ArtificialController, the baseclass of all non-human-controllers
  • Added AIController, a simple reimplementation of the old AISpaceShip (but of course without the SpaceShip, just the AI)
  • Added currently empty class ScriptController
  • Some tweaks in PlayerInfo, ControllableEntity and Controller
  • Made Spacetator speed configurable

I don't know where, but there's still an issue in the new code, maybe even caused by the previous commit. The Server seems to crash when a Client disconnects, but only if the Server runs within the debugger.

Location:
code/branches/objecthierarchy2/src/orxonox/objects
Files:
8 added
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy2/src/orxonox/objects/controllers/CMakeLists.txt

    r2131 r2362  
    22  Controller.cc
    33  HumanController.cc
     4  ArtificialController.cc
     5  AIController.cc
     6  ScriptController.cc
    47)
    58
  • code/branches/objecthierarchy2/src/orxonox/objects/controllers/Controller.h

    r2087 r2362  
    4747                { return this->player_; }
    4848
    49             virtual inline void setControllableEntity(ControllableEntity* entity)
    50                 { this->controllableEntity_ = entity; }
    51             virtual inline ControllableEntity* getControllableEntity() const
     49            inline void setControllableEntity(ControllableEntity* entity)
     50            {
     51                if (entity != this->controllableEntity_)
     52                {
     53                    this->controllableEntity_ = entity;
     54                    this->changedControllableEntity();
     55                }
     56            }
     57            inline ControllableEntity* getControllableEntity() const
    5258                { return this->controllableEntity_; }
     59            virtual void changedControllableEntity() {}
    5360
    5461        protected:
  • code/branches/objecthierarchy2/src/orxonox/objects/infos/CMakeLists.txt

    r2171 r2362  
    11SET( SRC_FILES
     2  Bot.cc
    23  Info.cc
    34  PlayerInfo.cc
  • code/branches/objecthierarchy2/src/orxonox/objects/infos/HumanPlayer.h

    r2171 r2362  
    3333
    3434#include "PlayerInfo.h"
    35 #include "core/Identifier.h"
    36 #include "objects/controllers/Controller.h"
    3735
    3836namespace orxonox
  • code/branches/objecthierarchy2/src/orxonox/objects/infos/PlayerInfo.cc

    r2171 r2362  
    4646        this->bLocalPlayer_ = false;
    4747        this->bReadyToSpawn_ = false;
     48        this->bSetUnreadyAfterSpawn_ = true;
    4849        this->controller_ = 0;
    4950        this->controllableEntity_ = 0;
     
    122123            this->controllableEntityID_ = entity->getObjectID();
    123124            entity->setPlayer(this);
    124             this->bReadyToSpawn_ = false;
     125            this->bReadyToSpawn_ &= (!this->bSetUnreadyAfterSpawn_);
    125126        }
    126127        else
  • code/branches/objecthierarchy2/src/orxonox/objects/infos/PlayerInfo.h

    r2171 r2362  
    7373        protected:
    7474            void createController();
    75             void networkcallback_changedcontrollableentityID();
    7675
    7776            bool bHumanPlayer_;
    7877            bool bLocalPlayer_;
     78            bool bSetUnreadyAfterSpawn_;
     79            SubclassIdentifier<Controller> defaultController_;
     80            unsigned int clientID_;
     81
     82        private:
     83            void networkcallback_changedcontrollableentityID();
     84
    7985            bool bReadyToSpawn_;
    80             SubclassIdentifier<Controller> defaultController_;
    8186            Controller* controller_;
    8287            ControllableEntity* controllableEntity_;
    8388            unsigned int controllableEntityID_;
    84             unsigned int clientID_;
    8589    };
    8690}
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/ControllableEntity.h

    r2254 r2362  
    6464            virtual void rotatePitch(const Vector2& value) {}
    6565            virtual void rotateRoll(const Vector2& value) {}
     66
     67            inline void moveFrontBack(float value)
     68                { this->moveFrontBack(Vector2(value, 0)); }
     69            inline void moveRightLeft(float value)
     70                { this->moveRightLeft(Vector2(value, 0)); }
     71            inline void moveUpDown(float value)
     72                { this->moveUpDown(Vector2(value, 0)); }
     73
     74            inline void rotateYaw(float value)
     75                { this->rotateYaw(Vector2(value, 0)); }
     76            inline void rotatePitch(float value)
     77                { this->rotatePitch(Vector2(value, 0)); }
     78            inline void rotateRoll(float value)
     79                { this->rotateRoll(Vector2(value, 0)); }
    6680
    6781            virtual void fire() {}
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/pawns/Spectator.cc

    r2254 r2362  
    3131
    3232#include "core/CoreIncludes.h"
     33#include "core/ConfigValueIncludes.h"
    3334#include "core/Core.h"
    3435#include "objects/worldentities/Model.h"
     
    4950        RegisterObject(Spectator);
    5051
    51         this->speed_ = 100;
     52        this->speed_ = 200;
    5253        this->rotationSpeed_ = 3;
    5354
     
    6869        this->bGreeting_ = false;
    6970
     71        this->setConfigValues();
    7072        this->registerVariables();
    7173    }
     
    8486    }
    8587
     88    void Spectator::setConfigValues()
     89    {
     90        SetConfigValue(speed_, 200.0f);
     91        SetConfigValue(rotationSpeed_, 3.0f);
     92    }
     93
    8694    void Spectator::registerVariables()
    8795    {
     
    137145    {
    138146        ControllableEntity::startLocalHumanControl();
    139 //        if (this->hasLocalController())
    140 //            this->testmesh_->setVisible(false);
    141147    }
    142148
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/pawns/Spectator.h

    r2254 r2362  
    4242            virtual ~Spectator();
    4343
     44            void setConfigValues();
    4445            void registerVariables();
    4546            virtual void tick(float dt);
Note: See TracChangeset for help on using the changeset viewer.