00001 #include "SCA_TimeEventManager.h" 00002 00003 #include "SCA_ISystem.h" 00004 #include "SCA_LogicManager.h" 00005 #include "FloatValue.h" 00006 00007 SCA_TimeEventManager::SCA_TimeEventManager(SCA_LogicManager* logicmgr,SCA_ISystem* system) 00008 : SCA_EventManager(TIME_EVENTMGR) 00009 { 00010 00011 } 00012 00013 SCA_TimeEventManager::~SCA_TimeEventManager() 00014 { 00015 for (vector<CValue*>::iterator it=m_timevalues.begin();!(it==m_timevalues.end());it++) 00016 { 00017 (*it)->Release(); 00018 } 00019 } 00020 00021 void SCA_TimeEventManager::RegisterSensor(SCA_ISensor* sensor) 00022 { 00023 // not yet 00024 } 00025 00026 void SCA_TimeEventManager::NextFrame(double curtime,double deltatime) 00027 { 00028 CFloatValue* floatval = new CFloatValue(curtime); 00029 00030 // update sensors, but ... need deltatime ! 00031 for (vector<CValue*>::iterator it=m_timevalues.begin();!(it==m_timevalues.end());it++) 00032 { 00033 float newtime = (*it)->GetNumber()+deltatime; 00034 floatval->SetFloat(newtime); 00035 (*it)->SetValue(floatval); 00036 } 00037 00038 floatval->Release(); 00039 } 00040 void SCA_TimeEventManager::AddTimeProperty(CValue* timeval) 00041 { 00042 timeval->AddRef(); 00043 m_timevalues.push_back(timeval); 00044 }