Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 20, 2017, 4:48:03 PM (7 years ago)
Author:
kohlia
Message:

Near object, near point and at area work!

Location:
code/branches/ScriptableController_HS17/src/orxonox/worldentities
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ScriptableController_HS17/src/orxonox/worldentities/ControllableEntity.cc

    r11518 r11583  
    3939
    4040#include "Scene.h"
     41#include "Level.h"
    4142#include "infos/PlayerInfo.h"
    4243#include "controllers/NewHumanController.h"
     
    6869        this->camera_ = nullptr;
    6970        this->xmlcontroller_ = nullptr;
    70         //this->controller_ = nullptr;
    7171        this->reverseCamera_ = nullptr;
    7272        this->bDestroyWhenPlayerLeft_ = false;
     
    127127        XMLPortObject(ControllableEntity, CameraPosition, "camerapositions", addCameraPosition, getCameraPosition, xmlelement, mode);
    128128        XMLPortObject(ControllableEntity, Controller,     "controller",      setXMLController,  getXMLController,  xmlelement, mode);
     129
     130        if(!this->id_.empty() && this->getLevel() != nullptr)
     131            this->getLevel()->getScriptableController()->registerControllableEntity(this->id_, this);
    129132    }
    130133
     
    338341    }
    339342
    340     void ControllableEntity::registerToScriptableController(ScriptableController *controller)
    341     {
    342         controller->registerControllableEntity(this->id_, this);
    343     }
    344 
    345343    void ControllableEntity::setPlayer(PlayerInfo* player)
    346344    {
  • code/branches/ScriptableController_HS17/src/orxonox/worldentities/ControllableEntity.h

    r11518 r11583  
    176176                { return this->team_; }
    177177
    178             virtual void registerToScriptableController(ScriptableController *controller) override;
    179178
    180179        protected:
  • code/branches/ScriptableController_HS17/src/orxonox/worldentities/MobileEntity.cc

    r11562 r11583  
    115115
    116116        this->node_->setPosition(position);
    117         this->getLevel()->getScriptableController()->objectMoved(this);
    118117    }
    119118
  • code/branches/ScriptableController_HS17/src/orxonox/worldentities/WorldEntity.cc

    r11562 r11583  
    4444#include "core/XMLPort.h"
    4545#include "Scene.h"
     46#include "Level.h"
    4647#include "collisionshapes/WorldEntityCollisionShape.h"
    4748#include "scriptablecontroller/scriptable_controller.h"
     
    185186        XMLPortObject(WorldEntity, CollisionShape, "collisionShapes", attachCollisionShape, getAttachedCollisionShape, xmlelement, mode);
    186187
    187         orxout(user_info) << "ID loaded" << std::endl;
     188        if(!this->id_.empty() && this->getLevel() != nullptr)
     189            this->getLevel()->getScriptableController()->registerWorldEntity(this->id_, this);
    188190    }
    189191
     
    280282    }
    281283
    282     void WorldEntity::registerToScriptableController(ScriptableController *controller)
    283     {
    284         orxout(user_info) << "Registering object to SC (" << this->id_ << ")" << std::endl;
    285         controller->registerWorldEntity(this->id_, this);
    286     }
    287 
    288284    /**
    289285    @brief
  • code/branches/ScriptableController_HS17/src/orxonox/worldentities/WorldEntity.h

    r11562 r11583  
    111111            virtual void changedVisibility(void) override;
    112112
    113             inline int getID(void)
     113            inline std::string getID(void)
    114114                { return this->id_; }
    115115
    116             inline void setID(int id)
     116            inline void setID(std::string id)
    117117                { this->id_ = id; }
    118 
    119             virtual void registerToScriptableController(ScriptableController *controller) override;
    120118
    121119            virtual void setPosition(const Vector3& position) = 0;
     
    450448
    451449            btRigidBody*  physicalBody_; //!< Bullet rigid body. Everything physical is applied to this instance.
    452             int           id_;           //!< Used by the ScriptableController to identify objects
     450            std::string   id_;           //!< Used by the ScriptableController to identify objects
    453451
    454452        private:
Note: See TracChangeset for help on using the changeset viewer.