kõik vanad helid lisatud, peaaegu kõik esimese iteratsiooni helid on lisatud, auto jaoks üks lisaloogika on tehtud

This commit is contained in:
Timur Nizamov
2025-10-20 00:02:08 +03:00
parent 2e61259ebe
commit 48860cf906
77 changed files with 2291 additions and 138 deletions

View File

@@ -40,6 +40,7 @@ public class CarDrivingRoutine : MonoBehaviour
targetRotationSpeed = rotationSpeed;
CarMovement.start(); //starting the car sound here
AudioManager.Instance.SetGlobalParameter("CarPassengerLogic", 0.0f); //change the value of the global parameter in FMOD, initial value
}
// Update is called once per frame

View File

@@ -5,6 +5,7 @@ using Unity.XR.CoreUtils;
using UnityEngine;
using UnityEngine.XR.Content.Interaction;
using UnityEngine.XR.Interaction.Toolkit;
using FMODUnity;
public class PassangerSeat : LocomotionProvider
{
@@ -36,9 +37,9 @@ public class PassangerSeat : LocomotionProvider
Transform cameraTransform = cameraChild.transform.parent.transform;
Vector3 cameraShift = cameraTransform.localPosition;
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.DoorOpen, gameObject);
AudioManager.Instance.SetGlobalParameter("CarPassengerLogic", 2.0f); //change the value of the global parameter in FMOD, changed value
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.DoorOpen, gameObject); //play 3d oneshot
currentPassanger = player;
player.transform.SetParent(this.transform);
player.transform.localPosition = -cameraShift;
@@ -76,8 +77,8 @@ public class PassangerSeat : LocomotionProvider
if (cameraChild == null) return;
Transform cameraTransform = cameraChild.transform.parent.transform;
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.DoorClose, gameObject);
AudioManager.Instance.SetGlobalParameter("CarPassengerLogic", 0.0f); //change the value of the global parameter in FMOD, initial value
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.DoorClose, gameObject); //play 3d oneshot
// Set the player<65>s parent to null (making it part of the scene hierarchy)
currentPassanger.transform.SetParent(null);

View File

@@ -19,17 +19,24 @@ namespace _PROJECT.Components.Drawing
private float _cooldownTimer = 0f;
private bool _isSpraying;
private EventInstance spray_sound;
private EventInstance spray_sound;
void Start()
{
spray_sound = AudioManager.Instance.CreateInstance(FMODEvents.Instance.Spray); //creating the instance through AudioManager
spray_sound.setParameterByName("SpraySwitcher", 0); //"Spray - 0 in FMOD"
spray_sound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(sprayPoint)); //setting the 3D attributes
}
protected override void OnActivated(ActivateEventArgs args)
{
base.OnActivated(args);
StartSpray();
spray_sound = AudioManager.Instance.CreateInstance(FMODEvents.Instance.Spray);
spray_sound.start(); //starting the instance
spray_sound.setParameterByName("SpraySwitcher", 0); //"Spray - 0 in FMOD"
spray_sound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(sprayPoint));
spray_sound.start();
}
protected override void OnDeactivated(DeactivateEventArgs args)
@@ -38,7 +45,6 @@ namespace _PROJECT.Components.Drawing
StopSpray();
spray_sound.setParameterByName("SpraySwitcher", 1); //"NoSpray - 1 in FMOD"
spray_sound.release();
}
private new void Awake()
@@ -47,6 +53,7 @@ namespace _PROJECT.Components.Drawing
sprayPart.Stop(true, ParticleSystemStopBehavior.StopEmitting);
_isSpraying = false;
_layerMask = 1 << LayerMask.NameToLayer("Paintable");
}
private void StartSpray()
@@ -74,7 +81,7 @@ namespace _PROJECT.Components.Drawing
{
if (_isSpraying)
{
spray_sound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(sprayPoint));
spray_sound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(sprayPoint)); //changing the attributes
}
if (!isSelected || !_isSpraying)
@@ -83,7 +90,6 @@ namespace _PROJECT.Components.Drawing
sprayPart.Stop(true, ParticleSystemStopBehavior.StopEmitting);
spray_sound.setParameterByName("SpraySwitcher", 1); //"NoSpray - 1 in FMOD"
spray_sound.release();
_isSpraying = false;
return;

View File

