/*! * @file collision_handle.h * @brief Definition of a collision handle: used for accesing per world entity collision events and reactions */ #ifndef _COLLISION_HANDLE_H #define _COLLISION_HANDLE_H #include "base_object.h" #include "cr_engine.h" #include class Collision; class WorldEntity; // struct CRType; //! A class for defining collision reactions and storing events class CollisionHandle : public BaseObject { public: CollisionHandle(WorldEntity* owner, CREngine::CRType type); virtual ~CollisionHandle(); void reset(); void addTarget(long classID); void registerCollision(Collision* collision); /** @returns true if regiestered some new collision events in this tick frame */ inline bool isCollided() const { return this->bCollided; } void handleCollisions(); private: void flushCollisions(); private: WorldEntity* owner; //!< the worldenity this reaction will be applied on CREngine::CRType type; //!< the reaction type bool bDispatched; //!< true if this handle has already been dispatched bool bStopOnFirstCollision; //!< true if the cd of this object should be terminated after one match bool bCollided; //!< true if the CollsionHandle has registered some new collisions std::vector collisionList; //!< a list full of collisions std::vector targetList; //!< a list of target classes for filtering }; #endif /* _COLLISION_HANDLE_H */