diff --git a/Assets/Scripts/Platform.cs b/Assets/Scripts/Platform.cs index 9e386ef..195e6bf 100644 --- a/Assets/Scripts/Platform.cs +++ b/Assets/Scripts/Platform.cs @@ -6,6 +6,8 @@ namespace Unity.Multiplayer.Samples.BossRoom [RequireComponent(typeof(Collider))] public class Platform : MonoBehaviour { + + public int PlatformID { get; private set; } public bool IsOccupied => Occupier != null; public ServerCharacter Occupier { get; private set; } @@ -21,6 +23,16 @@ namespace Unity.Multiplayer.Samples.BossRoom } } + /// + /// Sets the unique ID for the platform. + /// + /// The unique ID to assign. + public void AssignID(int id) + { + PlatformID = id; + Debug.Log($"Platform {name} assigned ID: {PlatformID}"); + } + /// /// Marks this platform as occupied by a specific player. /// diff --git a/Assets/Scripts/PlatformManager.cs b/Assets/Scripts/PlatformManager.cs index b754ca1..0e7d1a5 100644 --- a/Assets/Scripts/PlatformManager.cs +++ b/Assets/Scripts/PlatformManager.cs @@ -12,6 +12,13 @@ namespace Unity.Multiplayer.Samples.BossRoom private void Start() { m_Platforms = GetComponentsInChildren().ToList(); + // Assign unique IDs to each platform + for (int i = 0; i < m_Platforms.Count; i++) + { + m_Platforms[i].AssignID(i + 1); // IDs start from 1 + } + + Debug.Log("All platforms have been assigned unique IDs."); } ///