/// <summary> /// Responds to OnClamped event from Value Waypoint /// </summary> /// <param name="valueWaypoint">Value Waypoint sending the event</param> public static void OnValueWaypointClamp(IValueWaypoint valueWaypoint) { float scaleDirection = Mathf.Sign(valueWaypoint.scale); switch (valueWaypoint.actionType) { case ActionType.PingPong: if (!valueWaypoint.loop) { if (!ValueSmoothWaypointUtils.IsRouteCycleCompleted(valueWaypoint)) { ValueSmoothWaypointUtils.Shift(valueWaypoint, scaleDirection); } } else { if (scaleDirection.Equals(ValueSmoothWaypointUtils.DIRECTION_REVERSE) && valueWaypoint.direction.Equals(ValueSmoothWaypointUtils.DIRECTION_REVERSE)) { if (!ValueSmoothWaypointUtils._FlipDirection.Invoke(valueWaypoint, valueWaypoint.currentIndex, ValueSmoothWaypointUtils._GreaterOrEqual)) { ValueSmoothWaypointUtils.Shift(valueWaypoint, -scaleDirection); } } else if (scaleDirection.Equals(ValueSmoothWaypointUtils.DIRECTION_REVERSE) && valueWaypoint.direction.Equals(ValueSmoothWaypointUtils.DIRECTION_FORWARD)) { if (!ValueSmoothWaypointUtils._FlipDirection.Invoke(valueWaypoint, valueWaypoint.currentIndex, ValueSmoothWaypointUtils._LessOrEqual)) { ValueSmoothWaypointUtils.Shift(valueWaypoint, scaleDirection); } } else if (scaleDirection.Equals(ValueSmoothWaypointUtils.DIRECTION_FORWARD) && valueWaypoint.direction.Equals(ValueSmoothWaypointUtils.DIRECTION_FORWARD)) { if (!ValueSmoothWaypointUtils._FlipDirection.Invoke(valueWaypoint, valueWaypoint.currentIndex, ValueSmoothWaypointUtils._GreaterOrEqual)) { ValueSmoothWaypointUtils.Shift(valueWaypoint, scaleDirection); } } else if (scaleDirection.Equals(ValueSmoothWaypointUtils.DIRECTION_FORWARD) && valueWaypoint.direction.Equals(ValueSmoothWaypointUtils.DIRECTION_REVERSE)) { if (!ValueSmoothWaypointUtils._FlipDirection.Invoke(valueWaypoint, valueWaypoint.currentIndex, ValueSmoothWaypointUtils._LessOrEqual)) { ValueSmoothWaypointUtils.Shift(valueWaypoint, -scaleDirection); } } } break; case ActionType.Wrap: if (!valueWaypoint.loop) { if (!ValueSmoothWaypointUtils.IsRouteCycleCompleted(valueWaypoint)) { ValueSmoothWaypointUtils.Shift(valueWaypoint, scaleDirection); } } else { ValueSmoothWaypointUtils.Shift(valueWaypoint, scaleDirection); } break; case ActionType.None: case ActionType.Random: default: break; } valueWaypoint.Prepare(); ValueWaypointUtils.SetVecsToNode(valueWaypoint); }