Bunch of refactoring and walking, AI needs a ton of tweaking to use the new logic

This commit is contained in:
KimLS
2018-10-12 00:03:58 -07:00
parent 29ea65a71e
commit 1785120796
17 changed files with 787 additions and 474 deletions
+19 -3
View File
@@ -427,7 +427,7 @@ void NPC::SaveGuardSpot(bool iClearGuardSpot) {
}
void NPC::NextGuardPosition() {
NavigateTo(m_GuardPoint.x, m_GuardPoint.y, m_GuardPoint.z, GetMovespeed());
NavigateTo(m_GuardPoint.x, m_GuardPoint.y, m_GuardPoint.z);
if ((m_Position.x == m_GuardPoint.x) && (m_Position.y == m_GuardPoint.y) && (m_Position.z == m_GuardPoint.z))
{
if (moved)
@@ -442,8 +442,24 @@ float Mob::CalculateDistance(float x, float y, float z) {
return (float)sqrtf(((m_Position.x - x)*(m_Position.x - x)) + ((m_Position.y - y)*(m_Position.y - y)) + ((m_Position.z - z)*(m_Position.z - z)));
}
void Mob::NavigateTo(float x, float y, float z, float speed) {
mMovementManager->NavigateTo(this, x, y, z, speed);
void Mob::WalkTo(float x, float y, float z)
{
mMovementManager->NavigateTo(this, x, y, z, false, MovementWalking);
}
void Mob::RunTo(float x, float y, float z)
{
mMovementManager->NavigateTo(this, x, y, z, false, MovementRunning);
}
void Mob::NavigateTo(float x, float y, float z)
{
if (IsRunning()) {
mMovementManager->NavigateTo(this, x, y, z, false, MovementRunning);
}
else {
mMovementManager->NavigateTo(this, x, y, z, false, MovementWalking);
}
}
void Mob::StopNavigation() {