@@ -53,6 +53,7 @@ public class ElevatorOuter : MonoBehaviour
public void OpenDoors()
{
arrivalBeeper.Play();
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.ElevatorArrival, gameObject);
Debug.Log("Outer Doors opened");
StartCoroutine(MoveDoors(leftDoor, leftDoorOpenPos, rightDoor, rightDoorOpenPos, doorOpenTime));

View File

@@ -25,6 +25,7 @@ public class ContinuoslocomotionConfigurator : MonoBehaviour
private void enableLocomotion()
{
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Click, gameObject); //3d oneshot sound
locomotion.enabled = true;
turnOnButton.gameObject.SetActive(false);
turnOffButton.gameObject.SetActive(true);
@@ -32,6 +33,7 @@ public class ContinuoslocomotionConfigurator : MonoBehaviour
private void disableLocomotion()
{
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Click, gameObject); //3d oneshot sound
locomotion.enabled = false;
turnOnButton.gameObject.SetActive(true);
turnOffButton.gameObject.SetActive(false);

View File

@@ -23,6 +23,7 @@ public class HoverSlideButton : MonoBehaviour, IPointerEnterHandler, IPointerExi
public void OnPointerEnter(PointerEventData eventData)
{
SlideToPosition(onPosition);
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Hover, gameObject); //3d oneshot sound
}
public void OnPointerExit(PointerEventData eventData)

View File

@@ -6,6 +6,7 @@ using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.UI;
using UnityEngine.XR.Interaction.Toolkit;
using FMOD.Studio;
public class MenuTeleportButton : MonoBehaviour
{
@@ -20,6 +21,15 @@ public class MenuTeleportButton : MonoBehaviour
private Button button;
private TeleportLocation target; // Target teleport position
private EventInstance TeleportingSound;
private void Awake()
{
TeleportingSound = AudioManager.Instance.CreateInstance(FMODEvents.Instance.Teleport); //initialise the instance
}
void Start()
{
button = GetComponent<Button>();
@@ -49,6 +59,7 @@ public class MenuTeleportButton : MonoBehaviour
{
button.targetGraphic.GetComponent<Image>().sprite = HoverSprite;
}
}
public void SetStateDefault()
@@ -90,5 +101,7 @@ public class MenuTeleportButton : MonoBehaviour
// Refresh the button state
button.interactable = false;
button.interactable = true;
TeleportingSound.start(); //playing 2d oneshot
}
}

View File

@@ -56,6 +56,9 @@ public class Menu : MonoBehaviour
private float floor1LowerLimit = -5;
private bool activated = true;
private bool hasFloorButtonSoundInitialized = false;
private bool hasMapButtonSoundInitialized = false;
private void Awake()
@@ -84,17 +87,24 @@ public class Menu : MonoBehaviour
private void activateMapPanel()
{
if (hasMapButtonSoundInitialized) //if statement to check if the button sound instance was initiated in the beginning, thie applies to Map and Floor click sounds.
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Click, gameObject);
else
hasMapButtonSoundInitialized = true;
SetActiveTab(MenuTab.Map);
}
private void activateOptionsPanel()
{
SetActiveTab(MenuTab.Options);
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Click, gameObject); //3d oneshot sound
}
private void activateCreditsPanel()
{
SetActiveTab(MenuTab.Credits);
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Click, gameObject); //3d oneshot sound
}
private void SetActiveTab(MenuTab tab)
@@ -125,6 +135,8 @@ public class Menu : MonoBehaviour
// Toggle the menu visibility
setCanvasVisibility(!canvas.enabled);
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.MapOpen, gameObject);
}
public Transform updateMenuTransform()
@@ -154,6 +166,7 @@ public class Menu : MonoBehaviour
}
private void DisplayFloor1()
{
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Click, gameObject); //3d oneshot sound
//Debug.Log("Dispaling floor 1");
Floor1Panel.gameObject.SetActive(true);
Floor2Panel.gameObject.SetActive(false);
@@ -165,7 +178,14 @@ public class Menu : MonoBehaviour
buttonComponent.interactable = true;
}
private void DisplayFloor2()
{
{
if (hasFloorButtonSoundInitialized)
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Click, gameObject);
else
hasFloorButtonSoundInitialized = true;
//Debug.Log("Dispaling floor 2");
Floor1Panel.gameObject.SetActive(false);
Floor2Panel.gameObject.SetActive(true);

View File

@@ -1714,7 +1714,7 @@ RectTransform:
m_Children:
- {fileID: 1938936874169646409}
m_Father: {fileID: 0}
m_RootOrder: 33
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@@ -1792,21 +1792,20 @@ MonoBehaviour:
m_GameObject: {fileID: 8920648335286241163}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 891e12d2218566241a2acd395d5d3892, type: 3}
m_Script: {fileID: 11500000, guid: 1d73fa3572b1bcb498317047ac4154df, type: 3}
m_Name:
m_EditorClassIdentifier:
VRToggle: {fileID: 48284653022802127}
startPlayingButton: {fileID: 4409105029378525441}
reloadButton: {fileID: 3248072787155925101}
joinMultiplayerButton: {fileID: 7057699864170177475}
serverListContainer: {fileID: 1182580605524482518}
serverListItemPrefab: {fileID: 8155264290485183093, guid: 161eef8a6244baa46b0988be67d74a08,
type: 3}
serverListContainer: {fileID: 6604224998162932651}
serverListItemPrefab: {fileID: 8799561993934626415}
statusText: {fileID: 2762709333159616741}
quitButton: {fileID: 856744223094475457}
networkDiscovery: {fileID: 0}
uiCamera: {fileID: 0}
placeholderAudioListener: {fileID: 3623653364064856318}
placeholderAudioListener: {fileID: 0}
--- !u!81 &3623653364064856318
AudioListener:
m_ObjectHideFlags: 0

