Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 7, 2006, 3:00:01 PM (18 years ago)
Author:
patrick
Message:

trunk: merged the cr branche to trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/collision_reaction/collision_handle.h

    r7927 r8190  
    1111
    1212#include <vector>
     13#include <list>
    1314
    1415
    1516class Collision;
    1617class WorldEntity;
     18class CollisionReaction;
    1719
    18 // struct CRType;
    1920
    2021
    2122//! A class for defining collision reactions and storing events
    22 class CollisionHandle : public BaseObject {
     23class CollisionHandle : public BaseObject
     24{
    2325
    24  public:
    25   CollisionHandle(WorldEntity* owner, CREngine::CRType type);
    26   virtual ~CollisionHandle();
     26  public:
     27    CollisionHandle(WorldEntity* owner, CREngine::CRType type);
     28    virtual ~CollisionHandle();
     29
     30    void reset();
     31
     32    void addTarget(long target);
     33    Collision* registerCollision(WorldEntity* entityA, WorldEntity* entityB);
     34    void registerSharedCollision(Collision* collision);
     35    void registerCollisionEvent(CollisionEvent* collisionEvent);
     36
     37    /** @returns true if regiestered some new collision events in this tick frame */
     38    inline bool isCollided() const { return this->bCollided; }
     39    /** @returns true if this collision handle has already been dispatched */
     40    inline bool isDispatched() const { return this->bDispatched; }
     41    /** @returns true if this handle should be pulled also if there are no collisions */
     42    inline bool isContinuousPoll() const { return this->bContinuousPoll; }
     43
     44    void handleCollisions();
    2745
    2846
    29   void addTarget();
    30 
    31   void registerCollision(Collision* collision);
    32 
    33   void handleCollisions();
     47  private:
     48    void flushCollisions();
     49    bool filterCollisionEvent(CollisionEvent* collisionEvent);
     50    bool filterCollision(Collision* collision);
    3451
    3552
    36  private:
    37    WorldEntity*                  owner;                   //!< the worldenity this reaction will be applied on
    38    CREngine::CRType              type;                    //!< the reaction type
    3953
    40    bool                          bDispatched;             //!< true if this handle has already been dispatched
    41    bool                          bStopOnFirstCollision;   //!< true if the cd of this object should be terminated after one match
     54  private:
     55    WorldEntity*                  owner;                   //!< the worldenity this reaction will be applied on
     56    CREngine::CRType              type;                    //!< the reaction type
    4257
    43    std::vector<Collision*>       collisionList;           //!< a list full of collisions
    44    std::vector<long>             targetList;              //!< a list of target classes for filtering
     58    bool                          bContinuousPoll;         //!< if this is true
     59    bool                          bDispatched;             //!< true if this handle has already been dispatched
     60    bool                          bStopOnFirstCollision;   //!< true if the cd of this object should be terminated after one match
     61    bool                          bCollided;               //!< true if the CollsionHandle has registered some new collisions
     62
     63    std::vector<Collision*>       collisionList;           //!< a list full of collisions
     64    std::vector<long>             targetList;              //!< a list of target classes for filtering
     65
     66    CollisionReaction*            collisionReaction;       //!< reference to the collision reaction object
    4567
    4668};
Note: See TracChangeset for help on using the changeset viewer.