From 36ad72556bd6a0e7c3d05b3c829b0284344bae4e Mon Sep 17 00:00:00 2001 From: Hazim Bin Ijaz Date: Fri, 14 Feb 2025 20:55:21 +0500 Subject: [PATCH] Fixed the platform issue --- Assets/Scenes/BossRoom/DungeonEntrance.unity | 473 +++++++++---------- Assets/Scripts/Gameplay/Platform.cs | 10 + Assets/Scripts/Gameplay/PlatformManager.cs | 460 ++++-------------- 3 files changed, 332 insertions(+), 611 deletions(-) diff --git a/Assets/Scenes/BossRoom/DungeonEntrance.unity b/Assets/Scenes/BossRoom/DungeonEntrance.unity index aefed0d..2b5489e 100644 --- a/Assets/Scenes/BossRoom/DungeonEntrance.unity +++ b/Assets/Scenes/BossRoom/DungeonEntrance.unity @@ -148,12 +148,12 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 23828395} serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.54, y: 2.71, z: 7.22} - m_LocalScale: {x: 2.7692316, y: 2.7692316, z: 2.7692316} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.25502622, y: 0, z: 0.025332922} + m_LocalScale: {x: 14.6520195, y: 14.6520195, z: 14.6520195} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 286165427} + m_Father: {fileID: 5195700795859028913} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!208 &23828397 NavMeshObstacle: @@ -165,10 +165,10 @@ NavMeshObstacle: m_Enabled: 1 serializedVersion: 3 m_Shape: 0 - m_Extents: {x: 0.5, y: 1, z: 0.5} - m_MoveThreshold: 0.1 + m_Extents: {x: 0.5, y: 0.00001, z: 0.5} + m_MoveThreshold: 0.01 m_Carve: 1 - m_CarveOnlyStationary: 1 + m_CarveOnlyStationary: 0 m_Center: {x: 0, y: 0, z: 0} m_TimeToStationary: 0.5 --- !u!1001 &226924656 @@ -349,13 +349,6 @@ Transform: - {fileID: 249976107358570836} - {fileID: 5590359088119101749} - {fileID: 1202519841281415540} - - {fileID: 1727201761} - - {fileID: 1006116860} - - {fileID: 477647223} - - {fileID: 1889561964} - - {fileID: 23828396} - - {fileID: 586197737} - - {fileID: 1799421584} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &286165428 @@ -557,12 +550,12 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 477647222} serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 2.98, y: 2.71, z: -3.33} - m_LocalScale: {x: 2.7692316, y: 2.7692316, z: 2.7692316} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.010582506, y: 0, z: 0.07189519} + m_LocalScale: {x: 14.6520195, y: 14.6520195, z: 14.6520195} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 286165427} + m_Father: {fileID: 6996768595326639848} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!208 &477647224 NavMeshObstacle: @@ -574,10 +567,10 @@ NavMeshObstacle: m_Enabled: 1 serializedVersion: 3 m_Shape: 0 - m_Extents: {x: 0.5, y: 0.5, z: 0.5} - m_MoveThreshold: 0.1 + m_Extents: {x: 0.5, y: 0.00001, z: 0.5} + m_MoveThreshold: 0.01 m_Carve: 1 - m_CarveOnlyStationary: 1 + m_CarveOnlyStationary: 0 m_Center: {x: 0, y: 0, z: 0} m_TimeToStationary: 0.5 --- !u!1 &586197736 @@ -605,12 +598,12 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 586197736} serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 4.91, y: 2.71, z: 5.21} - m_LocalScale: {x: 2.7692316, y: 2.7692316, z: 2.7692316} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.39041612} + m_LocalScale: {x: 14.6520195, y: 14.6520195, z: 14.6520195} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 286165427} + m_Father: {fileID: 249976107358570836} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!208 &586197738 NavMeshObstacle: @@ -622,10 +615,10 @@ NavMeshObstacle: m_Enabled: 1 serializedVersion: 3 m_Shape: 0 - m_Extents: {x: 0.5, y: 0.5, z: 0.5} - m_MoveThreshold: 0.1 + m_Extents: {x: 0.5, y: 0.00001, z: 0.5} + m_MoveThreshold: 0.01 m_Carve: 1 - m_CarveOnlyStationary: 1 + m_CarveOnlyStationary: 0 m_Center: {x: 0, y: 0, z: 0} m_TimeToStationary: 0.5 --- !u!1001 &652972894 @@ -909,12 +902,12 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1006116859} serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -3.8, y: 2.71, z: 5.05} - m_LocalScale: {x: 2.7692316, y: 2.7692316, z: 2.7692316} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.017991142, y: 0, z: 0.077187076} + m_LocalScale: {x: 14.6520195, y: 14.6520195, z: 14.6520195} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 286165427} + m_Father: {fileID: 1326862948614608678} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!208 &1006116861 NavMeshObstacle: @@ -926,10 +919,10 @@ NavMeshObstacle: m_Enabled: 1 serializedVersion: 3 m_Shape: 0 - m_Extents: {x: 0.5, y: 0.5, z: 0.5} - m_MoveThreshold: 0.1 + m_Extents: {x: 0.5, y: 0.00001, z: 0.5} + m_MoveThreshold: 0.01 m_Carve: 1 - m_CarveOnlyStationary: 1 + m_CarveOnlyStationary: 0 m_Center: {x: 0, y: 0, z: 0} m_TimeToStationary: 0.5 --- !u!1001 &1123007378 @@ -1615,12 +1608,12 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1727201760} serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -1.8154, y: 2.71, z: -3.2554} - m_LocalScale: {x: 2.7692316, y: 2.7692316, z: 2.7692316} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.08253825, y: 0, z: 0.022160314} + m_LocalScale: {x: 14.6520195, y: 14.6520195, z: 14.6520195} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 286165427} + m_Father: {fileID: 3169561862507413951} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!208 &1727201762 NavMeshObstacle: @@ -1632,10 +1625,10 @@ NavMeshObstacle: m_Enabled: 1 serializedVersion: 3 m_Shape: 0 - m_Extents: {x: 0.5, y: 0.5, z: 0.5} - m_MoveThreshold: 0.1 + m_Extents: {x: 0.5, y: 0.00001, z: 0.5} + m_MoveThreshold: 0.01 m_Carve: 1 - m_CarveOnlyStationary: 1 + m_CarveOnlyStationary: 0 m_Center: {x: 0, y: 0, z: 0} m_TimeToStationary: 0.5 --- !u!1 &1799421583 @@ -1663,12 +1656,12 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1799421583} serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 6, y: 2.71, z: 0.37} - m_LocalScale: {x: 2.7692316, y: 2.7692316, z: 2.7692316} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.12275152, y: 0, z: 0.026391929} + m_LocalScale: {x: 14.6520195, y: 14.6520195, z: 14.6520195} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 286165427} + m_Father: {fileID: 5590359088119101749} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!208 &1799421585 NavMeshObstacle: @@ -1680,10 +1673,10 @@ NavMeshObstacle: m_Enabled: 1 serializedVersion: 3 m_Shape: 0 - m_Extents: {x: 0.5, y: 0.5, z: 0.5} - m_MoveThreshold: 0.1 + m_Extents: {x: 0.5, y: 0.00001, z: 0.5} + m_MoveThreshold: 0.01 m_Carve: 1 - m_CarveOnlyStationary: 1 + m_CarveOnlyStationary: 0 m_Center: {x: 0, y: 0, z: 0} m_TimeToStationary: 0.5 --- !u!1 &1889561963 @@ -1711,12 +1704,12 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1889561963} serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -4.8, y: 2.71, z: 0.44} - m_LocalScale: {x: 2.7692316, y: 2.7692316, z: 2.7692316} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.020107897, y: 0, z: 0.08565251} + m_LocalScale: {x: 14.6520195, y: 14.6520195, z: 14.6520195} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 286165427} + m_Father: {fileID: 1223475210011116500} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!208 &1889561965 NavMeshObstacle: @@ -1728,10 +1721,10 @@ NavMeshObstacle: m_Enabled: 1 serializedVersion: 3 m_Shape: 0 - m_Extents: {x: 0.5, y: 0.5, z: 0.5} - m_MoveThreshold: 0.1 + m_Extents: {x: 0.5, y: 0.00001, z: 0.5} + m_MoveThreshold: 0.01 m_Carve: 1 - m_CarveOnlyStationary: 1 + m_CarveOnlyStationary: 0 m_Center: {x: 0, y: 0, z: 0} m_TimeToStationary: 0.5 --- !u!1 &2085312385 @@ -1845,14 +1838,14 @@ GameObject: - component: {fileID: 216885776115017224} - component: {fileID: 226770802121188620} - component: {fileID: 249976107358570837} - - component: {fileID: 249976107358570839} - component: {fileID: 249976107358570838} - component: {fileID: 249976107358570841} - component: {fileID: 249976107358570840} - component: {fileID: 249976107358570842} - component: {fileID: 249976107358570843} + - component: {fileID: 249976107358570844} m_Layer: 0 - m_Name: SM_Env_Hell_Circle_01 (1) + m_Name: P6 m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -1872,6 +1865,7 @@ Transform: m_ConstrainProportionsScale: 1 m_Children: - {fileID: 1123007379} + - {fileID: 586197737} m_Father: {fileID: 286165427} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &249976107358570837 @@ -1911,28 +1905,6 @@ MonoBehaviour: m_InternalValue: 0 barrierObject: {fileID: 586197736} AuraObj: {fileID: 1123007381} ---- !u!64 &249976107358570839 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 248836275302926266} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 1 - m_ProvidesContacts: 0 - m_Enabled: 0 - serializedVersion: 5 - m_Convex: 1 - m_CookingOptions: 30 - m_Mesh: {fileID: 4300000, guid: e6bac470324910340963ce88e2264904, type: 3} --- !u!114 &249976107358570840 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2013,6 +1985,29 @@ MonoBehaviour: InLocalSpace: 0 Interpolate: 1 SlerpPosition: 0 +--- !u!136 &249976107358570844 +CapsuleCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 248836275302926266} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 1 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 7.6174073 + m_Height: 2.3535805 + m_Direction: 1 + m_Center: {x: 0.000044822693, y: -0.24831605, z: -0.00050091743} --- !u!33 &1189011597376318600 MeshFilter: m_ObjectHideFlags: 0 @@ -2090,14 +2085,14 @@ GameObject: - component: {fileID: 1189011597376318600} - component: {fileID: 1199955444716138380} - component: {fileID: 1223475210011116501} - - component: {fileID: 1223475210011116503} - component: {fileID: 1223475210011116502} - component: {fileID: 1223475210011116505} - component: {fileID: 1223475210011116504} - component: {fileID: 1223475210011116506} - component: {fileID: 1223475210011116507} + - component: {fileID: 1223475210011116508} m_Layer: 0 - m_Name: SM_Env_Hell_Circle_01 (3) + m_Name: P4 m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -2117,6 +2112,7 @@ Transform: m_ConstrainProportionsScale: 1 m_Children: - {fileID: 407725659} + - {fileID: 1889561964} m_Father: {fileID: 286165427} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1223475210011116501 @@ -2156,28 +2152,6 @@ MonoBehaviour: m_InternalValue: 0 barrierObject: {fileID: 1889561963} AuraObj: {fileID: 407725661} ---- !u!64 &1223475210011116503 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1222362877196586298} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 1 - m_ProvidesContacts: 0 - m_Enabled: 0 - serializedVersion: 5 - m_Convex: 1 - m_CookingOptions: 30 - m_Mesh: {fileID: 4300000, guid: e6bac470324910340963ce88e2264904, type: 3} --- !u!114 &1223475210011116504 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2258,6 +2232,29 @@ MonoBehaviour: InLocalSpace: 0 Interpolate: 1 SlerpPosition: 0 +--- !u!136 &1223475210011116508 +CapsuleCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1222362877196586298} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 1 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 7.6174073 + m_Height: 2.3535805 + m_Direction: 1 + m_Center: {x: 0.000044822693, y: -0.24831605, z: -0.000500679} --- !u!1 &1245558867416036815 GameObject: m_ObjectHideFlags: 0 @@ -2336,14 +2333,14 @@ GameObject: - component: {fileID: 1302500533157230714} - component: {fileID: 1311752506738572158} - component: {fileID: 1326862948614608679} - - component: {fileID: 1326862948614608681} - component: {fileID: 1326862948614608680} - component: {fileID: 1326862948614608683} - component: {fileID: 1326862948614608682} - component: {fileID: 1326862948614608684} - component: {fileID: 1326862948614608685} + - component: {fileID: 1326862948614608686} m_Layer: 0 - m_Name: SM_Env_Hell_Circle_01 (5) + m_Name: P2 m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -2363,6 +2360,7 @@ Transform: m_ConstrainProportionsScale: 1 m_Children: - {fileID: 1565156256} + - {fileID: 1006116860} m_Father: {fileID: 286165427} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1326862948614608679 @@ -2402,28 +2400,6 @@ MonoBehaviour: m_InternalValue: 0 barrierObject: {fileID: 1006116859} AuraObj: {fileID: 1565156258} ---- !u!64 &1326862948614608681 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1325723386991991240} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 1 - m_ProvidesContacts: 0 - m_Enabled: 0 - serializedVersion: 5 - m_Convex: 1 - m_CookingOptions: 30 - m_Mesh: {fileID: 4300000, guid: e6bac470324910340963ce88e2264904, type: 3} --- !u!114 &1326862948614608682 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2504,6 +2480,29 @@ MonoBehaviour: InLocalSpace: 0 Interpolate: 1 SlerpPosition: 0 +--- !u!136 &1326862948614608686 +CapsuleCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1325723386991991240} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 1 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 7.6174073 + m_Height: 2.3535805 + m_Direction: 1 + m_Center: {x: 0.000044822693, y: -0.24831605, z: -0.0005028248} --- !u!33 &3136216454265548515 MeshFilter: m_ObjectHideFlags: 0 @@ -2566,14 +2565,13 @@ GameObject: - component: {fileID: 3136216454265548515} - component: {fileID: 3143858467925470695} - component: {fileID: 3169561862507413952} - - component: {fileID: 3169561862507413954} - component: {fileID: 3169561862507413953} - component: {fileID: 3169561862507413956} - component: {fileID: 3169561862507413955} - component: {fileID: 3169561862507413957} - component: {fileID: 3169561862507413958} m_Layer: 0 - m_Name: SM_Env_Hell_Circle_01 (6) + m_Name: P1 m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -2593,6 +2591,7 @@ Transform: m_ConstrainProportionsScale: 1 m_Children: - {fileID: 1681270111} + - {fileID: 1727201761} m_Father: {fileID: 286165427} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &3169561862507413952 @@ -2632,28 +2631,6 @@ MonoBehaviour: m_InternalValue: 0 barrierObject: {fileID: 1727201760} AuraObj: {fileID: 1681270113} ---- !u!64 &3169561862507413954 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3166196630092877649} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 1 - m_ProvidesContacts: 0 - m_Enabled: 0 - serializedVersion: 5 - m_Convex: 1 - m_CookingOptions: 30 - m_Mesh: {fileID: 4300000, guid: e6bac470324910340963ce88e2264904, type: 3} --- !u!114 &3169561862507413955 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2703,37 +2680,29 @@ MonoBehaviour: m_EditorClassIdentifier: outlineMaterial: {fileID: 2100000, guid: 7d59a0e48d5e5a34bbc8919ff8e3cecd, type: 2} outlineWidth: 0.1 ---- !u!114 &3169561862507413958 -MonoBehaviour: +--- !u!136 &3169561862507413958 +CapsuleCollider: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 3166196630092877649} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 1 + m_ProvidesContacts: 0 m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e96cb6065543e43c4a752faaa1468eb1, type: 3} - m_Name: - m_EditorClassIdentifier: - UseUnreliableDeltas: 0 - SyncPositionX: 1 - SyncPositionY: 1 - SyncPositionZ: 1 - SyncRotAngleX: 1 - SyncRotAngleY: 1 - SyncRotAngleZ: 1 - SyncScaleX: 1 - SyncScaleY: 1 - SyncScaleZ: 1 - PositionThreshold: 0.001 - RotAngleThreshold: 0.01 - ScaleThreshold: 0.01 - UseQuaternionSynchronization: 0 - UseQuaternionCompression: 0 - UseHalfFloatPrecision: 0 - InLocalSpace: 0 - Interpolate: 1 - SlerpPosition: 0 + serializedVersion: 2 + m_Radius: 7.6174073 + m_Height: 2.3535805 + m_Direction: 1 + m_Center: {x: 0.000044822693, y: -0.24831605, z: -0.00050091743} --- !u!1 &5194562349502858591 GameObject: m_ObjectHideFlags: 0 @@ -2746,14 +2715,14 @@ GameObject: - component: {fileID: 5215249593494578413} - component: {fileID: 5208245287638280169} - component: {fileID: 5215249593494578414} - - component: {fileID: 5215249593494578416} - component: {fileID: 5215249593494578415} - component: {fileID: 5215249593494578418} - component: {fileID: 5215249593494578417} - component: {fileID: 5215249593494578419} - component: {fileID: 5215249593494578420} + - component: {fileID: 5215249593494578421} m_Layer: 0 - m_Name: SM_Env_Hell_Circle_01 (2) + m_Name: P5 m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -2773,6 +2742,7 @@ Transform: m_ConstrainProportionsScale: 1 m_Children: - {fileID: 226924657} + - {fileID: 23828396} m_Father: {fileID: 286165427} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!23 &5208245287638280169 @@ -2862,28 +2832,6 @@ MonoBehaviour: m_InternalValue: 0 barrierObject: {fileID: 23828395} AuraObj: {fileID: 226924659} ---- !u!64 &5215249593494578416 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5194562349502858591} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 1 - m_ProvidesContacts: 0 - m_Enabled: 0 - serializedVersion: 5 - m_Convex: 1 - m_CookingOptions: 30 - m_Mesh: {fileID: 4300000, guid: e6bac470324910340963ce88e2264904, type: 3} --- !u!114 &5215249593494578417 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2964,6 +2912,29 @@ MonoBehaviour: InLocalSpace: 0 Interpolate: 1 SlerpPosition: 0 +--- !u!136 &5215249593494578421 +CapsuleCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5194562349502858591} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 1 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 7.6174073 + m_Height: 2.3535805 + m_Direction: 1 + m_Center: {x: 0.000044822693, y: -0.24831605, z: -0.00050091743} --- !u!4 &5590359088119101749 Transform: m_ObjectHideFlags: 0 @@ -2978,6 +2949,7 @@ Transform: m_ConstrainProportionsScale: 1 m_Children: - {fileID: 652972895} + - {fileID: 1799421584} m_Father: {fileID: 286165427} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &5591479862615341019 @@ -2992,14 +2964,14 @@ GameObject: - component: {fileID: 5615547279758710377} - component: {fileID: 5605082535992972653} - component: {fileID: 5615547279758710378} - - component: {fileID: 5615547279758710380} - component: {fileID: 5615547279758710379} - component: {fileID: 5615547279758710382} - component: {fileID: 5615547279758710381} - component: {fileID: 5615547279758710383} - component: {fileID: 5615547279758710384} + - component: {fileID: 5615547279758710385} m_Layer: 0 - m_Name: SM_Env_Hell_Circle_01 + m_Name: P7 m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -3092,28 +3064,6 @@ MonoBehaviour: m_InternalValue: 0 barrierObject: {fileID: 1799421583} AuraObj: {fileID: 652972897} ---- !u!64 &5615547279758710380 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5591479862615341019} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 1 - m_ProvidesContacts: 0 - m_Enabled: 0 - serializedVersion: 5 - m_Convex: 1 - m_CookingOptions: 30 - m_Mesh: {fileID: 4300000, guid: e6bac470324910340963ce88e2264904, type: 3} --- !u!114 &5615547279758710381 MonoBehaviour: m_ObjectHideFlags: 0 @@ -3194,6 +3144,29 @@ MonoBehaviour: InLocalSpace: 0 Interpolate: 1 SlerpPosition: 0 +--- !u!136 &5615547279758710385 +CapsuleCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5591479862615341019} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 1 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 7.6174073 + m_Height: 2.3535805 + m_Direction: 1 + m_Center: {x: 0.000044822693, y: -0.24831605, z: -0.000500679} --- !u!1 &6995672694789591046 GameObject: m_ObjectHideFlags: 0 @@ -3206,14 +3179,14 @@ GameObject: - component: {fileID: 7017483914677023156} - component: {fileID: 7008782796086964912} - component: {fileID: 7017483914677023157} - - component: {fileID: 7017483914677023159} - component: {fileID: 7017483914677023158} - component: {fileID: 7017483914677023161} - component: {fileID: 7017483914677023160} - component: {fileID: 7017483914677023162} - component: {fileID: 7017483914677023163} + - component: {fileID: 7017483914677023164} m_Layer: 0 - m_Name: SM_Env_Hell_Circle_01 (4) + m_Name: P3 m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -3233,6 +3206,7 @@ Transform: m_ConstrainProportionsScale: 1 m_Children: - {fileID: 1648781167} + - {fileID: 477647223} m_Father: {fileID: 286165427} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!23 &7008782796086964912 @@ -3322,28 +3296,6 @@ MonoBehaviour: m_InternalValue: 0 barrierObject: {fileID: 477647222} AuraObj: {fileID: 1648781169} ---- !u!64 &7017483914677023159 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6995672694789591046} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 1 - m_ProvidesContacts: 0 - m_Enabled: 0 - serializedVersion: 5 - m_Convex: 1 - m_CookingOptions: 30 - m_Mesh: {fileID: 4300000, guid: e6bac470324910340963ce88e2264904, type: 3} --- !u!114 &7017483914677023160 MonoBehaviour: m_ObjectHideFlags: 0 @@ -3424,6 +3376,29 @@ MonoBehaviour: InLocalSpace: 0 Interpolate: 1 SlerpPosition: 0 +--- !u!136 &7017483914677023164 +CapsuleCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6995672694789591046} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 1 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 7.6174073 + m_Height: 2.3535805 + m_Direction: 1 + m_Center: {x: 0.00004386902, y: -0.24831605, z: -0.00050091743} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Gameplay/Platform.cs b/Assets/Scripts/Gameplay/Platform.cs index d58447b..4effc9d 100644 --- a/Assets/Scripts/Gameplay/Platform.cs +++ b/Assets/Scripts/Gameplay/Platform.cs @@ -37,6 +37,16 @@ namespace Unity.Multiplayer.Samples.BossRoom } } + public void RefreshCollider() + { + if (platformCollider != null) + { + platformCollider.enabled = false; // Temporarily disable collider + platformCollider.enabled = true; // Re-enable to refresh + } + } + + public void AssignID(int id) { if (IsServer) diff --git a/Assets/Scripts/Gameplay/PlatformManager.cs b/Assets/Scripts/Gameplay/PlatformManager.cs index a1cdef2..ffe6124 100644 --- a/Assets/Scripts/Gameplay/PlatformManager.cs +++ b/Assets/Scripts/Gameplay/PlatformManager.cs @@ -9,7 +9,7 @@ namespace Unity.Multiplayer.Samples.BossRoom { public class PlatformManager : NetworkBehaviour { - public static PlatformManager Instance; + public static PlatformManager Instance { get; private set; } public List m_Platforms; public Transform centerPoint; public float shapeRadius = 5f; @@ -50,75 +50,136 @@ namespace Unity.Multiplayer.Samples.BossRoom PlatformSelection(); } - public void ArrangePlatforms() + private void PlatformSelection() { - List activePlatforms = m_Platforms.Where(p => p.gameObject.activeSelf).ToList(); - int platformCount = activePlatforms.Count; - Debug.Log("Count of Active Platforms is: " + platformCount); - if (platformCount < 3) return; // Minimum 3 platforms for a shape + int platformsToSpawn = PlayerPrefs.GetInt("NumberOfLobbyPlayers", 1) - 1; - float angleStep = 360f / platformCount; - float startAngle = 90f; // Start from top + // Disable all platforms initially + foreach (var platform in m_Platforms) + { + platform.gameObject.SetActive(false); + } - for (int i = 0; i < platformCount; i++) + // Enable required platforms + for (int i = 0; i < platformsToSpawn; i++) { - float angle = startAngle + (i * angleStep); - float radians = angle * Mathf.Deg2Rad; + m_Platforms[i].gameObject.SetActive(true); + } + + // Filter only active platforms + m_Platforms = m_Platforms.Where(platform => platform.gameObject.activeSelf).ToList(); + int[] platformIDs = m_Platforms.Select(p => p.PlatformID.Value).ToArray(); + + // Arrange the active platforms + List arrangedPositions = ArrangePlatforms(m_Platforms); - Vector3 newPosition = new Vector3( - centerPoint.position.x + shapeRadius * Mathf.Cos(radians), - centerPoint.position.y, - centerPoint.position.z + shapeRadius * Mathf.Sin(radians) - ); + // Ensure positions are not empty before sending RPC + if (platformIDs.Length != arrangedPositions.Count || arrangedPositions.Count == 0) + { + Debug.LogError($"[PlatformSelection] ERROR: Mismatch! platformIDs: {platformIDs.Length}, positions: {arrangedPositions.Count}"); + return; // Prevent sending incorrect RPC + } - activePlatforms[i].transform.position = newPosition; + for (int i = 0; i < m_Platforms.Count; i++) + { + m_Platforms[i].transform.position = arrangedPositions[i]; + m_Platforms[i].RefreshCollider(); } + + // Send the data to all clients + SyncPlatformsClientRpc(platformIDs, arrangedPositions.ToArray()); } - private void PlatformSelection() + + private List ArrangePlatforms(List activePlatforms) { - //int platformsToSpawn = 5; - int platformsToSpawn = PlayerPrefs.GetInt("NumberOfLobbyPlayers", 1) - 1; + int platformCount = activePlatforms.Count; - foreach (var platform in m_Platforms) + if (platformCount == 0) { - platform.gameObject.SetActive(false); + Debug.LogError($"[ArrangePlatforms] No active platforms found!"); + return new List(); } - for (int i = 0; i < platformsToSpawn; i++) + float startAngle = 90f; // Start from top + List arrangedPositions = new List(); + + // Special case: If 2 platforms, place them opposite to each other + if (platformCount == 2) { - m_Platforms[i].gameObject.SetActive(true); + arrangedPositions.Add(centerPoint.position + new Vector3(shapeRadius, 0, 0)); // Right side + arrangedPositions.Add(centerPoint.position + new Vector3(-shapeRadius, 0, 0)); // Left side } + else + { + float angleStep = 360f / platformCount; - m_Platforms = m_Platforms.Where(platform => platform.gameObject.activeSelf).ToList(); - int[] platformIDs = m_Platforms.Select(p => p.PlatformID.Value).ToArray(); + for (int i = 0; i < platformCount; i++) + { + float angle = startAngle + (i * angleStep); + float radians = angle * Mathf.Deg2Rad; + + Vector3 newPosition = new Vector3( + centerPoint.position.x + shapeRadius * Mathf.Cos(radians), + centerPoint.position.y, + centerPoint.position.z + shapeRadius * Mathf.Sin(radians) + ); - ClientEnablePlatformClientRpc(platformIDs); - ArrangePlatforms(); + arrangedPositions.Add(newPosition); + Debug.Log($"[ArrangePlatforms] Assigned position {i}: {newPosition} to Platform ID: {activePlatforms[i].PlatformID.Value}"); + } + } + + Debug.Log($"[ArrangePlatforms] Successfully arranged {arrangedPositions.Count} platforms."); + return arrangedPositions; } + [ClientRpc] - private void ClientEnablePlatformClientRpc(int[] platformIDs) + private void SyncPlatformsClientRpc(int[] platformIDs, Vector3[] positions) { + Debug.Log($"[SyncPlatformsClientRpc] Received {platformIDs.Length} platforms to activate."); + + if (platformIDs.Length != positions.Length) + { + Debug.LogError($"[SyncPlatformsClientRpc] Data mismatch! Platform IDs: {platformIDs.Length}, Positions: {positions.Length}"); + return; + } + m_Platforms = GetComponentsInChildren(true).ToList(); + foreach (var platform in m_Platforms) { platform.gameObject.SetActive(false); } - foreach (int id in platformIDs) + List activatedPlatforms = m_Platforms + .Where(p => platformIDs.Contains(p.PlatformID.Value)) + .OrderBy(p => p.PlatformID.Value) + .ToList(); + + if (activatedPlatforms.Count != platformIDs.Length) { - var platformToEnable = m_Platforms.FirstOrDefault(p => p.PlatformID.Value == id); - if (platformToEnable != null) - { - platformToEnable.gameObject.SetActive(true); - } + Debug.LogError($"[SyncPlatformsClientRpc] ERROR: Expected {platformIDs.Length} platforms but found {activatedPlatforms.Count} on the client."); + return; } - m_Platforms = m_Platforms.Where(platform => platform.gameObject.activeSelf).ToList(); - + for (int i = 0; i < activatedPlatforms.Count; i++) + { + activatedPlatforms[i].gameObject.SetActive(true); + activatedPlatforms[i].transform.position = positions[i]; + + // Force Collider Refresh + activatedPlatforms[i].RefreshCollider(); + + Debug.Log($"[SyncPlatformsClientRpc] Activated Platform ID: {activatedPlatforms[i].PlatformID.Value} at {positions[i]}"); + } + + Debug.Log($"[SyncPlatformsClientRpc] Successfully activated {activatedPlatforms.Count} platforms."); } + + public Platform FindNearestUnoccupiedPlatform(Vector3 position) { if (!IsServer) return null; @@ -156,328 +217,3 @@ namespace Unity.Multiplayer.Samples.BossRoom } } } - - - -//using System.Collections; -//using System.Collections.Generic; -//using System.Linq; -//using Unity.BossRoom.Gameplay.GameplayObjects.Character; -//using Unity.Netcode; -//using UnityEngine; - -//namespace Unity.Multiplayer.Samples.BossRoom -//{ -// public class PlatformManager : NetworkBehaviour -// { -// public static PlatformManager Instance; -// public List m_Platforms; -// public int numberOfPlayers = 2; // Number of players (n) - -// private void Awake() -// { -// if (Instance != null && Instance != this) -// { -// Destroy(gameObject); -// } -// else -// { -// Instance = this; -// } -// } - -// private void Start() -// { -// if (IsServer) -// { -// InitializePlatforms(); -// StartCoroutine(DelayedServerSetup()); - -// } -// } -// #region DistancePlatform -// public List platforms; // Assign all platforms in the Inspector -// private List activePlatforms = new List(); // Stores only active platforms -// private Dictionary platformDistances = new Dictionary(); // Stores distances -// private List sortedUniqueDistances = new List(); // Stores unique sorted distances -// public List platformTransforms; // Assign platform GameObjects here -// public Transform centerPoint; // Center position where the shape will form -// public float shapeRadius = 5f; - - - -// void Starter() -// { -// UpdateActivePlatforms(); -// PrecomputeDistances(); -// } - -// public void ArrangePlatforms() -// { -// // Get only active platforms -// List activePlatforms = platformTransforms.Where(p => p.gameObject.activeSelf).ToList(); -// int count = activePlatforms.Count; - -// if (count < 3) -// { -// Debug.LogWarning("Not enough platforms to form a shape!"); -// return; -// } - -// // Arrange them in a regular polygon shape -// PlacePlatformsInShape(activePlatforms, count); -// } - -// private void PlacePlatformsInShape(List platforms, int count) -// { -// float angleStep = 360f / count; // Equal angles for each platform -// float startAngle = 90f; // Start from the top (adjust if needed) - -// for (int i = 0; i < count; i++) -// { -// float angle = startAngle + (i * angleStep); -// float radians = angle * Mathf.Deg2Rad; - -// // Calculate new position using circle formula -// Vector3 newPosition = new Vector3( -// centerPoint.position.x + shapeRadius * Mathf.Cos(radians), -// centerPoint.position.y, -// centerPoint.position.z + shapeRadius * Mathf.Sin(radians) -// ); - -// // Move platform to its new position -// platforms[i].position = newPosition; -// } -// } - -// public void UpdateActivePlatforms() -// { -// // Refresh the active platforms list -// activePlatforms = platforms.Where(p => p.gameObject.activeSelf).ToList(); -// } - -// private void PrecomputeDistances() -// { -// platformDistances.Clear(); -// sortedUniqueDistances.Clear(); - -// if (activePlatforms.Count < 2) -// { -// Debug.LogWarning("Not enough active platforms to calculate distances."); -// return; -// } - -// HashSet uniqueDistances = new HashSet(); - -// // Compute and store distances between all active platform pairs -// for (int i = 0; i < activePlatforms.Count; i++) -// { -// for (int j = i + 1; j < activePlatforms.Count; j++) -// { -// Platform platformA = activePlatforms[i]; -// Platform platformB = activePlatforms[j]; - -// float rawDistance = Vector3.Distance(platformA.transform.position, platformB.transform.position); -// float roundedDistance = Mathf.Round(rawDistance * 100f) / 100f; // Rounds to 2 decimal places - -// uniqueDistances.Add(roundedDistance); - -// string key = GetPlatformKey(platformA, platformB); -// platformDistances[key] = roundedDistance; -// } -// } - -// // Convert unique distances into a sorted list -// sortedUniqueDistances = uniqueDistances.OrderBy(d => d).ToList(); - -// Debug.Log("Sorted unique distances: " + string.Join(", ", sortedUniqueDistances)); -// } - -// public float CalculateScore(Platform platformA, Platform platformB) -// { -// if(platformA== null) -// { -// Debug.Log("platformA is null"); -// } -// if(platformB == null) -// { -// Debug.Log("platformB is null"); -// } -// if (!platformA.gameObject.activeSelf || !platformB.gameObject.activeSelf) -// { -// Debug.Log("One or both selected platforms are not active."); -// return -1; -// } -// Debug.Log("PlatformKey getter"); -// string key = GetPlatformKey(platformA, platformB); -// Debug.Log("PlatformKey getter2"); -// if (!platformDistances.ContainsKey(key)) -// { -// Debug.LogError("Distance for selected platforms not found!"); -// return -1; -// } - -// float distance = platformDistances[key]; -// float scoreMultiplier = GetMultiplier(distance); -// Debug.Log($"Platforms {platformA.name} & {platformB.name} selected. Distance: {distance:F2}, Score Multiplier: {scoreMultiplier}"); -// return scoreMultiplier; -// } - -// private float GetMultiplier(float distance) -// { -// if (sortedUniqueDistances.Count == 0) -// { -// return 1.0f; // Default if no distances are calculated -// } - -// // Find the index of the selected distance in the sorted list -// int index = sortedUniqueDistances.IndexOf(distance); - -// // Multiplier starts from 1.0 and increases by 0.1 per step -// return 1.0f + (index * 0.1f); -// } - -// private string GetPlatformKey(Platform platformA, Platform platformB) -// { -// return platformA.name + "_" + platformB.name; -// } -// #endregion -// /// -// /// Initializes platform list and assigns unique IDs. -// /// -// private void InitializePlatforms() -// { -// m_Platforms = GetComponentsInChildren(true).ToList(); -// for (int i = 0; i < m_Platforms.Count; i++) -// { -// m_Platforms[i].AssignID(i + 1); // Assign unique IDs to platforms -// } -// } - -// /// -// /// Delayed server setup to allow other components to initialize. -// /// -// private IEnumerator DelayedServerSetup() -// { -// yield return new WaitForSeconds(0.5f); -// PlatformSelection(); -// } - -// /// -// /// Server-side logic to select and enable platforms based on player count. -// /// -// private void PlatformSelection() -// { - -// int platformsToSpawn = PlayerPrefs.GetInt("NumberOfLobbyPlayers",1) - 1; -// //int platformsToSpawn = 2; - -// // Disable all platforms initially -// foreach (var platform in m_Platforms) -// { -// platform.gameObject.SetActive(false); -// } - -// // Enable required number of platforms -// for (int i = 0; i < platformsToSpawn; i++) -// { -// Debug.Log(m_Platforms[i].gameObject.name + " is activated"); -// m_Platforms[i].gameObject.SetActive(true); -// } - -// m_Platforms = m_Platforms.Where(platform => platform.gameObject.activeSelf).ToList(); -// int[] platformIDs = m_Platforms.Select(p => p.PlatformID.Value).ToArray(); - -// // Notify clients to enable corresponding platforms -// ClientEnablePlatformClientRpc(platformIDs); -// } - -// /// -// /// ClientRpc to enable platforms on the client side. -// /// -// [ClientRpc] -// private void ClientEnablePlatformClientRpc(int[] platformIDs) -// { -// m_Platforms = GetComponentsInChildren(true).ToList(); -// // Disable all platforms initially -// foreach (var platform in m_Platforms) -// { -// platform.gameObject.SetActive(false); -// } - -// // Enable specified platforms -// foreach (int id in platformIDs) -// { -// var platformToEnable = m_Platforms.FirstOrDefault(p => p.PlatformID.Value == id); -// if (platformToEnable != null) -// { -// platformToEnable.gameObject.SetActive(true); -// } -// } - -// m_Platforms = m_Platforms.Where(platform => platform.gameObject.activeSelf).ToList(); - -// Starter(); - -// } - -// /// -// /// Finds the nearest unoccupied platform to a given position. -// /// Server-only method. -// /// -// public Platform FindNearestUnoccupiedPlatform(Vector3 position) -// { -// if (!IsServer) -// { -// Debug.LogError("FindNearestUnoccupiedPlatform should only be called on the server."); -// return null; -// } - -// return m_Platforms -// .Where(platform => !platform.IsOccupied) -// .OrderBy(platform => Vector3.Distance(position, platform.transform.position)) -// .FirstOrDefault(); -// } - -// /// -// /// Checks if all platforms are occupied. -// /// -// public bool AreAllPlatformsOccupied() -// { -// return m_Platforms.All(platform => platform.IsOccupied); -// } - -// /// -// /// Gets the platform occupied by a specific player. -// /// -// public Platform GetPlatformOccupiedByPlayer(ServerCharacter player) -// { -// return m_Platforms.FirstOrDefault(p => p.IsOccupied && p.GetOccupierId() == player.OwnerClientId); -// } - -// /// -// /// Checks if a platform is occupied. -// /// -// public bool IsPlatformOccupied(Platform platform) -// { -// return platform.IsOccupied; -// } - -// /// -// /// Gets the position of a platform by its ID. -// /// -// public Vector3 GetPlatformPosition(int platformId) -// { -// var platform = m_Platforms.FirstOrDefault(p => p.PlatformID.Value == platformId); -// return platform ? platform.transform.position : Vector3.zero; -// } - -// /// -// /// Gets a platform by its ID. -// /// -// public Platform GetPlatformById(int platformId) -// { -// return m_Platforms.FirstOrDefault(p => p.PlatformID.Value == platformId); -// } -// } -//}