View File

@@ -2,12 +2,22 @@ using System.Collections;
using System.Collections.Generic;
using Unity.XR.CoreUtils;
using UnityEngine;
using FMOD.Studio;
public class SpaceEnterCollider : MonoBehaviour
{
public GameObject InstructionText;
private EventInstance PortalEntrance;
private void Awake()
{
PortalEntrance = AudioManager.Instance.CreateInstance(FMODEvents.Instance.PortalEnter);
}
private void OnTriggerEnter(Collider other)
{
XROrigin player = other.GetComponent<XROrigin>();
if (player == null) return;
@@ -30,7 +40,12 @@ public class SpaceEnterCollider : MonoBehaviour
{
playerGravity.isInSpace = true;
}
Debug.Log(other + " entered space.");
PortalEntrance.start();
}
private void OnTriggerExit(Collider other)
@@ -42,9 +57,13 @@ public class SpaceEnterCollider : MonoBehaviour
if (playerGravity != null)
{
StartCoroutine(DelayExit(playerGravity));
//playerGravity.AdjustGravity(new Quaternion()); // Set Gravity back to default
}
Debug.Log(other + " left space.");
PortalEntrance.start();
}
private IEnumerator DelayExit(GravityHandler playerGravity)

View File

@@ -70,7 +70,6 @@ public class StencilPortal : MonoBehaviour
matchOrientation = MatchOrientation.TargetUpAndForward
};
AudioManager.Instance.PlayOneShot3D(FMODEvents.Instance.PortalEnter, targetPosition);
teleportationProvider.QueueTeleportRequest(request);
@@ -96,8 +95,6 @@ public class StencilPortal : MonoBehaviour
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

@@ -12,42 +12,46 @@ public class AlarmTrigger : MonoBehaviour
public AudioSource AlarmSequence;
public AudioSource VentilationSequence;
private EventInstance RoomHum;
private EventInstance RoomHum;
private EventInstance AlarmSound;
private EventInstance ServerButton;
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));
RoomHum = AudioManager.Instance.CreateInstance(FMODEvents.Instance.ServerRoomHumming); //initialise the instance
RoomHum.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject)); //make it 3d
AlarmSound = AudioManager.Instance.CreateInstance(FMODEvents.Instance.ServerRoomAlarm); //initialise the instance
AlarmSound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject)); //make it 3d
}
void Start()
{
RoomHum.start();
//start playing the sound
if (PushButton != null)
{
PushButton.onPress.AddListener(OnButtonPressed);
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.ServerRoomButton, gameObject);
}
}
void OnButtonPressed()
{
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.ServerRoomButton, gameObject); //3d oneshot instance
Debug.Log("Alarm button Pressed!");
if (!AudioManager.IsPlaying(AlarmSound)){ //if alarm isn't already triggered.
VentilationSequence.Stop();
AlarmSequence.Play();
AlarmSound.start();
AudioManager.Instance.StopInstance(RoomHum, STOP_MODE.ALLOWFADEOUT);
AlarmSound.start(); //start playing the sound
RoomHum.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); //stop playing the sound
hasAlarm = true;
}
}

