Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 13, 2017, 5:25:09 PM (6 years ago)
Author:
kohlia
Message:

Figuring out when the different things are ready in orxonox

File:
1 edited

Legend:

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

    r11549 r11562  
    1717{
    1818
    19 class ScriptableController : public BaseObject, public Tickable
     19class ScriptableController
    2020{
    2121public:
    22     explicit ScriptableController(Context *context);
     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    };
    2333
    2434    int runScript(const std::string &file_path);
    2535
     36    void setPlayer(PlayerInfo *player);
    2637    void registerWorldEntity(int id, WorldEntity *obj);
    2738    void registerControllableEntity(int id, ControllableEntity *obj);
     
    3041    ControllableEntity *getControllableEntityByID(int id) const;
    3142
    32     void registerTimeout(std::function<void (void)> callback, double timeout);
     43    void addNearObjectHandler(int obj1, int obj2, double distance, std::function<void (int, int)> callback);
    3344
    34     virtual void tick(float dt) override;
     45    void objectMoved(WorldEntity *obj);
    3546
    3647private:
    3748    std::list<std::unique_ptr<ScriptableControllerAPI> > apis_;
    38     ControllableEntity *player_; // TODO
     49    PlayerInfo *player_;
    3950    std::map<int, WorldEntity*> worldEntities_;
    4051    std::map<int, ControllableEntity*> controllabelEntities_;
    41     std::list<std::pair<std::function<void (void)>, float> > timeouts;
     52
     53    std::map<WorldEntity*, std::list<std::unique_ptr<NearObjectHandler> > > nearObjectHandlers_;
    4254
    4355    void printLuaError(lua_State *lua);
Note: See TracChangeset for help on using the changeset viewer.