From 2315d2241ec8a09a46d5801d39ee3ab261f400dd Mon Sep 17 00:00:00 2001 From: Sveske Juice Date: Tue, 27 Feb 2024 20:37:15 +0100 Subject: [PATCH] Spawn rope --- Assets/Scripts/Rope/Project.Scripts.Rope.asmdef | 3 ++- Assets/Scripts/Rope/RopeSimulator.cs | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Rope/Project.Scripts.Rope.asmdef b/Assets/Scripts/Rope/Project.Scripts.Rope.asmdef index ff1e458..b00a2d7 100644 --- a/Assets/Scripts/Rope/Project.Scripts.Rope.asmdef +++ b/Assets/Scripts/Rope/Project.Scripts.Rope.asmdef @@ -5,7 +5,8 @@ "GUID:75469ad4d38634e559750d17036d5f7c", "GUID:6055be8ebefd69e48b49212b09b47b2f", "GUID:f4c364e1215051e4dbc6c0bc8fb49793", - "GUID:ddd4dba7c768b564a879069c52854fc5" + "GUID:ddd4dba7c768b564a879069c52854fc5", + "GUID:c0e1b40f519e6e84b8f4af9930403ecb" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Assets/Scripts/Rope/RopeSimulator.cs b/Assets/Scripts/Rope/RopeSimulator.cs index 6cca4bb..728612e 100644 --- a/Assets/Scripts/Rope/RopeSimulator.cs +++ b/Assets/Scripts/Rope/RopeSimulator.cs @@ -106,6 +106,15 @@ public class RopeSimulator : MonoBehaviour // Build rope if rope joints specified in inspector if (IsInitialized) BuildRope(start, end); + + GameManager.OnPlayersReady += PlayersReady; + } + + public void PlayersReady(GameObject[] players) + { + if (IsInitialized) return; + + BuildRope(players[0].GetComponent(), players[1].GetComponent()); } public void BuildRope(RopeJoint start, RopeJoint end)