Panda3D

collisionHandlerHighestEvent.h

00001 // Filename: collisionHandlerEvent.h
00002 // Created by:  drose (16Mar02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef COLLISIONHANDLERHIGHESTEVENT_H
00016 #define COLLISIONHANDLERHIGHESTEVENT_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "collisionHandlerEvent.h"
00021 #include "collisionNode.h"
00022 #include "collisionEntry.h"
00023 
00024 #include "vector_string.h"
00025 #include "pointerTo.h"
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //       Class : CollisionHandlerEvent
00029 // Description : A specialized kind of CollisionHandler that throws an
00030 //               event for each collision detected.  The event thrown
00031 //               may be based on the name of the moving object or the
00032 //               struck object, or both.  The first parameter of the
00033 //               event will be a pointer to the CollisionEntry that
00034 //               triggered it.
00035 ////////////////////////////////////////////////////////////////////
00036 class EXPCL_PANDA_COLLIDE CollisionHandlerHighestEvent : public CollisionHandlerEvent {
00037 PUBLISHED:
00038   CollisionHandlerHighestEvent();
00039 
00040 public:
00041   virtual void begin_group();  
00042   virtual void add_entry(CollisionEntry *entry);
00043   virtual bool end_group();  
00044 private:
00045   double _collider_distance;
00046   PT(CollisionEntry) _closest_collider;
00047   
00048 
00049 public:
00050   static TypeHandle get_class_type() {
00051     return _type_handle;
00052   }
00053   static void init_type() {
00054     CollisionHandler::init_type();
00055     register_type(_type_handle, "CollisionHandlerHighestEvent",
00056                   CollisionHandlerEvent::get_class_type());
00057   }
00058   virtual TypeHandle get_type() const {
00059     return get_class_type();
00060   }
00061   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00062 
00063 private:
00064   static TypeHandle _type_handle;
00065 };
00066 
00067 #endif
00068 
00069 
00070 
 All Classes Functions Variables Enumerations