Last active
October 28, 2022 16:49
-
-
Save RootKiller/b440773a79fcb8af37970231cffe00bf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool HumanBase::WalkTo(const Vector2& position) | |
{ | |
if (m_state == HumanState::Walking) { | |
return false; | |
} | |
m_currentWalkPath = GetWorld()->FindPath(m_position, position); | |
if (!m_currentWalkPath) { | |
return false; | |
} | |
if (!m_currentWalkPath->GetPointsCount()) { | |
m_position = position; | |
m_previousPosition = position; | |
return true; | |
} | |
m_targetPathPoint = 0; | |
m_nextState = m_state; | |
m_state = HumanState::Walking; | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment