fix: two audioListener fix

This commit is contained in:
Константин Адер 2024-12-09 13:47:24 +03:00
parent 2086bb48fb
commit c4d1fc5f0c

View File

@ -10,6 +10,7 @@ public class Trooper : RobotController
{ {
characterController = GetComponent<CharacterController>(); characterController = GetComponent<CharacterController>();
playerInput = GetComponent<PlayerInput>(); playerInput = GetComponent<PlayerInput>();
audioListener = GetComponentInChildren<AudioListener>();
} }
// PlayerInput Events // PlayerInput Events
@ -37,6 +38,7 @@ public class Trooper : RobotController
playerInput.enabled = IsOwner; playerInput.enabled = IsOwner;
characterController.enabled = IsOwner; characterController.enabled = IsOwner;
mainCam.enabled = IsOwner; mainCam.enabled = IsOwner;
audioListener.enabled = IsOwner;
Debug.Log($"NetworkObject ID: {NetworkObjectId} spawned with OwnerClientId: {OwnerClientId}"); Debug.Log($"NetworkObject ID: {NetworkObjectId} spawned with OwnerClientId: {OwnerClientId}");
} }
@ -48,6 +50,7 @@ public class Trooper : RobotController
playerInput.enabled = false; playerInput.enabled = false;
characterController.enabled = false; characterController.enabled = false;
mainCam.enabled = false; mainCam.enabled = false;
audioListener.enabled = false;
Debug.Log($"NetworkObject ID: {NetworkObjectId} despawned"); Debug.Log($"NetworkObject ID: {NetworkObjectId} despawned");
} }