some old sounds are added

This commit is contained in:
Timur Nizamov
2025-10-17 01:54:45 +03:00
parent 16c4680d6c
commit 013ed4944c
52 changed files with 929 additions and 43 deletions

View File

@@ -2,6 +2,8 @@ using System.Collections;
using System.Collections.Generic;
using Unity.XR.CoreUtils;
using UnityEngine;
using FMOD.Studio;
using static MouseLook;
public class CarDrivingRoutine : MonoBehaviour
@@ -23,10 +25,21 @@ public class CarDrivingRoutine : MonoBehaviour
public List<GameObject> FrontTires;
public List<GameObject> BackTires;
private EventInstance CarMovement;
private void Awake()
{
CarMovement = AudioManager.Instance.CreateInstance(FMODEvents.Instance.BoltCarSimpleDriving); //initialising the variable
CarMovement.setParameterByName("EasyBoltLogic", 0); //"Driving - 0 in FMOD"
CarMovement.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject)); //setting 3d attributes
}
private void Start()
{
targetSpeed = StraightSpeed;
targetRotationSpeed = rotationSpeed;
CarMovement.start(); //starting the car sound here
}
// Update is called once per frame
@@ -73,6 +86,8 @@ public class CarDrivingRoutine : MonoBehaviour
// Proceed to the next waypoint
_waypoint = _waypoint.Next;
}
CarMovement.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject)); //updating the attributes
}
private void rollTires()
@@ -106,6 +121,9 @@ public class CarDrivingRoutine : MonoBehaviour
StartCoroutine(SmoothAdjustSpeed(0, 0, haltspeed)); // Smoothly halt in 1 second
_tireSound.Stop();
_stopSound.Play();
CarMovement.setParameterByName("EasyBoltLogic", 1);
}
private void OnTriggerExit(Collider other)
@@ -114,6 +132,9 @@ public class CarDrivingRoutine : MonoBehaviour
StartCoroutine(SmoothAdjustSpeed(targetSpeed, targetRotationSpeed, haltspeed)); // Smoothly resume speed in 1 second
_stopSound.Stop();
_tireSound.Play();
CarMovement.setParameterByName("EasyBoltLogic", 0);
CarMovement.start();
}
private IEnumerator SmoothAdjustSpeed(float targetStraightSpeed, float targetRotationSpeed, float duration)

View File

@@ -37,6 +37,8 @@ public class PassangerSeat : LocomotionProvider
Vector3 cameraShift = cameraTransform.localPosition;
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.DoorOpen, gameObject);
currentPassanger = player;
player.transform.SetParent(this.transform);
player.transform.localPosition = -cameraShift;
@@ -75,7 +77,9 @@ public class PassangerSeat : LocomotionProvider
Transform cameraTransform = cameraChild.transform.parent.transform;
// Set the player<65>s parent to null (making it part of the scene hierarchy)
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.DoorClose, gameObject);
// Set the player<65>s parent to null (making it part of the scene hierarchy)
currentPassanger.transform.SetParent(null);
// Put the player outside;

View File

@@ -303,6 +303,8 @@ public class ElevatorBox : MonoBehaviour
SetState(ElevatorState.ClosingDoors);
playRandomAudioClipFrom(closeDoorsClips);
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.ElevatorDoorClosing, gameObject); //fmod attached 3d oneshot event
ElevatorOuter currentCaller = findCurrentCaller();
if (currentCaller != null) currentCaller.CloseDoors();
@@ -318,6 +320,9 @@ public class ElevatorBox : MonoBehaviour
//Debug.Log("Opening doors");
SetState(ElevatorState.OpeningDoors);
playRandomAudioClipFrom(openDoorsClips);
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.ElevatorDoorOpening, gameObject); //fmod attached 3d oneshot event
ElevatorOuter targetCaller = findTargetCaller();
//Debug.Log("Target caller is: " + targetCaller);
if (targetCaller != null)
@@ -367,6 +372,8 @@ public class ElevatorBox : MonoBehaviour
SetState(ElevatorState.Moving);
playRandomAudioClipFrom(moveElevatorClips);
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.ElevatorMovement, gameObject); //fmod attached 3d oneshot event
while (t < 1f)
{
t += Time.deltaTime / floorMoveTime;

View File

@@ -124,6 +124,7 @@ GameObject:
m_Component:
- component: {fileID: 6021721823031538141}
- component: {fileID: 4707456952479937532}
- component: {fileID: 5921542733598710255}
m_Layer: 0
m_Name: Portal
m_TagString: Untagged
@@ -148,7 +149,7 @@ Transform:
- {fileID: 1266057804064659733}
- {fileID: 5614923999591170275}
m_Father: {fileID: 0}
m_RootOrder: 0
m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!82 &4707456952479937532
AudioSource:
@@ -291,6 +292,37 @@ AudioSource:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!114 &5921542733598710255
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4777591596180506993}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9a6610d2e704f1648819acc8d7460285, type: 3}
m_Name:
m_EditorClassIdentifier:
CollisionTag:
EventReference:
Guid:
Data1: 214152321
Data2: 1136432684
Data3: -1979358295
Data4: 727957873
Path: event:/Ambiences/PortalSpacial
Event:
EventPlayTrigger: 1
EventStopTrigger: 0
AllowFadeout: 1
TriggerOnce: 0
Preload: 0
NonRigidbodyVelocity: 0
Params: []
OverrideAttenuation: 0
OverrideMinDistance: 1
OverrideMaxDistance: 20
--- !u!1 &6014189720456933605
GameObject:
m_ObjectHideFlags: 0
@@ -527,3 +559,4 @@ MonoBehaviour:
portalScene: {fileID: 7751003758844882782}
occlusionPortal: {fileID: 0}
_shouldTeleport: 1
teleportationProvider: {fileID: 0}

