add arrived handler

This commit is contained in:
David Markowitz 2023-08-07 02:03:09 -07:00
parent b546c96193
commit d372278b25
2 changed files with 8 additions and 0 deletions

View File

@ -127,6 +127,7 @@ void MovementAIComponent::Update(const float deltaTime) {
SetRotation(NiQuaternion::LookAt(source, m_NextWaypoint)); SetRotation(NiQuaternion::LookAt(source, m_NextWaypoint));
} else { } else {
// Check if there are more waypoints in the queue, if so set our next destination to the next waypoint // Check if there are more waypoints in the queue, if so set our next destination to the next waypoint
HandleWaypointArrived();
if (!AdvancePathWaypointIndex()) { if (!AdvancePathWaypointIndex()) {
Stop(); Stop();
return; return;
@ -247,6 +248,7 @@ void MovementAIComponent::Stop() {
m_TimeTravelled = 0; m_TimeTravelled = 0;
m_AtFinalWaypoint = true; m_AtFinalWaypoint = true;
m_IsPaused = true;
m_InterpolatedWaypoints.clear(); m_InterpolatedWaypoints.clear();
m_CurrentPath.clear(); m_CurrentPath.clear();
@ -404,3 +406,7 @@ void MovementAIComponent::SetMaxSpeed(const float value) {
m_MaxSpeed = value; m_MaxSpeed = value;
m_Acceleration = value / 5; m_Acceleration = value / 5;
} }
void MovementAIComponent::HandleWaypointArrived() {
}

View File

@ -193,6 +193,8 @@ public:
void ReversePath(); void ReversePath();
void HandleWaypointArrived();
/** /**
* 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.