View File

@@ -65,11 +65,11 @@ MonoBehaviour:
m_GameObject: {fileID: 876842842715561968}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 98cc0a7a6d6d7314c8e390e45a9e1483, type: 3}
m_Script: {fileID: 11500000, guid: eec8a9cc39cfe9c4a99a2b3cfef89628, type: 3}
m_Name:
m_EditorClassIdentifier:
secret: deltavr
port: 1
port: 2
discoveryInterval: 0
automatic: 0
--- !u!114 &3580593382982171501
@@ -81,7 +81,7 @@ MonoBehaviour:
m_GameObject: {fileID: 876842842715561968}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 846c98250226ef949b5c0c499e9334da, type: 3}
m_Script: {fileID: 11500000, guid: 3d1d3aad6cea63b43bf2b8374073066f, type: 3}
m_Name:
m_EditorClassIdentifier:
networkDiscovery: {fileID: 4784684551416650039}

View File

@@ -73,5 +73,46 @@ PrefabInstance:
- {fileID: 65702495048144492, guid: b3d89325bbec0ea45971ae56eceb6a19, type: 3}
- {fileID: -8700617353114198275, guid: b3d89325bbec0ea45971ae56eceb6a19, type: 3}
m_AddedGameObjects: []
m_AddedComponents: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: b3d89325bbec0ea45971ae56eceb6a19,
type: 3}
insertIndex: -1
addedObject: {fileID: 6207385351492341968}
m_SourcePrefab: {fileID: 100100000, guid: b3d89325bbec0ea45971ae56eceb6a19, type: 3}
--- !u!1 &9183735049506620104 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: b3d89325bbec0ea45971ae56eceb6a19,
type: 3}
m_PrefabInstance: {fileID: 8336804541285056409}
m_PrefabAsset: {fileID: 0}
--- !u!114 &6207385351492341968
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9183735049506620104}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9a6610d2e704f1648819acc8d7460285, type: 3}
m_Name:
m_EditorClassIdentifier:
CollisionTag:
EventReference:
Guid:
Data1: -1738058147
Data2: 1087328963
Data3: 1077989513
Data4: -494122575
Path: event:/Ambiences/Robots/Jackal
Event:
EventPlayTrigger: 1
EventStopTrigger: 0
AllowFadeout: 1
TriggerOnce: 0
Preload: 0
NonRigidbodyVelocity: 0
Params: []
OverrideAttenuation: 0
OverrideMinDistance: 1
OverrideMaxDistance: 5

File diff suppressed because it is too large Load Diff

View File

@@ -158,6 +158,7 @@ public class AudioManager : MonoBehaviour
EventInstance instance = RuntimeManager.CreateInstance(sound);
RuntimeManager.AttachInstanceToGameObject(instance, go);
instance.start();
// instance.release();
eventInstances.Add(instance);
return instance;
@@ -168,7 +169,6 @@ public class AudioManager : MonoBehaviour
if (!instance.isValid()) return;
instance.stop(mode);
instance.release();
eventInstances.Remove(instance);
}
public void SetParameter(EventInstance instance, string parameterName, float value)
@@ -177,6 +177,11 @@ public class AudioManager : MonoBehaviour
instance.setParameterByName(parameterName, value);
}
public void SetGlobalParameter(string parameterName, float value)
{
RuntimeManager.StudioSystem.setParameterByName(parameterName, value);
}
public void InitializeMusic(EventReference musicEventReference)
{
if (musicEventReference.Guid == nullGuid)

View File

@@ -44,6 +44,9 @@ public class FMODEvents : MonoBehaviour
[field: SerializeField] public EventReference ServerRoomHumming { get; private set; }
[field: SerializeField] public EventReference ServerRoomRackHum { get; private set; }
[field: SerializeField] public EventReference Jackal { get; private set; }
[field: SerializeField] public EventReference Robotont { get; private set; }
public static FMODEvents Instance { get; private set; }