Skip to content

Instantly share code, notes, and snippets.

@RootKiller
Last active October 28, 2022 16:49
Show Gist options
  • Save RootKiller/b440773a79fcb8af37970231cffe00bf to your computer and use it in GitHub Desktop.
Save RootKiller/b440773a79fcb8af37970231cffe00bf to your computer and use it in GitHub Desktop.
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