00001
00002 #ifndef INCLUDED_VisualTargetTrans_h_
00003 #define INCLUDED_VisualTargetTrans_h_
00004
00005 #include "Events/EventRouter.h"
00006 #include "Events/VisionObjectEvent.h"
00007 #include "Shared/debuget.h"
00008 #include "Shared/WorldState.h"
00009
00010
00011 class VisualTargetTrans : public Transition {
00012 public:
00013
00014 VisualTargetTrans(StateNode* destination, unsigned int source_id)
00015 : Transition("VisualTargetTrans",destination), sid(source_id), count(0) {}
00016
00017
00018 VisualTargetTrans(const std::string& name, StateNode* destination, unsigned int source_id)
00019 : Transition("VisualTargetTrans",name,destination), sid(source_id), count(0) {}
00020
00021
00022 virtual void DoStart() {
00023
00024 Transition::DoStart();
00025 count=0;
00026 erouter->addListener(this,EventBase::visObjEGID,sid);
00027
00028 }
00029
00030
00031 virtual void DoStop() {
00032
00033 erouter->removeListener(this);
00034 count=0;
00035 Transition::DoStop();
00036
00037 }
00038
00039
00040 virtual void processEvent(const EventBase& e) {
00041
00042
00043 if(e.getTypeID()==EventBase::deactivateETID)
00044 count=0;
00045 else
00046 count++;
00047 if(count>5)
00048 fire();
00049
00050
00051 }
00052
00053 protected:
00054
00055 unsigned int sid;
00056
00057 unsigned int count;
00058 };
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 #endif