View File

@@ -31,7 +31,6 @@ public class SpaceEnterCollider : MonoBehaviour
playerGravity.isInSpace = true;
}
Debug.Log(other + " entered space.");
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.PortalEnter, gameObject);
}
private void OnTriggerExit(Collider other)
@@ -53,6 +52,5 @@ public class SpaceEnterCollider : MonoBehaviour
yield return new WaitForSeconds(1f); // Wait for 1 second
playerGravity.isInSpace = false;
Debug.Log("Default gravity restored after 1 second.");
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.PortalEnter, gameObject);
}
}

View File

@@ -65,7 +65,10 @@ public class StencilPortal : MonoBehaviour
matchOrientation = MatchOrientation.TargetUpAndForward
};
AudioManager.Instance.PlayOneShot3D(FMODEvents.Instance.PortalEnter, targetPosition);
teleportationProvider.QueueTeleportRequest(request);
other.transform.rotation = TransformRotationBetweenPortals(this, targetPortal, other.transform.rotation);
}
else
@@ -79,6 +82,7 @@ public class StencilPortal : MonoBehaviour
{
Destroy(gameObject, 0.5f);
}
}
private void OnTriggerExit(Collider other)
@@ -86,6 +90,9 @@ public class StencilPortal : MonoBehaviour
AllowTeleport();
if (!_shouldTeleport || IsInvoking(nameof(AllowTeleport))) return;
if (!other.CompareTag("Player")) return;
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.PortalEnter, gameObject);
Debug.Log(transform.name + " player exited");
Invoke(nameof(AllowTeleport), 1f);
}

View File

@@ -4,37 +4,61 @@ using System.Runtime.Remoting.Messaging;
using UnityEngine;
using UnityEngine.PlayerLoop;
using UnityEngine.XR.Content.Interaction;
using FMOD.Studio;
public class AlarmTrigger : MonoBehaviour
{
public XRPushButton PushButton;
public AudioSource AlarmSequence;
public AudioSource VentilationSequence;
private EventInstance RoomHum;
private EventInstance AlarmSound;
private bool hasAlarm = false;
private void Awake()
{
RoomHum = AudioManager.Instance.CreateInstance(FMODEvents.Instance.ServerRoomHumming);
RoomHum.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject));
AlarmSound = AudioManager.Instance.CreateInstance(FMODEvents.Instance.ServerRoomAlarm);
AlarmSound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject));
}
void Start()
{
if (PushButton != null)
{
PushButton.onPress.AddListener(OnButtonPressed);
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.ServerRoomButton, gameObject);
}
}
void OnButtonPressed()
{
Debug.Log("Alarm button Pressed!");
if (!AlarmSequence.isPlaying) { //if alarm isn't already triggered.
if (!AudioManager.IsPlaying(AlarmSound)){ //if alarm isn't already triggered.
VentilationSequence.Stop();
AlarmSequence.Play();
AlarmSound.start();
AudioManager.Instance.StopInstance(RoomHum, STOP_MODE.ALLOWFADEOUT);
hasAlarm = true;
}
}
void Update()
{
if(hasAlarm && !AlarmSequence.isPlaying) // If alarm state has ended.
if(hasAlarm && !AudioManager.IsPlaying(AlarmSound)) // If alarm state has ended.
{
VentilationSequence.Play(); // Return to normal.
RoomHum.start();
hasAlarm = false;
}
}

View File

@@ -100,6 +100,10 @@ PrefabInstance:
type: 3}
insertIndex: -1
addedObject: {fileID: 2488785156293713400}
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: ac65e655dd40bcd48b72b3f8ddcf45bd,
type: 3}
insertIndex: -1
addedObject: {fileID: 3366414401841504121}
m_SourcePrefab: {fileID: 100100000, guid: ac65e655dd40bcd48b72b3f8ddcf45bd, type: 3}
--- !u!1 &7023167506039495560 stripped
GameObject:
@@ -252,3 +256,34 @@ AudioSource:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!114 &3366414401841504121
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7023167506039495560}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9a6610d2e704f1648819acc8d7460285, type: 3}
m_Name:
m_EditorClassIdentifier:
CollisionTag:
EventReference:
Guid:
Data1: 2088767158
Data2: 1236037630
Data3: 1977926589
Data4: -1933500246
Path: event:/Ambiences/Server/OnlyHum
Event:
EventPlayTrigger: 1
EventStopTrigger: 0
AllowFadeout: 1
TriggerOnce: 0
Preload: 0
NonRigidbodyVelocity: 0
Params: []
OverrideAttenuation: 0
OverrideMinDistance: 1
OverrideMaxDistance: 6.8

