mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-15 04:38:21 +00:00
Add reversing
This commit is contained in:
parent
aa734ef7ae
commit
b546c96193
@ -141,6 +141,15 @@ nextAction:
|
||||
Game::entityManager->SerializeEntity(m_Parent);
|
||||
}
|
||||
|
||||
void MovementAIComponent::ReversePath() {
|
||||
if (m_CurrentPath.empty()) return;
|
||||
if (m_NextPathWaypointIndex < 0) m_NextPathWaypointIndex = 0;
|
||||
if (m_NextPathWaypointIndex >= m_CurrentPath.size()) m_NextPathWaypointIndex = m_CurrentPath.size() - 1;
|
||||
m_CurrentPathWaypointIndex = m_NextPathWaypointIndex;
|
||||
m_IsInReverse = !m_IsInReverse;
|
||||
AdvancePathWaypointIndex();
|
||||
}
|
||||
|
||||
bool MovementAIComponent::AdvancePathWaypointIndex() {
|
||||
m_CurrentPathWaypointIndex = m_NextPathWaypointIndex;
|
||||
if (m_IsInReverse) {
|
||||
|
@ -175,8 +175,15 @@ public:
|
||||
|
||||
bool IsPaused() const { return m_IsPaused; }
|
||||
|
||||
/**
|
||||
* Pauses the current pathing of this entity. The current path waypoint will be saved for resuming later.
|
||||
*/
|
||||
void Pause();
|
||||
|
||||
/**
|
||||
* Resumes pathing from the current position to the destination that was set
|
||||
* when the entity was paused.
|
||||
*/
|
||||
void Resume();
|
||||
|
||||
/**
|
||||
@ -184,6 +191,8 @@ public:
|
||||
*/
|
||||
void Stop();
|
||||
|
||||
void ReversePath();
|
||||
|
||||
/**
|
||||
* Stops the current movement and moves the entity to a certain point. Will continue until it's close enough,
|
||||
* after which its AI is enabled again.
|
||||
|
Loading…
Reference in New Issue
Block a user