Rope now connects on join

This commit is contained in:
BOT Alex 2024-02-28 14:50:14 +01:00
parent 8a4a50bd67
commit 792b5407d2
2 changed files with 16 additions and 8 deletions

View File

@ -35,11 +35,10 @@ public class NetworkedGameSetup : NetworkBehaviour
bool isServer = SteamManager.IsServer || LocalManager.IsServer; bool isServer = SteamManager.IsServer || LocalManager.IsServer;
GameObject[] players; GameObject[] players;
players = SpawnPlayers(playerIds); if (isServer)
//if (isServer) players = SpawnPlayers(playerIds);
// players = SpawnPlayers(playerIds); else
//else players = GetPlayers(playerIds);
// players = GetPlayers(playerIds);
//StartCoroutine(LateSetupProcedue(players)); //StartCoroutine(LateSetupProcedue(players));
} }

View File

@ -74,7 +74,7 @@ public class RopeSimulator : MonoBehaviour
public static RopeSimulator instance; public static RopeSimulator instance;
private bool IsInitialized => start == null || end == null; private bool IsInitialized => !(start == null || end == null);
private void Awake() private void Awake()
{ {
@ -88,7 +88,7 @@ public class RopeSimulator : MonoBehaviour
} }
} }
private void Start() private void OnEnable()
{ {
// Example of using rope builder // Example of using rope builder
//rope = new RopeBuilder() //rope = new RopeBuilder()
@ -240,6 +240,13 @@ public class RopeSimulator : MonoBehaviour
private void RebuildRopeColliders() private void RebuildRopeColliders()
{ {
// Benjamin forgor... to assign
if (ropeCollidersParent == null)
{
var holder = new GameObject("RopeHolder");
ropeCollidersParent = holder.transform;
}
for (int i = 0; i < ropeCollidersParent.childCount; i++) for (int i = 0; i < ropeCollidersParent.childCount; i++)
{ {
Destroy(ropeCollidersParent.GetChild(i)); Destroy(ropeCollidersParent.GetChild(i));
@ -263,7 +270,7 @@ public class RopeSimulator : MonoBehaviour
private void Update() private void Update()
{ {
if (IsInitialized) if (!IsInitialized)
return; return;
colliderToSquezeForce.Clear(); colliderToSquezeForce.Clear();
@ -375,6 +382,8 @@ public class RopeSimulator : MonoBehaviour
private void OnDrawGizmos() private void OnDrawGizmos()
{ {
return;
if (IsInitialized) return; if (IsInitialized) return;
if (!Application.isPlaying) return; if (!Application.isPlaying) return;