fixes, portal sound changed, faders

This commit is contained in:
Timur Nizamov
2025-12-08 00:06:28 +02:00
parent f414e10d94
commit 647d247c81
81 changed files with 963 additions and 885 deletions

View File

@@ -21,6 +21,9 @@ public class CarDrivingRoutine : NetworkBehaviour
private float targetSpeed;
private float targetRotationSpeed;
private bool stopSoundPlayed = false;
private float stopThreshold = 0.05f; // consider speed "0" when below this
[Header("Tires")]
public List<GameObject> FrontTires;
public List<GameObject> BackTires;
@@ -79,6 +82,16 @@ public class CarDrivingRoutine : NetworkBehaviour
// Proceed to the next waypoint
_waypoint = _waypoint.Next;
}
if (StraightSpeed <= stopThreshold && !stopSoundPlayed)
{
stopSoundPlayed = true;
// Play the sound normally from your audio controller
//AudioController.SetRPM(475);
AudioController.PlayStopSound();
}
}
private void rollTires()
@@ -114,7 +127,7 @@ public class CarDrivingRoutine : NetworkBehaviour
//_stopSound.Play();
AudioController.SetRPM(475);
AudioController.PlayStopSound();
//AudioController.PlayStopSound();
}
@@ -126,6 +139,7 @@ public class CarDrivingRoutine : NetworkBehaviour
//_tireSound.Play();
AudioController.SetRPM(1450);
stopSoundPlayed = false;
}
@@ -150,5 +164,12 @@ public class CarDrivingRoutine : NetworkBehaviour
// Ensure final values are set
StraightSpeed = targetStraightSpeed;
rotationSpeed = targetRotationSpeed;
// If we just came to a full stop, mark for sound playback
if (StraightSpeed == 0)
{
stopSoundPlayed = false; // allow stop sound to fire
}
}
}

View File

@@ -44,11 +44,8 @@ public class CarAudioController : MonoBehaviour
public void PlayStopSound()
{
carMovementInstance.getParameterByName("RPM", out float currentRPM);
if (currentRPM == 475)
{
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.BoltCarStopSound, gameObject);
}
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.BoltCarStopSound, gameObject);
}
}