View File

@@ -58,11 +58,13 @@ namespace _PROJECT.Multiplayer.NewBow
if (PullAmount == 0 & newPull > 0)
{
pullSounds.Play();
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.BowPullback, gameObject);
}
if (PullAmount < 0.98f & newPull >= 0.98f)
{
maxPullSounds.Play();
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.BowPullbackMax, gameObject);
}
PullAmount = newPull;

View File

@@ -63,6 +63,7 @@ namespace _PROJECT.Multiplayer.NewBow
OwnerDeselectRpc(Owner, arrow);
_interactionManager.SelectExit(_notch, _notch.firstInteractableSelected);
PlayReleaseSoundRPC();
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.BowArrowRelease, gameObject);
}
_arrowNetworkObject = null;
@@ -81,6 +82,7 @@ namespace _PROJECT.Multiplayer.NewBow
_interactionManager.SelectEnter(_notch as IXRSelectInteractor, arrow);
OwnerSelectRpc(Owner, arrowObject.GetComponent<NetworkObject>());
PlayNockSoundRPC();
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.BowArrowNock, gameObject);
}
public override void OnOwnershipClient(NetworkConnection prevOwner)

View File

@@ -36,7 +36,7 @@ Transform:
m_Children:
- {fileID: 7933779445518253981}
m_Father: {fileID: 0}
m_RootOrder: 0
m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3572526038880022669
MonoBehaviour:
@@ -57,8 +57,6 @@ MonoBehaviour:
type: 3}
endPosition: {x: 0, y: 0, z: 0}
forwardSpeed: 2
minRandomOffset: {x: 0, y: 0, z: 0}
maxRandomOffset: {x: 0, y: 0, z: 0}
--- !u!54 &3766976745949113692
Rigidbody:
m_ObjectHideFlags: 0

View File

@@ -20,6 +20,32 @@ public class FMODEvents : MonoBehaviour
[field: SerializeField] public EventReference MapOpen { get; private set; }
[field: SerializeField] public EventReference Hover { get; private set; }
[field: Header("Initial events")]
[field: SerializeField] public EventReference PortalSpacial { get; private set; }
[field: SerializeField] public EventReference UfoPassing { get; private set; }
[field: SerializeField] public EventReference BowArrowHit { get; private set; }
[field: SerializeField] public EventReference BowArrowNock { get; private set; }
[field: SerializeField] public EventReference BowArrowRelease { get; private set; }
[field: SerializeField] public EventReference BowPullback { get; private set; }
[field: SerializeField] public EventReference BowPullbackMax { get; private set; }
[field: SerializeField] public EventReference ElevatorDoorClosing { get; private set; }
[field: SerializeField] public EventReference ElevatorDoorOpening { get; private set; }
[field: SerializeField] public EventReference ElevatorArrival { get; private set; }
[field: SerializeField] public EventReference ElevatorMovement { get; private set; }
[field: SerializeField] public EventReference BoltCarStopSound { get; private set; }
[field: SerializeField] public EventReference BoltCarSimpleDriving { get; private set; }
[field: SerializeField] public EventReference BoltCarHorn { get; private set; }
[field: SerializeField] public EventReference ServerRoomAlarm { get; private set; }
[field: SerializeField] public EventReference ServerRoomButton { get; private set; }
[field: SerializeField] public EventReference ServerRoomHumming { get; private set; }
[field: SerializeField] public EventReference ServerRoomRackHum { get; private set; }
public static FMODEvents Instance { get; private set; }
private void Awake()