From 82dc2c3c6c4a6fd8984a82a07fd607a0d339f00d Mon Sep 17 00:00:00 2001 From: DerTyp187 Date: Thu, 16 Dec 2021 00:04:36 +0100 Subject: [PATCH] absoulter basic join kram klappt --- Assets/Objects/Weapons/Hand/Hand.prefab | 12 +- Assets/Prefabs/Manager/GameManager.prefab | 46 ++++++++ .../Manager/GameManager.prefab.meta} | 5 +- Assets/Prefabs/Manager/NetManager.prefab | 9 +- Assets/Scenes/HomeScene.unity | 4 +- Assets/Scenes/Lobby.unity | 8 ++ Assets/Scenes/TestScene.unity | 106 ++++++++++++++--- Assets/Scripts/GameManager.cs | 9 ++ ...yStartGame.cs.meta => GameManager.cs.meta} | 2 +- Assets/Scripts/HomeMenu/Lobby/goopz3fi.4p3~ | 9 -- Assets/Scripts/{HomeMenu => }/Lobby/Lobby.cs | 85 +++++++++++--- .../{HomeMenu => }/Lobby/Lobby.cs.meta | 0 .../{HomeMenu => }/Lobby/LobbyPlayer.cs | 15 ++- .../{HomeMenu => }/Lobby/LobbyPlayer.cs.meta | 0 Assets/Scripts/Lobby/LobbyStartGame.cs | 18 --- Assets/Scripts/NetManagerScript.cs | 14 +++ Assets/Scripts/NetManagerScript.cs.meta | 11 ++ Assets/Scripts/Player/Player.cs | 9 +- Packages/manifest.json | 3 +- Packages/packages-lock.json | 28 ++++- ProjectSettings/ProjectSettings.asset | 109 +++++++++++++++++- ProjectSettings/ProjectVersion.txt | 4 +- ProjectSettings/QualitySettings.asset | 19 ++- UserSettings/EditorUserSettings.asset | 4 +- UserSettings/Layouts/default-2021.dwlt | 28 ++--- 25 files changed, 449 insertions(+), 108 deletions(-) create mode 100644 Assets/Prefabs/Manager/GameManager.prefab rename Assets/{Scripts/HomeMenu/Lobby.meta => Prefabs/Manager/GameManager.prefab.meta} (57%) create mode 100644 Assets/Scripts/GameManager.cs rename Assets/Scripts/{Lobby/LobbyStartGame.cs.meta => GameManager.cs.meta} (83%) delete mode 100644 Assets/Scripts/HomeMenu/Lobby/goopz3fi.4p3~ rename Assets/Scripts/{HomeMenu => }/Lobby/Lobby.cs (52%) rename Assets/Scripts/{HomeMenu => }/Lobby/Lobby.cs.meta (100%) rename Assets/Scripts/{HomeMenu => }/Lobby/LobbyPlayer.cs (91%) rename Assets/Scripts/{HomeMenu => }/Lobby/LobbyPlayer.cs.meta (100%) delete mode 100644 Assets/Scripts/Lobby/LobbyStartGame.cs create mode 100644 Assets/Scripts/NetManagerScript.cs create mode 100644 Assets/Scripts/NetManagerScript.cs.meta diff --git a/Assets/Objects/Weapons/Hand/Hand.prefab b/Assets/Objects/Weapons/Hand/Hand.prefab index c37d0e8..8706161 100644 --- a/Assets/Objects/Weapons/Hand/Hand.prefab +++ b/Assets/Objects/Weapons/Hand/Hand.prefab @@ -26,6 +26,7 @@ Transform: m_LocalRotation: {x: -0, y: 0.7071068, z: 0.7071068, w: 0} m_LocalPosition: {x: 4.4113026, y: -1.3282752, z: 10.768935} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 7365407325767981108} m_RootOrder: 1 @@ -57,6 +58,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 7365407325624913735} m_Father: {fileID: 7365407325767981108} @@ -64,7 +66,7 @@ Transform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!95 &7365407324475125414 Animator: - serializedVersion: 3 + serializedVersion: 4 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} @@ -77,6 +79,7 @@ Animator: m_UpdateMode: 0 m_ApplyRootMotion: 0 m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 m_WarningMessage: m_HasTransformHierarchy: 1 m_AllowConstantClipSamplingOptimization: 1 @@ -107,6 +110,7 @@ Transform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 7365407324475125409} m_RootOrder: 0 @@ -130,7 +134,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!4 &7365407325767981108 Transform: m_ObjectHideFlags: 0 @@ -141,6 +145,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0.108, y: -0.084, z: 0.266} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 7365407324475125409} - {fileID: 6708222704297240606} @@ -193,7 +198,7 @@ BoxCollider: m_GameObject: {fileID: 7365407325767981110} m_Material: {fileID: 0} m_IsTrigger: 0 - m_Enabled: 1 + m_Enabled: 0 serializedVersion: 2 m_Size: {x: 1, y: 1, z: 1} m_Center: {x: 0, y: 0, z: 0} @@ -239,6 +244,7 @@ Transform: m_LocalRotation: {x: -0, y: 0.7071068, z: 0.7071068, w: 0} m_LocalPosition: {x: 4.471302, y: -1.3182755, z: 10.768935} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 7365407325767981108} m_RootOrder: 2 diff --git a/Assets/Prefabs/Manager/GameManager.prefab b/Assets/Prefabs/Manager/GameManager.prefab new file mode 100644 index 0000000..a051ee7 --- /dev/null +++ b/Assets/Prefabs/Manager/GameManager.prefab @@ -0,0 +1,46 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2150812009058835102 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3347479686264493447} + - component: {fileID: 8149741327840006972} + m_Layer: 0 + m_Name: GameManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3347479686264493447 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2150812009058835102} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 5.459576, y: -4.2192264, z: -5.9449897} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &8149741327840006972 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2150812009058835102} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8748c2c4324fa0942b14884b8873c8b2, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Scripts/HomeMenu/Lobby.meta b/Assets/Prefabs/Manager/GameManager.prefab.meta similarity index 57% rename from Assets/Scripts/HomeMenu/Lobby.meta rename to Assets/Prefabs/Manager/GameManager.prefab.meta index 8ece244..7bd6226 100644 --- a/Assets/Scripts/HomeMenu/Lobby.meta +++ b/Assets/Prefabs/Manager/GameManager.prefab.meta @@ -1,7 +1,6 @@ fileFormatVersion: 2 -guid: a89988743206dad48b795c77ff2b011d -folderAsset: yes -DefaultImporter: +guid: d8211f6231dffa046a5ad222f3607548 +PrefabImporter: externalObjects: {} userData: assetBundleName: diff --git a/Assets/Prefabs/Manager/NetManager.prefab b/Assets/Prefabs/Manager/NetManager.prefab index 553515b..19bb138 100644 --- a/Assets/Prefabs/Manager/NetManager.prefab +++ b/Assets/Prefabs/Manager/NetManager.prefab @@ -10,7 +10,7 @@ GameObject: m_Component: - component: {fileID: 7086846156459211593} - component: {fileID: 7086846156459211639} - - component: {fileID: 8462299686178468946} + - component: {fileID: 7346916175116586392} m_Layer: 0 m_Name: NetManager m_TagString: NetManager @@ -58,7 +58,7 @@ MonoBehaviour: debugLog: 0 statisticsGUI: 0 statisticsLog: 0 ---- !u!114 &8462299686178468946 +--- !u!114 &7346916175116586392 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -67,7 +67,7 @@ MonoBehaviour: m_GameObject: {fileID: 7086846156459211638} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 8aab4c8111b7c411b9b92cf3dbc5bd4e, type: 3} + m_Script: {fileID: 11500000, guid: 1d8236d3922ab424d9f006270667d7a7, type: 3} m_Name: m_EditorClassIdentifier: dontDestroyOnLoad: 1 @@ -84,4 +84,5 @@ MonoBehaviour: playerPrefab: {fileID: 9010945563893975427, guid: fc0476cecf5ea1047aeb1f4981bfc16f, type: 3} autoCreatePlayer: 1 playerSpawnMethod: 0 - spawnPrefabs: [] + spawnPrefabs: + - {fileID: 6272346181302961293, guid: a14d876ac00bdf6498e30b3e58b68fdf, type: 3} diff --git a/Assets/Scenes/HomeScene.unity b/Assets/Scenes/HomeScene.unity index ed562ce..36134d3 100644 --- a/Assets/Scenes/HomeScene.unity +++ b/Assets/Scenes/HomeScene.unity @@ -3237,9 +3237,7 @@ PrefabInstance: propertyPath: m_Name value: NetManager objectReference: {fileID: 0} - m_RemovedComponents: - - {fileID: 0} - - {fileID: -802718431767115137, guid: 0f6d9d1e97686d34d9872b5028512de5, type: 3} + m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 0f6d9d1e97686d34d9872b5028512de5, type: 3} --- !u!1001 &7631475220867830191 PrefabInstance: diff --git a/Assets/Scenes/Lobby.unity b/Assets/Scenes/Lobby.unity index 081389a..d3ba15e 100644 --- a/Assets/Scenes/Lobby.unity +++ b/Assets/Scenes/Lobby.unity @@ -2350,6 +2350,10 @@ PrefabInstance: propertyPath: sceneId value: 2342159728 objectReference: {fileID: 0} + - target: {fileID: 7129514368576730103, guid: af2b86e6ca1c8404a857e6bfa4294f3c, type: 3} + propertyPath: gameScene + value: Assets/Scenes/TestScene.unity + objectReference: {fileID: 0} - target: {fileID: 7129514368576730103, guid: af2b86e6ca1c8404a857e6bfa4294f3c, type: 3} propertyPath: rdyButton value: @@ -2358,6 +2362,10 @@ PrefabInstance: propertyPath: rdyButtonText value: objectReference: {fileID: 594583495} + - target: {fileID: 7129514368576730103, guid: af2b86e6ca1c8404a857e6bfa4294f3c, type: 3} + propertyPath: GamePlayerPrefab + value: + objectReference: {fileID: 6272346181302961293, guid: a14d876ac00bdf6498e30b3e58b68fdf, type: 3} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: af2b86e6ca1c8404a857e6bfa4294f3c, type: 3} --- !u!1001 &7946605864942981377 diff --git a/Assets/Scenes/TestScene.unity b/Assets/Scenes/TestScene.unity index 524952c..de65559 100644 --- a/Assets/Scenes/TestScene.unity +++ b/Assets/Scenes/TestScene.unity @@ -132,7 +132,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 732033708985862910, guid: bd217f9f85ce78e46a925776562625e8, type: 3} propertyPath: m_RootOrder - value: 2 + value: 4 objectReference: {fileID: 0} - target: {fileID: 732033708985862910, guid: bd217f9f85ce78e46a925776562625e8, type: 3} propertyPath: m_LocalPosition.x @@ -347,6 +347,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1351784394} m_RootOrder: 2 @@ -383,6 +384,7 @@ Transform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: -9.93, y: 5.64, z: 10.41} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1876458703} m_RootOrder: 2 @@ -430,6 +432,7 @@ Transform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 4.12, y: 5.64, z: 11.09} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1876458703} m_RootOrder: 3 @@ -479,6 +482,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.04, z: 0} m_LocalScale: {x: 100, y: 0.1, z: 100} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1362549044} m_RootOrder: 14 @@ -593,7 +597,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 732033708985862910, guid: bd217f9f85ce78e46a925776562625e8, type: 3} propertyPath: m_RootOrder - value: 3 + value: 5 objectReference: {fileID: 0} - target: {fileID: 732033708985862910, guid: bd217f9f85ce78e46a925776562625e8, type: 3} propertyPath: m_LocalPosition.x @@ -719,6 +723,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1351784394} m_RootOrder: 4 @@ -871,6 +876,7 @@ Transform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0.35, y: 5.64, z: -1.12} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1876458703} m_RootOrder: 0 @@ -999,9 +1005,10 @@ Transform: m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} m_LocalPosition: {x: 0, y: 3, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 4 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} --- !u!1001 &739500445 PrefabInstance: @@ -1012,7 +1019,7 @@ PrefabInstance: m_Modifications: - target: {fileID: -8679921383154817045, guid: 823e8b39d52b71b4eb5a91dbc8d6d59e, type: 3} propertyPath: m_RootOrder - value: 0 + value: 2 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: 823e8b39d52b71b4eb5a91dbc8d6d59e, type: 3} propertyPath: m_LocalPosition.x @@ -1187,6 +1194,7 @@ Transform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: -10.37, y: 5.64, z: -1.75} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1876458703} m_RootOrder: 1 @@ -1332,6 +1340,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1351784394} m_RootOrder: 1 @@ -1441,9 +1450,10 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 10 + m_RootOrder: 11 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1351784389 GameObject: @@ -1554,6 +1564,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1729968088} - {fileID: 987854207} @@ -1563,7 +1574,7 @@ RectTransform: - {fileID: 1684293625} - {fileID: 1430445132} m_Father: {fileID: 0} - m_RootOrder: 5 + m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1603,6 +1614,7 @@ RectTransform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1351784394} m_RootOrder: 6 @@ -1737,6 +1749,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1351784394} m_RootOrder: 3 @@ -1871,7 +1884,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 732033708985862910, guid: bd217f9f85ce78e46a925776562625e8, type: 3} propertyPath: m_RootOrder - value: 1 + value: 3 objectReference: {fileID: 0} - target: {fileID: 732033708985862910, guid: bd217f9f85ce78e46a925776562625e8, type: 3} propertyPath: m_LocalPosition.x @@ -1970,6 +1983,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0.07, y: 0.07, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1351784394} m_RootOrder: 5 @@ -2045,6 +2059,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1351784394} m_RootOrder: 0 @@ -2196,13 +2211,14 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 5.94973, y: 3.086451, z: -1.6778176} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 655071530} - {fileID: 753584349} - {fileID: 76630395} - {fileID: 104338203} m_Father: {fileID: 0} - m_RootOrder: 7 + m_RootOrder: 9 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &2119583729 GameObject: @@ -2296,9 +2312,10 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0.5941708, y: -0.23374963, z: 0.91566634} m_LocalScale: {x: 4.6584, y: 1, z: 14.388176} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 6 + m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1496806602367600913 PrefabInstance: @@ -2309,7 +2326,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 3365311783543717598, guid: 5cd2e2b44dc49ae44b48fc76a1e09712, type: 3} propertyPath: m_RootOrder - value: 8 + value: 0 objectReference: {fileID: 0} - target: {fileID: 3365311783543717598, guid: 5cd2e2b44dc49ae44b48fc76a1e09712, type: 3} propertyPath: m_LocalPosition.x @@ -2329,15 +2346,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3365311783543717598, guid: 5cd2e2b44dc49ae44b48fc76a1e09712, type: 3} propertyPath: m_LocalRotation.x - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 3365311783543717598, guid: 5cd2e2b44dc49ae44b48fc76a1e09712, type: 3} propertyPath: m_LocalRotation.y - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 3365311783543717598, guid: 5cd2e2b44dc49ae44b48fc76a1e09712, type: 3} propertyPath: m_LocalRotation.z - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 3365311783543717598, guid: 5cd2e2b44dc49ae44b48fc76a1e09712, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -2386,7 +2403,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2849906635484503724, guid: f0c1bca3291086d449266d9ed8942180, type: 3} propertyPath: m_RootOrder - value: 9 + value: 10 objectReference: {fileID: 0} - target: {fileID: 2849906635484503724, guid: f0c1bca3291086d449266d9ed8942180, type: 3} propertyPath: m_LocalPosition.x @@ -2531,3 +2548,64 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 6085e69ed0e6e364ca7dbdebfe7786c6, type: 3} +--- !u!1001 &9102023066063660487 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: -1930348665651757725, guid: d8211f6231dffa046a5ad222f3607548, type: 3} + propertyPath: sceneId + value: 3411148912 + objectReference: {fileID: 0} + - target: {fileID: 2150812009058835102, guid: d8211f6231dffa046a5ad222f3607548, type: 3} + propertyPath: m_Name + value: GameManager + objectReference: {fileID: 0} + - target: {fileID: 3347479686264493447, guid: d8211f6231dffa046a5ad222f3607548, type: 3} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3347479686264493447, guid: d8211f6231dffa046a5ad222f3607548, type: 3} + propertyPath: m_LocalPosition.x + value: 5.459576 + objectReference: {fileID: 0} + - target: {fileID: 3347479686264493447, guid: d8211f6231dffa046a5ad222f3607548, type: 3} + propertyPath: m_LocalPosition.y + value: -4.2192264 + objectReference: {fileID: 0} + - target: {fileID: 3347479686264493447, guid: d8211f6231dffa046a5ad222f3607548, type: 3} + propertyPath: m_LocalPosition.z + value: -5.9449897 + objectReference: {fileID: 0} + - target: {fileID: 3347479686264493447, guid: d8211f6231dffa046a5ad222f3607548, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3347479686264493447, guid: d8211f6231dffa046a5ad222f3607548, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3347479686264493447, guid: d8211f6231dffa046a5ad222f3607548, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3347479686264493447, guid: d8211f6231dffa046a5ad222f3607548, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3347479686264493447, guid: d8211f6231dffa046a5ad222f3607548, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3347479686264493447, guid: d8211f6231dffa046a5ad222f3607548, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3347479686264493447, guid: d8211f6231dffa046a5ad222f3607548, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: d8211f6231dffa046a5ad222f3607548, type: 3} diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs new file mode 100644 index 0000000..426047e --- /dev/null +++ b/Assets/Scripts/GameManager.cs @@ -0,0 +1,9 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Mirror; + +public class GameManager : NetworkBehaviour +{ + +} diff --git a/Assets/Scripts/Lobby/LobbyStartGame.cs.meta b/Assets/Scripts/GameManager.cs.meta similarity index 83% rename from Assets/Scripts/Lobby/LobbyStartGame.cs.meta rename to Assets/Scripts/GameManager.cs.meta index 0670c3b..b6aa7c6 100644 --- a/Assets/Scripts/Lobby/LobbyStartGame.cs.meta +++ b/Assets/Scripts/GameManager.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 435efa23db9058e4ba98afefb0f5f72e +guid: 8748c2c4324fa0942b14884b8873c8b2 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/HomeMenu/Lobby/goopz3fi.4p3~ b/Assets/Scripts/HomeMenu/Lobby/goopz3fi.4p3~ deleted file mode 100644 index f47c28d..0000000 --- a/Assets/Scripts/HomeMenu/Lobby/goopz3fi.4p3~ +++ /dev/null @@ -1,9 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class Lobby : MonoBehaviour -{ - [SerializeField] - public List LobbyPlayers = new List(); -} diff --git a/Assets/Scripts/HomeMenu/Lobby/Lobby.cs b/Assets/Scripts/Lobby/Lobby.cs similarity index 52% rename from Assets/Scripts/HomeMenu/Lobby/Lobby.cs rename to Assets/Scripts/Lobby/Lobby.cs index fa9b0ef..00e13a2 100644 --- a/Assets/Scripts/HomeMenu/Lobby/Lobby.cs +++ b/Assets/Scripts/Lobby/Lobby.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using UnityEngine; +using UnityEngine.SceneManagement; using Mirror; using TMPro; @@ -10,12 +11,18 @@ using TMPro; /* - * The Lobby Class is used to give all LobbyPlayer an instance above them for managing purposes. - * You could write this into a NetworkManager, but I thought it would be nicer in a seperate script. + * The Lobby will always be the "Room", where all Players are connected to. + * In-Game AND in LobbyScene! + * It manages the Players */ public class Lobby : NetworkBehaviour { + NetManagerScript networkManager; + List Players = new List(); + [SerializeField] GameObject GamePlayerPrefab; + [SerializeField] [Scene] string gameScene; + // Sync Vars [SyncVar] //A list of all connected player public List LobbyPlayers = new List(); // All player a register themselves when they join (LobbyPlayer.cs) @@ -26,26 +33,57 @@ public class Lobby : NetworkBehaviour [SyncVar] public bool allReady = false; // All players are ready? + public bool isLobbyScene; + + void Start() + { + DontDestroyOnLoad(this); + networkManager = GameObject.Find("NetManager").GetComponent(); + } void Update() { - CheckLobbyPlayers(); // Checking the LobbyPlayer List - allReady = CheckAllReady(); // Continous checking if all player are ready - } + if(SceneManager.GetActiveScene().name == "Lobby") // Check if we are in-game + isLobbyScene = true; + else + isLobbyScene = false; + + if (isLobbyScene) + { + CheckLobbyPlayers(); // Checking the LobbyPlayer List + allReady = CheckAllReady(); // Continous checking if all player are ready + } + else + { + CheckPlayers(); + } + } + + + public void ChangeToPlayer(LobbyPlayer lobbyPlayer) + { + Debug.Log("Change"); + var conn = lobbyPlayer.connectionToClient; + var newPlayerInstance = Instantiate(GamePlayerPrefab); + + //newPlayerInstance.GetComponent().username = player.username; + + NetworkServer.Destroy(conn.identity.gameObject); + + NetworkServer.ReplacePlayerForConnection(conn, newPlayerInstance.gameObject); + LobbyPlayers.Remove(lobbyPlayer); + Players.Add(newPlayerInstance.gameObject.GetComponent()); + //NetworkServer.Spawn(newPlayerInstance.gameObject, conn); + } public void StartGame() // initializes the In-Game Scene and converts LobbyPlayers to GamePlayers { Debug.Log("START"); - /* https://youtu.be/HZIzGLe-2f4?t=586 - * Start Loading Panel - * Destroy LobbyPlayer - * Instatiate Player Objects and connect them to "conn" - * Switch Scene - */ + // https://youtu.be/HZIzGLe-2f4?t=586 + + networkManager.ServerChangeScene(gameScene); } - #region LobbyPlayer Interaction (Public) - /* Public (Where the LobbyPlayer interacts with) */ public bool AuthHost(LobbyPlayer player) // Checks if player is the host { // In theory the host should always be the first connected player, which means he is index 0 in the LobbyPlayers-List @@ -64,11 +102,17 @@ public class Lobby : NetworkBehaviour } } - public void RegisterPlayer(LobbyPlayer player) // Where a Player can register himself + public void RegisterLobbyPlayer(LobbyPlayer player) // Where a Player can register himself { LobbyPlayers.Add(player); } - #endregion + + public void RegisterPlayer(Player player) // Where a Player can register himself + { + Players.Add(player); + } + + #region checks /* Checks */ @@ -95,6 +139,17 @@ public class Lobby : NetworkBehaviour } } } + + void CheckPlayers() + { + foreach (Player player in Players) + { + if (player == null) + { + Players.Remove(player); + } + } + } #endregion #region hooks diff --git a/Assets/Scripts/HomeMenu/Lobby/Lobby.cs.meta b/Assets/Scripts/Lobby/Lobby.cs.meta similarity index 100% rename from Assets/Scripts/HomeMenu/Lobby/Lobby.cs.meta rename to Assets/Scripts/Lobby/Lobby.cs.meta diff --git a/Assets/Scripts/HomeMenu/Lobby/LobbyPlayer.cs b/Assets/Scripts/Lobby/LobbyPlayer.cs similarity index 91% rename from Assets/Scripts/HomeMenu/Lobby/LobbyPlayer.cs rename to Assets/Scripts/Lobby/LobbyPlayer.cs index 111b212..e45ea0c 100644 --- a/Assets/Scripts/HomeMenu/Lobby/LobbyPlayer.cs +++ b/Assets/Scripts/Lobby/LobbyPlayer.cs @@ -2,6 +2,7 @@ using UnityEngine; using UnityEngine.UI; // For