Compare commits

...

2 Commits

Author SHA1 Message Date
f940378cb6 fixing merge issue 2025-11-11 17:07:32 +02:00
c71e260afc modified elevator to try make it work in multiplayer. Still has sync problems. 2025-11-11 17:03:45 +02:00
10 changed files with 1428 additions and 1432 deletions

4
.gitignore vendored
View File

@@ -99,7 +99,7 @@ Recordings/
# If the source bank files are kept outside of the StreamingAssets folder then these can be ignored.
# Log files can be ignored.
fmod_editor.log
NetrworkManagerUI.prefab
NetrworkManagerUI.prefab.meta
Assets/_PROJECT/Components/Overlay UI/NetworkManagerUI.prefab
Assets/_PROJECT/Components/Overlay UI/NetrworkManagerUI.prefab.meta
CustomNetworkManager.prefab
CustomNetworkManager.prefab.meta

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

@@ -55,7 +55,7 @@ namespace _PROJECT.NewHandPresence
var devices = new List<InputDevice>();
InputDevices.GetDevicesWithCharacteristics(controllerCharacteristics, devices);
Debug.Log("Found devices: " + devices.Count);
//Debug.Log("Found devices: " + devices.Count);
if (devices.Count <= 0) return;

View File

@@ -1458,8 +1458,8 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4219249119743129064}
- {fileID: 3078516333947655590}
- {fileID: 2833299236575698182}
- {fileID: 3078516333947655590}
m_Father: {fileID: 1938936874169646409}
m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -1692,7 +1692,6 @@ GameObject:
- component: {fileID: 150987804393607111}
- component: {fileID: 2849620166313326850}
- component: {fileID: 3623653364064856318}
- component: {fileID: 6605356447225771655}
m_Layer: 0
m_Name: NetworkManagerUI
m_TagString: Untagged
@@ -1791,29 +1790,6 @@ AudioListener:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8920648335286241163}
m_Enabled: 1
--- !u!114 &6605356447225771655
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8920648335286241163}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0be1f6fa249e2b74d80c57af214b930d, type: 3}
m_Name:
m_EditorClassIdentifier:
VRToggle: {fileID: 0}
startPlayingButton: {fileID: 4409105029378525441}
reloadButton: {fileID: 3248072787155925101}
joinMultiplayerButton: {fileID: 7057699864170177475}
serverListContainer: {fileID: 6604224998162932651}
IPButton: {fileID: 8799561993934626415}
statusText: {fileID: 2762709333159616741}
quitButton: {fileID: 856744223094475457}
networkDiscovery: {fileID: 0}
uiCamera: {fileID: 0}
placeholderAudioListener: {fileID: 0}
--- !u!1 &8930421849167053048
GameObject:
m_ObjectHideFlags: 0

BIN
Build.zip LFS

Binary file not shown.