| | |
| | | // 更新“上次触发”的索引为当前索引,防止本分段内重复触发。 |
| | | m_LastNotifiedSegment = currentSegment; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 立即设置滑块的状态(值和阶段),而不触发任何事件或平滑动画。 |
| | | /// </summary> |
| | | /// <param name="newValue">要设置的新目标值 (0-1)。</param> |
| | | /// <param name="newStage">要设置的新目标阶段和当前阶段。</param> |
| | | public void SetStateInstantly(float newValue, int newStage) |
| | | { |
| | | this.value = newValue; |
| | | this.stage = newStage; |
| | | this.presentStage = newStage; |
| | | if (m_Slider != null) |
| | | { |
| | | m_Slider.value = this.value; |
| | | } |
| | | refSpeed = 0f; |
| | | isMoving = false; |
| | | // 确保下次 LateUpdate 不会因为索引不匹配而错误触发 ValueChangeAction |
| | | m_LastNotifiedSegment = GetCurrentSegment(this.value); |
| | | } |
| | | |
| | | } |