Exemplo n.º 1
0
void cMonster::CheckEventLostPlayer(void)
{
	if (m_Target != nullptr)
	{
		if ((m_Target->GetPosition() - GetPosition()).Length() > m_SightDistance)
		{
			EventLosePlayer();
		}
	}
	else
	{
		EventLosePlayer();
	}
}
Exemplo n.º 2
0
void cEnderman::CheckEventLostPlayer(void)
{
	super::CheckEventLostPlayer();
	if (!CheckLight())
	{
		EventLosePlayer();
	}
}
Exemplo n.º 3
0
void cMonster::CheckEventLostPlayer(void)
{
	Vector3f pos;
	cTracer LineOfSight(GetWorld());
	
	if (m_Target != NULL)
	{
		pos = m_Target->GetPosition();
		if ((pos - GetPosition()).Length() > m_SightDistance || LineOfSight.Trace(GetPosition(),(pos - GetPosition()), (int)(pos - GetPosition()).Length()))
		{
			EventLosePlayer();
		}
	}
	else
	{
		EventLosePlayer();
	}
}
Exemplo n.º 4
0
void cEnderman::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
	super::Tick(a_Dt, a_Chunk);

	// TODO take damage in rain

	// Take damage when touching water, drowning damage seems to be most appropriate
	if (IsSwimming())
	{
		EventLosePlayer();
		TakeDamage(dtDrowning, nullptr, 1, 0);
		// TODO teleport to a safe location
	}

}