Last change
on this file since 7958 was
7947,
checked in by patrick, 18 years ago
|
cr: integraged the collision reaction into the main loop
|
File size:
1.6 KB
|
Line | |
---|
1 | /*! |
---|
2 | * @file collision_handle.h |
---|
3 | * @brief Definition of a collision handle: used for accesing per world entity collision events and reactions |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _COLLISION_HANDLE_H |
---|
7 | #define _COLLISION_HANDLE_H |
---|
8 | |
---|
9 | #include "base_object.h" |
---|
10 | #include "cr_engine.h" |
---|
11 | |
---|
12 | #include <vector> |
---|
13 | |
---|
14 | |
---|
15 | class Collision; |
---|
16 | class WorldEntity; |
---|
17 | |
---|
18 | // struct CRType; |
---|
19 | |
---|
20 | |
---|
21 | //! A class for defining collision reactions and storing events |
---|
22 | class CollisionHandle : public BaseObject |
---|
23 | { |
---|
24 | |
---|
25 | public: |
---|
26 | CollisionHandle(WorldEntity* owner, CREngine::CRType type); |
---|
27 | virtual ~CollisionHandle(); |
---|
28 | |
---|
29 | void reset(); |
---|
30 | |
---|
31 | void addTarget(long classID); |
---|
32 | void registerCollision(Collision* collision); |
---|
33 | /** @returns true if regiestered some new collision events in this tick frame */ |
---|
34 | inline bool isCollided() const { return this->bCollided; } |
---|
35 | |
---|
36 | void handleCollisions(); |
---|
37 | |
---|
38 | |
---|
39 | private: |
---|
40 | void flushCollisions(); |
---|
41 | |
---|
42 | |
---|
43 | private: |
---|
44 | WorldEntity* owner; //!< the worldenity this reaction will be applied on |
---|
45 | CREngine::CRType type; //!< the reaction type |
---|
46 | |
---|
47 | bool bDispatched; //!< true if this handle has already been dispatched |
---|
48 | bool bStopOnFirstCollision; //!< true if the cd of this object should be terminated after one match |
---|
49 | bool bCollided; //!< true if the CollsionHandle has registered some new collisions |
---|
50 | |
---|
51 | std::vector<Collision*> collisionList; //!< a list full of collisions |
---|
52 | std::vector<long> targetList; //!< a list of target classes for filtering |
---|
53 | |
---|
54 | }; |
---|
55 | |
---|
56 | #endif /* _COLLISION_HANDLE_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.