DBOOL Trigger::Update() { CServerDE* pServerDE = GetServerDE(); if (!pServerDE) return DFALSE; // Handle timed trigger... if (m_bTimedTrigger) { DFLOAT fTime = pServerDE->GetTime(); if (fTime > m_fNextTriggerTime) { m_fNextTriggerTime = fTime + GetRandom(m_fMinTriggerTime, m_fMaxTriggerTime); DoTrigger(DNULL, DFALSE); } } // Attach the trigger to the object... if (m_hstrAttachToObject && !m_bAttached) { AttachToObject(); m_bAttached = DTRUE; } if (m_bDelayingActivate) { UpdateDelayingActivate(); } else { m_bActive = DTRUE; // If not a timed trigger, my object touch notification will trigger // new updates until then, I don't care. if (m_bTimedTrigger) { pServerDE->SetNextUpdate(m_hObject, UPDATE_DELTA); pServerDE->SetDeactivationTime(m_hObject, 0.0f); } else { pServerDE->SetNextUpdate(m_hObject, 0.0f); pServerDE->SetDeactivationTime(m_hObject, TRIGGER_DEACTIVATION_TIME); } } return DTRUE; }
void kexAttachment::DettachObject(void) { AttachToObject(NULL); }