glass layer occlusion, previous event occlusion changes, locomotaion steps change, ui hovers (for some reason currently play when a new location is set)

This commit is contained in:
Timur Nizamov 2025-11-11 21:18:49 +02:00
parent 02f640218c
commit e12c5f2f98
18 changed files with 5357 additions and 5400 deletions

View File

@ -27,7 +27,7 @@ PluginImporter:
- first:
Standalone: Win64
second:
enabled: 1
enabled: 0
settings: {}
userData:
assetBundleName:

View File

@ -1,3 +1,4 @@
using FishNet.Object;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -9,7 +10,7 @@ public enum ElevatorMoveState
Decending
}
public class ElevatorStatusPlate : MonoBehaviour
public class ElevatorStatusPlate : NetworkBehaviour
{
[System.Serializable]
public struct FloorNumbers

View File

@ -1,4 +1,5 @@
using _PROJECT.NewHandPresence;
using FishNet.Object;
using System.Collections;
using System.Collections.Generic;
using Unity.XR.CoreUtils;
@ -14,7 +15,7 @@ public enum ElevatorState
}
public class ElevatorBox : MonoBehaviour
public class ElevatorBox : NetworkBehaviour
{
public List<ElevatorOuter> callers = new List<ElevatorOuter>();
@ -129,8 +130,10 @@ public class ElevatorBox : MonoBehaviour
}
private void OnTriggerEnter(Collider other)
{
XROrigin enteredPlayerVR = other.GetComponent<XROrigin>();
KbmController enteredPlayerKbm = other.GetComponent<KbmController>();
XRPlayerMirror networkPlayerDisplay = other.GetComponentInParent<XRPlayerMirror>();
Debug.Log("Player Entered box");
if (enteredPlayerVR != null)
@ -141,11 +144,19 @@ public class ElevatorBox : MonoBehaviour
{
enteredPlayerKbm.transform.SetParent(this.transform);
}
else
else if (networkPlayerDisplay != null)
{
//don't do any parenting but don't halt the function
}
else {
Debug.Log(other + " Cannot ride in lifts.");
return;
}
Debug.Log("Calling Lift transfer sequence");
switch (targetFloor)
switch (targetFloor)
{
case int f when f == floors[0].floorNumber:
targetFloor = floors[1].floorNumber;
@ -158,7 +169,7 @@ public class ElevatorBox : MonoBehaviour
default:
break;
}
StartCoroutine(LiftTransferSequence());
}
@ -169,6 +180,8 @@ public class ElevatorBox : MonoBehaviour
// Was it a player, that exited?
XROrigin exitedPlayerVR = other.GetComponent<XROrigin>();
KbmController exitedPlayerKbm = other.GetComponent<KbmController>();
XRPlayerMirror networkPlayerDisplay = other.GetComponentInParent<XRPlayerMirror>();
if (exitedPlayerVR != null)
{
removeChild(exitedPlayerVR);
@ -177,6 +190,10 @@ public class ElevatorBox : MonoBehaviour
{
exitedPlayerKbm.transform.SetParent(null);
}
else if (networkPlayerDisplay != null)
{
//don't do any parenting but don't halt the function
}
else
return;
@ -263,6 +280,7 @@ public class ElevatorBox : MonoBehaviour
private IEnumerator LiftTransferSequence()
{
Debug.Log("Started Lidt transfer sequence");
yield return StartCoroutine(CloseDoors());
yield return StartCoroutine(MoveToFloor(targetFloor));
}
@ -295,7 +313,7 @@ public class ElevatorBox : MonoBehaviour
private IEnumerator CloseDoors()
{
//if (state == ElevatorState.AwaitingPassengers) {
//Debug.Log("Closing doors");
Debug.Log("Closing doors");
if (Vector3.Distance(leftDoor.transform.position, leftDoorClosedPos.position) < 0.01f)
yield break;

View File

@ -1,9 +1,10 @@
using FishNet.Object;
using System.Collections;
using System.Collections.Generic;
using Unity.XR.CoreUtils;
using UnityEngine;
public class ElevatorOuter : MonoBehaviour
public class ElevatorOuter : NetworkBehaviour
{
public ElevatorBox box;
@ -32,7 +33,7 @@ public class ElevatorOuter : MonoBehaviour
private void OnTriggerEnter(Collider other)
{
Debug.Log("Something entered call area");
if (other.GetComponent<XROrigin>() == null && other.GetComponent<KbmController>() == null) return;
if (other.GetComponentInParent<XRPlayerMirror>() == null) return;
StartCoroutine(box.callElevator(floor));
Debug.Log("Player entered call area");
}
@ -40,7 +41,7 @@ public class ElevatorOuter : MonoBehaviour
private void OnTriggerExit(Collider other)
{
Debug.Log("Something entered call area");
if (other.GetComponent<XROrigin>() == null && other.GetComponent<KbmController>() == null) return;
if (other.GetComponentInParent<XRPlayerMirror>() == null) return;
box.interestExpired();
Debug.Log("Player exited call area");
}

View File

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -10,34 +11,38 @@ public class ContinuoslocomotionConfigurator : MonoBehaviour
public Button turnOnButton;
public ContinuousMoveProviderBase locomotion;
// Events for listeners
public event Action<bool> OnLocomotionToggled; // true = enabled, false = disabled
public event Action<float> OnSpeedChanged; // sends new speed
// Start is called before the first frame update
void Start()
{
turnOnButton.onClick.AddListener(enableLocomotion);
turnOffButton.onClick.AddListener(disableLocomotion);
turnOffButton.gameObject.SetActive(false); // off by default
turnOffButton.gameObject.SetActive(false);
}
public void UpdateSpeed(float speed)
{
locomotion.moveSpeed = speed;
OnSpeedChanged?.Invoke(speed);
}
private void enableLocomotion()
{
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Click, gameObject); //3d oneshot sound
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Click, gameObject);
locomotion.enabled = true;
turnOnButton.gameObject.SetActive(false);
turnOffButton.gameObject.SetActive(true);
OnLocomotionToggled?.Invoke(true);
}
private void disableLocomotion()
{
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Click, gameObject); //3d oneshot sound
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Click, gameObject);
locomotion.enabled = false;
turnOnButton.gameObject.SetActive(true);
turnOffButton.gameObject.SetActive(false);
OnLocomotionToggled?.Invoke(false);
}
}

