absoulter basic join kram klappt

This commit is contained in:
DerTyp187
2021-12-16 00:04:36 +01:00
parent 8072265797
commit 82dc2c3c6c
25 changed files with 449 additions and 108 deletions

View File

@@ -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

View File

@@ -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:

View File

@@ -1,7 +1,6 @@
fileFormatVersion: 2
guid: a89988743206dad48b795c77ff2b011d
folderAsset: yes
DefaultImporter:
guid: d8211f6231dffa046a5ad222f3607548
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:

View File

@@ -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}

View File

@@ -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:

View File

@@ -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

View File

@@ -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}

View File

@@ -0,0 +1,9 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Mirror;
public class GameManager : NetworkBehaviour
{
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 435efa23db9058e4ba98afefb0f5f72e
guid: 8748c2c4324fa0942b14884b8873c8b2
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,9 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Lobby : MonoBehaviour
{
[SerializeField]
public List<LobbyPlayer> LobbyPlayers = new List<LobbyPlayer>();
}

View File

@@ -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<Player> Players = new List<Player>();
[SerializeField] GameObject GamePlayerPrefab;
[SerializeField] [Scene] string gameScene;
// Sync Vars
[SyncVar] //A list of all connected player
public List<LobbyPlayer> LobbyPlayers = new List<LobbyPlayer>(); // 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<NetManagerScript>();
}
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<Player>().username = player.username;
NetworkServer.Destroy(conn.identity.gameObject);
NetworkServer.ReplacePlayerForConnection(conn, newPlayerInstance.gameObject);
LobbyPlayers.Remove(lobbyPlayer);
Players.Add(newPlayerInstance.gameObject.GetComponent<Player>());
//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

View File

@@ -2,6 +2,7 @@ using UnityEngine;
using UnityEngine.UI; // For <Button>
using Mirror;
using TMPro;
using UnityEngine.SceneManagement;
/*
* This class manages the LobbyPlayer, which is the player object while the player is connected only to the lobby
@@ -37,12 +38,20 @@ public class LobbyPlayer : NetworkBehaviour
public override void OnStartClient()
{
lobby = GameObject.Find("LobbyManager").GetComponent<Lobby>(); // Get the Lobby Object in Scene
lobby.RegisterPlayer(this); // Register the LobbyPlayer, so the lobby can store him in a list for future use
if (SceneManager.GetActiveScene().name == "Lobby")
{
lobby.RegisterLobbyPlayer(this); // Register the LobbyPlayer, so the lobby can store him in a list for future use
}
else
{
lobby.ChangeToPlayer(this);
}
}
public void Start()
{
if (isLocalPlayer)
if (isLocalPlayer && SceneManager.GetActiveScene().name == "Lobby") // Needs to check Scene for itself -> it starts faster than the lobby
{
/*
* The Varaible Saver is used to store vars across different scenes and Player-Objects(LobbyPlayer/GamePlayer).
@@ -72,7 +81,7 @@ public class LobbyPlayer : NetworkBehaviour
void Update()
{
if (isLocalPlayer)
if (isLocalPlayer && lobby.isLobbyScene)
{
/*
* Update the "Ready-Button":

View File

@@ -1,18 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ReadyUp : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@@ -0,0 +1,14 @@
using System.Collections.Generic;
using Mirror;
using UnityEngine;
using UnityEngine.SceneManagement;
/* Our Custom Network Manager
*
*
*/
public class NetManagerScript : NetworkManager
{
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1d8236d3922ab424d9f006270667d7a7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -5,6 +5,7 @@ using Mirror;
public class Player : NetworkBehaviour
{
Lobby lobby;
public bool isAlive = true;
public Team team;
@@ -29,15 +30,17 @@ public class Player : NetworkBehaviour
private void Start()
{
GameManager = GameObject.Find("MatchController");
lobby = GameObject.Find("LobbyManager").GetComponent<Lobby>();
lobby.RegisterPlayer(this);
/*GameManager = GameObject.Find("MatchController");
gameMaster = GameManager.GetComponent<GameMaster>();
if (isServer)
{
health = defaultHp;
gameMaster.RegisterPlayer(GetComponent<Player>());
//respawnPos(gameMaster.RespawnRequest(this.gameObject, team.teamID));
}
}*/
}