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 AnimationSystem::Update(int _ElaspedTime, AnimationTimestamp& _info) { if (m_Loaded[_info.GetCurrAnim()].GetFrames().size() > (unsigned int)_info.GetCurrFrame()) { if (m_Loaded[_info.GetCurrAnim()].GetFrames()[_info.GetCurrFrame()].GetTriggerType() == "Event" && m_Loaded[_info.GetCurrAnim()].GetFrames()[_info.GetCurrFrame()].GetTriggerName() != "None") { SGD::Event* tempevent = new SGD::Event(m_Loaded[_info.GetCurrAnim()].GetFrames()[_info.GetCurrFrame()].GetTriggerName().c_str(), nullptr, this); tempevent->SendEventNow(); delete tempevent; tempevent = nullptr; } } }