mirror of
https://github.com/DarkflameUniverse/DarkflameServer
synced 2024-08-30 18:43:58 +00:00
Add reversing
This commit is contained in:
parent
aa734ef7ae
commit
b546c96193
@ -141,6 +141,15 @@ nextAction:
|
|||||||
Game::entityManager->SerializeEntity(m_Parent);
|
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() {
|
bool MovementAIComponent::AdvancePathWaypointIndex() {
|
||||||
m_CurrentPathWaypointIndex = m_NextPathWaypointIndex;
|
m_CurrentPathWaypointIndex = m_NextPathWaypointIndex;
|
||||||
if (m_IsInReverse) {
|
if (m_IsInReverse) {
|
||||||
|
@ -175,8 +175,15 @@ public:
|
|||||||
|
|
||||||
bool IsPaused() const { return m_IsPaused; }
|
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();
|
void Pause();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resumes pathing from the current position to the destination that was set
|
||||||
|
* when the entity was paused.
|
||||||
|
*/
|
||||||
void Resume();
|
void Resume();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -184,6 +191,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
void Stop();
|
void Stop();
|
||||||
|
|
||||||
|
void ReversePath();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stops the current movement and moves the entity to a certain point. Will continue until it's close enough,
|
* 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.
|
* after which its AI is enabled again.
|
||||||
|
Loading…
Reference in New Issue
Block a user