better tests for advancing waypoint

This commit is contained in:
David Markowitz
2023-08-03 21:37:08 -07:00
parent e31b6ca54b
commit e6fe2edfae
2 changed files with 43 additions and 12 deletions

View File

@@ -38,7 +38,7 @@ PlatformSubComponent::PlatformSubComponent(MovingPlatformComponent* parentCompon
void PlatformSubComponent::AdvanceToNextWaypoint() {
uint32_t numWaypoints = m_Path->pathWaypoints.size();
m_CurrentWaypointIndex = m_NextWaypointIndex;
uint32_t nextWaypointIndex = m_CurrentWaypointIndex;
uint32_t nextWaypointIndex = m_CurrentWaypointIndex + 1;
if (numWaypoints <= nextWaypointIndex) {
PathBehavior behavior = m_Path->pathBehavior;
if (behavior == PathBehavior::Once) {
@@ -56,7 +56,7 @@ void PlatformSubComponent::AdvanceToNextWaypoint() {
void PlatformSubComponent::AdvanceToNextReverseWaypoint() {
uint32_t numWaypoints = m_Path->pathWaypoints.size();
m_CurrentWaypointIndex = m_NextWaypointIndex;
int32_t nextWaypointIndex = m_CurrentWaypointIndex;
int32_t nextWaypointIndex = m_CurrentWaypointIndex - 1;
if (nextWaypointIndex < 0) {
PathBehavior behavior = m_Path->pathBehavior;
if (behavior == PathBehavior::Once) {