triggerComponent.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //-----------------------------------------------------------------------------
  2. // Torque Game Engine
  3. // Copyright (C) GarageGames.com, Inc.
  4. //-----------------------------------------------------------------------------
  5. #ifndef _TRIGGER_COMPONENT_H_
  6. #define _TRIGGER_COMPONENT_H_
  7. #ifndef _COMPONENT_H_
  8. #include "T3D/components/component.h"
  9. #endif
  10. #ifndef _ENTITY_H_
  11. #include "T3D/entity.h"
  12. #endif
  13. #ifndef _COLLISION_INTERFACES_H_
  14. #include "T3D/components/collision/collisionInterfaces.h"
  15. #endif
  16. //////////////////////////////////////////////////////////////////////////
  17. ///
  18. ///
  19. //////////////////////////////////////////////////////////////////////////
  20. class TriggerComponent : public Component
  21. {
  22. typedef Component Parent;
  23. protected:
  24. Vector<SceneObject*> mObjectList;
  25. bool mVisible;
  26. String mEnterCommand;
  27. String mOnExitCommand;
  28. String mOnUpdateInViewCmd;
  29. public:
  30. TriggerComponent();
  31. virtual ~TriggerComponent();
  32. DECLARE_CONOBJECT(TriggerComponent);
  33. virtual bool onAdd();
  34. virtual void onRemove();
  35. static void initPersistFields();
  36. virtual void onComponentAdd();
  37. virtual void onComponentRemove();
  38. virtual void componentAddedToOwner(Component *comp);
  39. virtual void componentRemovedFromOwner(Component *comp);
  40. virtual U32 packUpdate(NetConnection *con, U32 mask, BitStream *stream);
  41. virtual void unpackUpdate(NetConnection *con, BitStream *stream);
  42. void potentialEnterObject(SceneObject *collider);
  43. bool testObject(SceneObject* enter);
  44. virtual void processTick();
  45. GameConnection* getConnection(S32 connectionID);
  46. void addClient(S32 clientID);
  47. void removeClient(S32 clientID);
  48. void visualizeFrustums(F32 renderTimeMS);
  49. DECLARE_CALLBACK(void, onEnterViewCmd, (Entity* cameraEnt, bool firstTimeSeeing));
  50. DECLARE_CALLBACK(void, onExitViewCmd, (Entity* cameraEnt));
  51. DECLARE_CALLBACK(void, onUpdateInViewCmd, (Entity* cameraEnt));
  52. DECLARE_CALLBACK(void, onUpdateOutOfViewCmd, (Entity* cameraEnt));
  53. };
  54. #endif // _EXAMPLEBEHAVIOR_H_