Finalize normalized movement settings

This commit is contained in:
Michal Pikulski
2025-10-07 09:42:59 +02:00
parent 348e982930
commit 328e8dea0a
5 changed files with 75 additions and 122 deletions

View File

@@ -2,6 +2,7 @@
using System.Collections;
using AppleHills.Core.Settings;
using Pooling;
using Utils;
namespace Minigames.DivingForPictures
{
@@ -182,15 +183,15 @@ namespace Minigames.DivingForPictures
/// </summary>
private IEnumerator MovementCoroutine()
{
Debug.Log($"[FloatingObstacle] Started movement coroutine with speed: {moveSpeed:F3}");
Debug.Log($"[FloatingObstacle] Started movement coroutine with speed: {_baseMoveSpeed:F3}");
while (enabled && gameObject.activeInHierarchy)
{
// Use velocity factor sign to determine direction
Vector3 direction = Vector3.up * Mathf.Sign(_velocityFactor);
// Apply normalized movement with deltaTime for frame rate independence
float speed = moveSpeed * Time.deltaTime;
// Apply normalized movement using the shared utility method
float speed = AppleHillsUtils.CalculateNormalizedMovementSpeed(_baseMoveSpeed);
// Apply movement in correct direction
transform.position += direction * speed;