View File

@ -58,6 +58,7 @@ public class MenuTeleportButton : MonoBehaviour
public void SetStateSelected()
{
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Hover, gameObject);
if (button != null && HoverSprite != null)
{
button.targetGraphic.GetComponent<Image>().sprite = HoverSprite;

View File

@ -7,20 +7,24 @@ public class TutorialAudioListener : MonoBehaviour
{
[Header("References")]
[SerializeField] private TutorialController tutorialController;
[SerializeField] private ContinuoslocomotionConfigurator locomotionConfigurator;
private InputAction moveAction;
private InputAction turnAction;
private TeleportationProvider teleportationProvider;
private float lastStepTime;
[SerializeField] private float stepCooldown = 0.5f; // seconds between steps
[SerializeField] private float baseStepCooldown = 0.5f; // base interval at speed = 1
private float stepCooldown;
private bool locomotionEnabled = false;
private void Awake()
{
if (tutorialController == null)
{
tutorialController = FindObjectOfType<TutorialController>();
}
if (locomotionConfigurator == null)
locomotionConfigurator = FindObjectOfType<ContinuoslocomotionConfigurator>();
if (tutorialController != null)
{
@ -28,10 +32,8 @@ public class TutorialAudioListener : MonoBehaviour
turnAction = tutorialController.turnProvider.rightHandSnapTurnAction.action;
teleportationProvider = tutorialController.teleportProvider;
}
else
{
//Debug.LogError("[TutorialAudioListener] No TutorialController found!");
}
stepCooldown = baseStepCooldown;
}
private void OnEnable()
@ -44,6 +46,12 @@ public class TutorialAudioListener : MonoBehaviour
if (teleportationProvider != null)
teleportationProvider.endLocomotion += OnTeleportEnd;
if (locomotionConfigurator != null)
{
locomotionConfigurator.OnLocomotionToggled += HandleLocomotionToggled;
locomotionConfigurator.OnSpeedChanged += HandleSpeedChanged;
}
}
private void OnDisable()
@ -56,31 +64,52 @@ public class TutorialAudioListener : MonoBehaviour
if (teleportationProvider != null)
teleportationProvider.endLocomotion -= OnTeleportEnd;
if (locomotionConfigurator != null)
{
locomotionConfigurator.OnLocomotionToggled -= HandleLocomotionToggled;
locomotionConfigurator.OnSpeedChanged -= HandleSpeedChanged;
}
}
private void HandleLocomotionToggled(bool enabled)
{
locomotionEnabled = enabled;
Debug.Log($"[TutorialAudioListener] Locomotion toggled: {enabled}");
}
private void HandleSpeedChanged(float newSpeed)
{
// Invert proportionality: faster speed = shorter step interval
float calculatedCooldown = baseStepCooldown / Mathf.Max(newSpeed, 0.01f);
// Clamp the result between 0.4 and 0.6 seconds
stepCooldown = Mathf.Clamp(calculatedCooldown, 0.3f, 0.69f);
Debug.Log($"[TutorialAudioListener] Step cooldown adjusted: {stepCooldown}");
}
private void OnMovePerformed(InputAction.CallbackContext context)
{
// Only play a sound if enough time has passed since the last one
if (!locomotionEnabled)
return;
if (Time.time - lastStepTime < stepCooldown)
return;
lastStepTime = Time.time;
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.StepOverall, gameObject);
}
private void OnTurnPerformed(InputAction.CallbackContext context)
{
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.StepSpin, gameObject);
//Debug.Log("[TutorialAudioListener] Turn sound played.");
}
private void OnTeleportEnd(LocomotionSystem locomotionSystem)
{
//TeleportationListen plays the required sound. To play it here, unattach the TeleportationListen.cs script.
//AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Steps, gameObject);
//Debug.Log("[TutorialAudioListener] Teleport sound played.");
// Optional: Uncomment if teleport should play sound
// AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Steps, gameObject);
}
}

