Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Near object, near point and at area work!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ScriptableController_HS17/src/orxonox/scriptablecontroller/scriptable_controller.h

    r11562 r11583  
    1111#include "worldentities/WorldEntity.h"
    1212#include "worldentities/ControllableEntity.h"
     13#include "tools/Timer.h"
    1314
    1415struct lua_State;
     
    2021{
    2122public:
    22     struct NearObjectHandler
    23     {
    24         NearObjectHandler(WorldEntity *otherObject, double distance, std::function<void (int, int)> callback)
    25             : otherObject_(otherObject), distance_(distance), callback_(callback)
    26         {}
    27 
    28         WorldEntity *otherObject_;
    29         double distance_;
    30         std::function<void (int, int)> callback_;
    31         std::list<std::unique_ptr<NearObjectHandler> >::iterator otherHandler_;
    32     };
    33 
    3423    int runScript(const std::string &file_path);
    3524
    3625    void setPlayer(PlayerInfo *player);
    37     void registerWorldEntity(int id, WorldEntity *obj);
    38     void registerControllableEntity(int id, ControllableEntity *obj);
     26    void registerWorldEntity(std::string id, WorldEntity *entity);
     27    void registerControllableEntity(std::string id, ControllableEntity *entity);
    3928
    40     WorldEntity *getWorldEntityByID(int id) const;
    41     ControllableEntity *getControllableEntityByID(int id) const;
    42 
    43     void addNearObjectHandler(int obj1, int obj2, double distance, std::function<void (int, int)> callback);
    44 
    45     void objectMoved(WorldEntity *obj);
     29    WorldEntity *getWorldEntityByID(std::string id) const;
     30    ControllableEntity *getControllableEntityByID(std::string id) const;
    4631
    4732private:
    4833    std::list<std::unique_ptr<ScriptableControllerAPI> > apis_;
    4934    PlayerInfo *player_;
    50     std::map<int, WorldEntity*> worldEntities_;
    51     std::map<int, ControllableEntity*> controllabelEntities_;
    52 
    53     std::map<WorldEntity*, std::list<std::unique_ptr<NearObjectHandler> > > nearObjectHandlers_;
     35    std::map<std::string, WorldEntity*> worldEntities_;
     36    std::map<std::string, ControllableEntity*> controllabelEntities_;
    5437
    5538    void printLuaError(lua_State *lua);
Note: See TracChangeset for help on using the changeset viewer.