From fba8fc9c45d408a98798cf96c896d7a910d1f6c4 Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Thu, 10 Aug 2023 02:09:58 -0700 Subject: [PATCH] Move blocks around --- dGame/dComponents/MovementAIComponent.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/dGame/dComponents/MovementAIComponent.cpp b/dGame/dComponents/MovementAIComponent.cpp index 13127fe6..182d73cc 100644 --- a/dGame/dComponents/MovementAIComponent.cpp +++ b/dGame/dComponents/MovementAIComponent.cpp @@ -151,13 +151,17 @@ void MovementAIComponent::Update(const float deltaTime) { // Check if there are more waypoints in the queue, if so set our next destination to the next waypoint HandleWaypointArrived(); if (!AdvancePathWaypointIndex()) { - if (m_Path && m_Path->pathBehavior == PathBehavior::Bounce) { - ReversePath(); - } else if (m_Path && m_Path->pathBehavior == PathBehavior::Loop) { - m_CurrentPathWaypointIndex = 0; - m_NextPathWaypointIndex = 0; - AdvancePathWaypointIndex(); - SetDestination(GetCurrentPathWaypoint()); + if (m_Path) { + if (m_Path->pathBehavior == PathBehavior::Bounce) { + ReversePath(); + } else if (m_Path->pathBehavior == PathBehavior::Loop) { + m_CurrentPathWaypointIndex = 0; + m_NextPathWaypointIndex = 0; + AdvancePathWaypointIndex(); + SetDestination(GetCurrentPathWaypoint()); + } else { + Stop(); + } } else { Stop(); }