View File

@ -1803,7 +1803,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0be1f6fa249e2b74d80c57af214b930d, type: 3}
m_Name:
m_EditorClassIdentifier:
VRToggle: {fileID: 0}
VRToggle: {fileID: 48284653022802127}
startPlayingButton: {fileID: 4409105029378525441}
reloadButton: {fileID: 3248072787155925101}
joinMultiplayerButton: {fileID: 7057699864170177475}

View File

@ -52,7 +52,7 @@ MonoBehaviour:
_componentIndexCache: 0
_addedNetworkObject: {fileID: 4318509465820511600}
_networkObjectCache: {fileID: 4318509465820511600}
vrPlayerPrefab: {fileID: 916340287994646858, guid: a82c8ed92875c7d4185d79d68468bfab,
vrPlayerPrefab: {fileID: 3865165877314776266, guid: a82c8ed92875c7d4185d79d68468bfab,
type: 3}
kbmPlayerPrefab: {fileID: 8146527781413792986, guid: b0c478e5f07e4ab47af03d6f29f1302a,
type: 3}
@ -89,7 +89,7 @@ MonoBehaviour:
_initializeOrder: 0
_defaultDespawnType: 0
NetworkObserver: {fileID: 0}
<PrefabId>k__BackingField: 8
<PrefabId>k__BackingField: 14
<SpawnableCollectionId>k__BackingField: 0
_scenePathHash: 0
<SceneId>k__BackingField: 0

View File

@ -21,10 +21,11 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Glass
m_Shader: {fileID: 4800000, guid: 0ca6dca7396eb48e5849247ffd444914, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_Parent: {fileID: 2100000, guid: 7efb69e5b363bbe40a1d72d54f4af636, type: 2}
m_ModifiedSerializedProperties: 26
m_ValidKeywords:
- _ALPHAPREMULTIPLY_ON
- _SURFACE_TYPE_TRANSPARENT
m_InvalidKeywords: []
m_LightmapFlags: 4
@ -39,99 +40,23 @@ Material:
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_TexEnvs: []
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BlendOp: 0
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 0
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _DstBlendAlpha: 10
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 5
- _SrcBlendAlpha: 1
- _SrcBlend: 1
- _Surface: 1
- _WorkflowMode: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 0.5294118, g: 0.5647059, b: 0.57254905, a: 0.29411766}
- _Color: {r: 0.5294118, g: 0.5647059, b: 0.57254905, a: 0.29411766}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []

Binary file not shown.

View File

@ -35,7 +35,7 @@ public class FirstPersonOcclusion : MonoBehaviour
// 1. Event Instance Creation
AudioOccluded = RuntimeManager.CreateInstance(SelectAudio);
Debug.Log($"Created FMOD Event Instance for: {SelectAudio.Path}");
//Debug.Log($"Created FMOD Event Instance for: {SelectAudio.Path}");
// 2. Attaching Instance
RuntimeManager.AttachInstanceToGameObject(AudioOccluded, gameObject);

Binary file not shown.

View File

@ -69,7 +69,7 @@
</object>
<object class="EventAutomatableProperties" id="{c76e816d-57c8-456c-a329-17eb0603d09f}">
<property name="maximumDistance">
<value>25</value>
<value>60</value>
</property>
</object>
<object class="MarkerTrack" id="{59eaef25-4ee8-45f7-92cb-43f884ffe19f}" />
@ -260,7 +260,7 @@
<relationship name="automationPoints">
<destination>{28889613-50cf-4fde-aec0-797afb57e1cb}</destination>
<destination>{69fd0e03-1869-4e39-9d2d-082b30cd863b}</destination>
<destination>{28f68ef3-2849-46a0-a56e-709811853493}</destination>
<destination>{50c8ed2a-a7f5-474d-bb5e-242ed4771c16}</destination>
</relationship>
</object>
<object class="MultibandEqEffect" id="{1b59e476-ff30-46fa-be6f-43a65cbf5b64}">
@ -331,12 +331,12 @@
<value>-15</value>
</property>
</object>
<object class="AutomationPoint" id="{28f68ef3-2849-46a0-a56e-709811853493}">
<object class="AutomationPoint" id="{50c8ed2a-a7f5-474d-bb5e-242ed4771c16}">
<property name="position">
<value>0.74973089343379973</value>
<value>0.64962325080731964</value>
</property>
<property name="value">
<value>-4</value>
<value>-3.46837234</value>
</property>
</object>
<object class="Automator" id="{f24ecb42-679a-4dd2-9d99-fd6d472bd1ef}">
@ -355,6 +355,7 @@
<destination>{a95234b9-f8dd-4043-8669-67d290c6fb26}</destination>
<destination>{c22d4e22-49ba-4f40-b2ef-ddc8dd15ce81}</destination>
<destination>{56dbb96b-e49d-4a8b-a678-97662e9bd824}</destination>
<destination>{b067664e-d331-4b79-ad33-4c978d17920a}</destination>
</relationship>
</object>
<object class="AutomationPoint" id="{a95234b9-f8dd-4043-8669-67d290c6fb26}">
@ -373,15 +374,23 @@
<value>1</value>
</property>
<property name="value">
<value>70</value>
<value>65</value>
</property>
</object>
<object class="AutomationPoint" id="{56dbb96b-e49d-4a8b-a678-97662e9bd824}">
<property name="position">
<value>0.74973088685257405</value>
<value>0.65000000000000002</value>
</property>
<property name="value">
<value>378.560303</value>
<value>70</value>
</property>
</object>
<object class="AutomationPoint" id="{b067664e-d331-4b79-ad33-4c978d17920a}">
<property name="position">
<value>0.35999999999999999</value>
</property>
<property name="value">
<value>2600</value>
</property>
</object>
</objects>

View File

@ -16,6 +16,10 @@
"name": "frtyyQx",
"score": 447.0
},
{
"name": "terrrffgggjh",
"score": 431.0
},
{
"name": "rry",
"score": 428.0