Skip to content

Instantly share code, notes, and snippets.

@RootKiller
Last active October 28, 2022 16:49
Show Gist options
  • Save RootKiller/99cd43d9cd867546ae77bb09eed51307 to your computer and use it in GitHub Desktop.
Save RootKiller/99cd43d9cd867546ae77bb09eed51307 to your computer and use it in GitHub Desktop.
bool HumanBase::WalkTo(const Vector2& position)
{
if (m_state != HumanState::Walking) {
m_currentWalkPath = GetWorld()->FindPath(m_position, position);
if (m_currentWalkPath) {
if (!m_currentWalkPath->GetPointsCount()) {
m_position = position;
m_previousPosition = position;
}
else {
m_targetPathPoint = 0;
m_nextState = m_state;
m_state = HumanState::Walking;
}
return true;
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment