示例#1
0
void CannonBall::HandleCollision(IEntity* pOther)
{


	if (pOther->GetType() == ENT_TILES)
	{
		DestroyActorMessage* destroy = new DestroyActorMessage{ this };
		destroy->QueueMessage();
		destroy = nullptr;

	}

	if (pOther->GetType() == ENT_FATHER)
	{
		dynamic_cast<Father*>(pOther)->SetAlive(false);

		SGD::Event* CannonBallHit = new SGD::Event("Death", nullptr, this);
		CannonBallHit->QueueEvent(pOther);
		DestroyActorMessage* destroy = new DestroyActorMessage{ this };
		destroy->QueueMessage();
		destroy = nullptr;

	}


}
示例#2
0
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);
	
}
示例#3
0
void CheckPoint::HandleCollision(IEntity* pOther)
{

	if (pOther->GetType() == ENT_FATHER)
	{
		dynamic_cast<Father*>(pOther)->SetCheckPoint(GetPosition());
		SGD::Event* event = new SGD::Event("Walking", nullptr, this);
		event->QueueEvent();
	}
}
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;
		}
	}
}