void Zombie::Update(float dt) { if (isAlive) { if (currBehavior != nullptr) currBehavior->Update(dt, this, m_pTarget->GetPosition()); // possible turret target SGD::Event event = { "ASSESS_THREAT", nullptr, this }; event.SendEventNow(nullptr); // death animation int numframes = AnimationManager::GetInstance()->GetAnimation(this->animation.m_strCurrAnimation)->GetFrames().size(); numframes--; float deathdur = AnimationManager::GetInstance()->GetAnimation(this->animation.m_strCurrAnimation)->GetFrames()[numframes]->GetDuration(); string deathanim = this->animation.m_strCurrAnimation; if (deathanim.find("Death") != string::npos && this->animation.m_nCurrFrame == numframes && this->animation.m_fCurrDuration >= deathdur) isAlive = false; } else { DestroyObjectMessage* dMsg = new DestroyObjectMessage{ this }; dMsg->QueueMessage(); dMsg = nullptr; SpawnManager::GetInstance()->SetEnemiesKilled(SpawnManager::GetInstance()->GetEnemiesKilled() + 1); } MovingObject::Update(dt); }
void FireTrap::Update(float elapsedTime) { if (m_bStartTimer) m_fTimer += elapsedTime; if (m_fTimer >= 0.9f) { DestroyObjectMessage* pMsg = new DestroyObjectMessage(this); pMsg->QueueMessage(); pMsg = nullptr; } //m_pParticle.Update(); }