This commit is contained in:
2025-06-16 15:14:23 +02:00
commit 074e590073
3174 changed files with 428263 additions and 0 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a0d17118b2ce14576bd5dfc54dc7c1c5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData: ''
assetBundleName: ''
assetBundleVariant: ''

View File

@ -0,0 +1,82 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: MaterialColliders
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ValidKeywords:
- _ALPHAPREMULTIPLY_ON
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 20, y: 20}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 20, y: 20}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 3
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 0
m_Colors:
- _Color: {r: 0, g: 0.12074661, b: 1, a: 0.1254902}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: ff8e460bc150b4fd2a6a41c94d7ef532
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 129321
packageName: Mirror
packageVersion: 96.0.1
assetPath: Assets/Mirror/Examples/CouchCoop/Materials/MaterialColliders.mat
uploadId: 736421

View File

@ -0,0 +1,80 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: MaterialGround
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 30, y: 30}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: bcc8fc05f1f924531a65f39394c0b703, type: 3}
m_Scale: {x: 30, y: 30}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 037d7d103792c4a6aa3ed9e8f1fd9706
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 129321
packageName: Mirror
packageVersion: 96.0.1
assetPath: Assets/Mirror/Examples/CouchCoop/Materials/MaterialGround.mat
uploadId: 736421

View File

@ -0,0 +1,80 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: MaterialPlatform1
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 10, y: 2}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: bcc8fc05f1f924531a65f39394c0b703, type: 3}
m_Scale: {x: 10, y: 2}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 0525145f52aa54b7f80b86ebdc7319de
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 129321
packageName: Mirror
packageVersion: 96.0.1
assetPath: Assets/Mirror/Examples/CouchCoop/Materials/MaterialPlatform1.mat
uploadId: 736421

View File

@ -0,0 +1,80 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: MaterialPlatform2
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: bcc8fc05f1f924531a65f39394c0b703, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 1058f0fbda1e84e6c9e18b7ebf1d0c4b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 129321
packageName: Mirror
packageVersion: 96.0.1
assetPath: Assets/Mirror/Examples/CouchCoop/Materials/MaterialPlatform2.mat
uploadId: 736421

View File

@ -0,0 +1,82 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: MaterialPlayer
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ValidKeywords:
- _GLOSSYREFLECTIONS_OFF
- _SPECULARHIGHLIGHTS_OFF
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 1
- _GlossyReflections: 0
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 0
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.5188679, g: 0.5188679, b: 0.5188679, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 9b77d86bd031f46efa8887f0c4e8d79f
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 129321
packageName: Mirror
packageVersion: 96.0.1
assetPath: Assets/Mirror/Examples/CouchCoop/Materials/MaterialPlayer.mat
uploadId: 736421

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 639ffa9af490c4a8fb41de76fd1ab4e1
DefaultImporter:
externalObjects: {}
userData: ''
assetBundleName: ''
assetBundleVariant: ''
AssetOrigin:
serializedVersion: 1
productId: 129321
packageName: Mirror
packageVersion: 96.0.1
assetPath: Assets/Mirror/Examples/CouchCoop/MirrorCouchCoop.unity
uploadId: 736421

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 211bc7f1e19a541b69823d0aae4f6c77
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData: ''
assetBundleName: ''
assetBundleVariant: ''

View File

@ -0,0 +1,526 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &4415124803507263412
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 9057824595171805708}
- component: {fileID: 662729490405160656}
- component: {fileID: 3624570427921084598}
m_Layer: 8
m_Name: Capsule
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &9057824595171805708
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4415124803507263412}
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_Children:
- {fileID: 3254954141432383832}
m_Father: {fileID: 5328458565928408179}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &662729490405160656
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4415124803507263412}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &3624570427921084598
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4415124803507263412}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 9b77d86bd031f46efa8887f0c4e8d79f, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!1 &5744931112379996478
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4305313394997208315}
- component: {fileID: 8965569245488384288}
- component: {fileID: 7000040794664630560}
m_Layer: 5
m_Name: Text (Legacy)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4305313394997208315
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5744931112379996478}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.01, y: 0.01, z: 0.01}
m_Children: []
m_Father: {fileID: 4980237708977737702}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0.0000098199, y: 1.433}
m_SizeDelta: {x: 500, y: 213.418}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8965569245488384288
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5744931112379996478}
m_CullTransparentMesh: 1
--- !u!114 &7000040794664630560
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5744931112379996478}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 1
m_MinSize: 10
m_MaxSize: 113
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: '0
Player'
--- !u!1 &5808292118690144754
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4980237708977737702}
- component: {fileID: 6744980396040549407}
- component: {fileID: 2707953842156002887}
- component: {fileID: 509779290406182369}
- component: {fileID: 3756035243087774342}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4980237708977737702
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5808292118690144754}
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_Children:
- {fileID: 4305313394997208315}
m_Father: {fileID: 5328458565928408179}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 1}
m_SizeDelta: {x: 5, y: 5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!223 &6744980396040549407
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5808292118690144754}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 2
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &2707953842156002887
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5808292118690144754}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!114 &509779290406182369
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5808292118690144754}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &3756035243087774342
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5808292118690144754}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: afa2d590c474413d9fc183551385ed85, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &5815001218983416211
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3254954141432383832}
- component: {fileID: 1800893346221236401}
- component: {fileID: 136369082707552984}
m_Layer: 8
m_Name: Visor
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3254954141432383832
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5815001218983416211}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0.39999998, z: 0.5}
m_LocalScale: {x: 0.5, y: 0.1, z: 0.2}
m_Children: []
m_Father: {fileID: 9057824595171805708}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &1800893346221236401
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5815001218983416211}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &136369082707552984
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5815001218983416211}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!1 &8872462076811691049
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5328458565928408179}
- component: {fileID: 8537344390966522168}
- component: {fileID: 887491563423388292}
- component: {fileID: 1143206540915927667}
- component: {fileID: 3175779197224890082}
- component: {fileID: -8083293324570022796}
- component: {fileID: 2898688981306985052}
- component: {fileID: 6286322935166147715}
m_Layer: 0
m_Name: CouchPlayer
m_TagString: Player
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5328458565928408179
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8872462076811691049}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.4, y: 0.4, z: 0.4}
m_Children:
- {fileID: 9057824595171805708}
- {fileID: 4980237708977737702}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &8537344390966522168
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8872462076811691049}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3}
m_Name:
m_EditorClassIdentifier:
sceneId: 0
_assetId: 435478594
serverOnly: 0
visibility: 0
hasSpawned: 0
--- !u!114 &887491563423388292
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8872462076811691049}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a553cb17010b2403e8523b558bffbc14, type: 3}
m_Name:
m_EditorClassIdentifier:
syncDirection: 1
syncMode: 0
syncInterval: 0
target: {fileID: 5328458565928408179}
syncPosition: 1
syncRotation: 1
syncScale: 0
onlySyncOnChange: 1
compressRotation: 1
interpolatePosition: 1
interpolateRotation: 1
interpolateScale: 0
coordinateSpace: 0
timelineOffset: 1
showGizmos: 0
showOverlay: 0
overlayColor: {r: 0, g: 0, b: 0, a: 0.5}
bufferResetMultiplier: 3
positionSensitivity: 0.01
rotationSensitivity: 0.01
scaleSensitivity: 0.01
--- !u!136 &1143206540915927667
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8872462076811691049}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.5
m_Height: 2
m_Direction: 1
m_Center: {x: 0, y: 0, z: 0}
--- !u!54 &3175779197224890082
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8872462076811691049}
serializedVersion: 2
m_Mass: 1
m_Drag: 0.1
m_AngularDrag: 0.1
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 112
m_CollisionDetection: 0
--- !u!114 &-8083293324570022796
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8872462076811691049}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1931e6adfa27e41bbbea220a6436c0e9, type: 3}
m_Name:
m_EditorClassIdentifier:
syncDirection: 0
syncMode: 0
syncInterval: 0
rb: {fileID: 3175779197224890082}
movementSpeed: 3
jumpSpeed: 6
couchPlayerManager: {fileID: 0}
playerNumber: 0
textPlayerNumber: {fileID: 7000040794664630560}
--- !u!114 &2898688981306985052
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8872462076811691049}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a91a718a70d01b347b75cb768a6f1a92, type: 3}
m_Name:
m_EditorClassIdentifier:
syncDirection: 0
syncMode: 0
syncInterval: 0
color:
serializedVersion: 2
rgba: 4278190080
--- !u!114 &6286322935166147715
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8872462076811691049}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 19882c332836048ada1935c7fb20283b, type: 3}
m_Name:
m_EditorClassIdentifier:
syncDirection: 0
syncMode: 0
syncInterval: 0

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: c5eb745ce31f9439f9bb3fe7c091ad27
PrefabImporter:
externalObjects: {}
userData: ''
assetBundleName: ''
assetBundleVariant: ''
AssetOrigin:
serializedVersion: 1
productId: 129321
packageName: Mirror
packageVersion: 96.0.1
assetPath: Assets/Mirror/Examples/CouchCoop/Prefabs/CouchPlayer.prefab
uploadId: 736421

View File

@ -0,0 +1,73 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &4305101904764985729
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4456829670910880163}
- component: {fileID: 2502210482294623506}
- component: {fileID: 6157389571773585229}
m_Layer: 0
m_Name: CouchPlayerManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4456829670910880163
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4305101904764985729}
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_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2502210482294623506
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4305101904764985729}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3}
m_Name:
m_EditorClassIdentifier:
sceneId: 0
_assetId: 4177435541
serverOnly: 0
visibility: 0
hasSpawned: 0
--- !u!114 &6157389571773585229
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4305101904764985729}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 32f263c662d1e4d33870c9411461bbd0, type: 3}
m_Name:
m_EditorClassIdentifier:
syncDirection: 0
syncMode: 0
syncInterval: 0
canvasScript: {fileID: 0}
playerPrefabs:
- {fileID: 8872462076811691049, guid: c5eb745ce31f9439f9bb3fe7c091ad27, type: 3}
totalCouchPlayers: 0
playerKeyJump: 0000000031000000320000003300000034000000
playerKeyLeft: 000000006100000066000000680000006b000000
playerKeyRight: 0000000064000000670000006a0000006c000000

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 44329fdf23cc043648529f3cb0a8fd7c
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 129321
packageName: Mirror
packageVersion: 96.0.1
assetPath: Assets/Mirror/Examples/CouchCoop/Prefabs/CouchPlayerManager.prefab
uploadId: 736421

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1d69e8ccc667f4946889e0ab1e09357e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData: ''
assetBundleName: ''
assetBundleVariant: ''

View File

@ -0,0 +1,73 @@
using UnityEngine;
namespace Mirror.Examples.CouchCoop
{
public class CameraViewForAll : MonoBehaviour
{
public Transform cameraTransform;
public float camSpeed = 2.0f;
public float orthoSizeSpeed = 2.0f;
public Camera mainCamera;
public float cameraZ = -5;
public float cameraBufferX = 0.1f;
public float cameraBufferY = 0.1f;
public float minOrthographicSize = 0.1f;
public float targetYPosition = 4.5f; // Optional Y position if cameras rotated
private Vector2Int boundsMin;
private Vector2Int boundsMax;
private Vector3 targetCameraPosition;
private float targetOrthographicSize;
private void Update()
{
if (CouchPlayer.playersList.Count > 0)
{
CalculateBounds();
CalculateTargetCameraPosAndSize();
MoveCamera();
}
}
private void CalculateBounds()
{
boundsMin = new Vector2Int(int.MaxValue, int.MaxValue);
boundsMax = new Vector2Int(int.MinValue, int.MinValue);
foreach (GameObject player in CouchPlayer.playersList)
{
Vector3 playerPosition = player.transform.position;
boundsMin.x = Mathf.Min(boundsMin.x, Mathf.FloorToInt(playerPosition.x));
boundsMin.y = Mathf.Min(boundsMin.y, Mathf.FloorToInt(playerPosition.y));
boundsMax.x = Mathf.Max(boundsMax.x, Mathf.CeilToInt(playerPosition.x));
boundsMax.y = Mathf.Max(boundsMax.y, Mathf.CeilToInt(playerPosition.y));
}
boundsMin.x -= Mathf.FloorToInt(cameraBufferX);
boundsMin.y -= Mathf.FloorToInt(cameraBufferY);
boundsMax.x += Mathf.CeilToInt(cameraBufferX);
boundsMax.y += Mathf.CeilToInt(cameraBufferY);
}
private void CalculateTargetCameraPosAndSize()
{
float aspectRatio = (float)Screen.width / Screen.height;
float requiredOrthographicSizeX = Mathf.Max((boundsMax.x - boundsMin.x) / 2 / aspectRatio, minOrthographicSize / aspectRatio);
float requiredOrthographicSizeY = Mathf.Max(boundsMax.y - boundsMin.y / 2, minOrthographicSize);
targetOrthographicSize = Mathf.Max(requiredOrthographicSizeX, requiredOrthographicSizeY);
float cameraX = (boundsMax.x + boundsMin.x) / 2;
float cameraY = targetYPosition != 0.0f ? targetYPosition : (boundsMax.y + boundsMin.y) / 2;
targetCameraPosition = new Vector3(cameraX, cameraY, cameraZ);
}
private void MoveCamera()
{
cameraTransform.position = Vector3.Lerp(cameraTransform.position, targetCameraPosition, camSpeed * Time.deltaTime);
mainCamera.orthographicSize = Mathf.Lerp(mainCamera.orthographicSize, targetOrthographicSize, orthoSizeSpeed * Time.deltaTime);
}
}
}

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 73edff93783204b298f805477ae30ecd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 129321
packageName: Mirror
packageVersion: 96.0.1
assetPath: Assets/Mirror/Examples/CouchCoop/Scripts/CameraViewForAll.cs
uploadId: 736421

View File

@ -0,0 +1,32 @@
using UnityEngine;
using UnityEngine.UI;
namespace Mirror.Examples.CouchCoop
{
public class CanvasScript : MonoBehaviour
{
public CouchPlayerManager couchPlayerManager; // Sets itself
public Button buttonAddPlayer, buttonRemovePlayer; // Make sure to attach these Buttons in the Inspector
private void Start()
{
buttonAddPlayer.onClick.AddListener(ButtonAddPlayer);
buttonRemovePlayer.onClick.AddListener(ButtonRemovePlayer);
}
private void ButtonAddPlayer()
{
if (couchPlayerManager == null)
{ Debug.Log("Start game first."); return; }
couchPlayerManager.CmdAddPlayer();
}
private void ButtonRemovePlayer()
{
if (couchPlayerManager == null)
{ Debug.Log("Start game first."); return; }
couchPlayerManager.CmdRemovePlayer();
}
}
}

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 8b76e63e8ad5c42d59aa6ccdda8cddbf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 129321
packageName: Mirror
packageVersion: 96.0.1
assetPath: Assets/Mirror/Examples/CouchCoop/Scripts/CanvasScript.cs
uploadId: 736421

View File

@ -0,0 +1,129 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Mirror.Examples.CouchCoop
{
public class CouchPlayer : NetworkBehaviour
{
public Rigidbody rb;
public float movementSpeed = 3;
public float jumpSpeed = 6;
private float movementVelocity;
private bool isGrounded;
public CouchPlayerManager couchPlayerManager;
private KeyCode jumpKey = KeyCode.Space; // Check CouchPlayerManager for controls
private KeyCode leftKey = KeyCode.LeftArrow;
private KeyCode rightKey = KeyCode.RightArrow;
[SyncVar(hook = nameof(OnNumberChangedHook))]
public int playerNumber = 0;
public Text textPlayerNumber;
// a list of players, is used for camera
public readonly static List<GameObject> playersList = new List<GameObject>();
public void Start()
{
playersList.Add(this.gameObject);
// print("playersList: " + playersList.Count);
SetPlayerUI();
}
public void OnDestroy()
{
playersList.Remove(this.gameObject);
// print("playersList: " + playersList.Count);
}
public override void OnStartAuthority()
{
this.enabled = true;
if (isOwned)
{
#if UNITY_2022_2_OR_NEWER
couchPlayerManager = GameObject.FindAnyObjectByType<CouchPlayerManager>();
#else
// Deprecated in Unity 2023.1
couchPlayerManager = GameObject.FindObjectOfType<CouchPlayerManager>();
#endif
// setup controls according to the pre-sets on CouchPlayerManager
jumpKey = couchPlayerManager.playerKeyJump[playerNumber];
leftKey = couchPlayerManager.playerKeyLeft[playerNumber];
rightKey = couchPlayerManager.playerKeyRight[playerNumber];
}
}
void Update()
{
if (!Application.isFocused) return;
if (isOwned == false) { return; }
// you can control all local players via arrow keys and space bar for fun testing
// otherwise check and set individual controls in CouchPlayerManager script.
if (isGrounded == true)
{
if (Input.GetKey(KeyCode.Space) || Input.GetKeyDown(jumpKey))
{
#if UNITY_6000_0_OR_NEWER
rb.linearVelocity = new Vector2(rb.linearVelocity.x, jumpSpeed);
#else
rb.velocity = new Vector2(rb.velocity.x, jumpSpeed);
#endif
}
}
movementVelocity = 0;
if (Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(leftKey))
{
movementVelocity = -movementSpeed;
}
if (Input.GetKey(KeyCode.RightArrow) || Input.GetKey(rightKey))
{
movementVelocity = movementSpeed;
}
#if UNITY_6000_0_OR_NEWER
rb.linearVelocity = new Vector2(movementVelocity, rb.linearVelocity.y);
#else
rb.velocity = new Vector2(movementVelocity, rb.velocity.y);
#endif
}
[ClientCallback]
void OnCollisionExit(Collision col)
{
if (isOwned == false) { return; }
isGrounded = false;
}
[ClientCallback]
void OnCollisionStay(Collision col)
{
if (isOwned == false) { return; }
isGrounded = true;
}
void OnNumberChangedHook(int _old, int _new)
{
//Debug.Log(name + " - OnNumberChangedHook: " + playerNumber);
SetPlayerUI();
}
public void SetPlayerUI()
{
// called from hook and in start, to solve a race condition
if (isOwned)
{
textPlayerNumber.text = "Local: " + playerNumber;
}
else
{
textPlayerNumber.text = "Remote: " + playerNumber;
}
}
}
}

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 1931e6adfa27e41bbbea220a6436c0e9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData: ''
assetBundleName: ''
assetBundleVariant: ''
AssetOrigin:
serializedVersion: 1
productId: 129321
packageName: Mirror
packageVersion: 96.0.1
assetPath: Assets/Mirror/Examples/CouchCoop/Scripts/CouchPlayer.cs
uploadId: 736421

View File

@ -0,0 +1,69 @@
using UnityEngine;
using Mirror;
namespace Mirror.Examples.CouchCoop
{
public class CouchPlayerManager : NetworkBehaviour
{
// reference to UI that should be in the scene
public CanvasScript canvasScript;
// for multiple player prefabs, currently not implemented, remember to add these into Network Managers Prefab array.
public GameObject[] playerPrefabs;
public int totalCouchPlayers = 0;
// ignore key controls 0, we will always start at 1
public KeyCode[] playerKeyJump;
public KeyCode[] playerKeyLeft;
public KeyCode[] playerKeyRight;
// store a list of players so we know which to remove later
// can be non sync-list, but may be useful for future features
readonly SyncList<GameObject> couchPlayersList = new SyncList<GameObject>();
public override void OnStartAuthority()
{
// hook up UI to local player, for cmd communication
#if UNITY_2022_2_OR_NEWER
canvasScript = GameObject.FindAnyObjectByType<CanvasScript>();
#else
// Deprecated in Unity 2023.1
canvasScript = GameObject.FindObjectOfType<CanvasScript>();
#endif
canvasScript.couchPlayerManager = this;
}
[Command]
public void CmdAddPlayer()
{
if (totalCouchPlayers >= playerKeyJump.Length-1)
{
Debug.Log(name + " - No controls setup for further players.");
return;
}
totalCouchPlayers += 1;
Transform spawnObj = NetworkManager.startPositions[Random.Range(0, NetworkManager.startPositions.Count)];
GameObject playerObj = Instantiate(playerPrefabs[0], spawnObj.position, spawnObj.rotation);
CouchPlayer couchPlayer = playerObj.GetComponent<CouchPlayer>();
couchPlayer.playerNumber = totalCouchPlayers;
NetworkServer.Spawn(playerObj, connectionToClient);
couchPlayersList.Add(playerObj);
}
[Command]
public void CmdRemovePlayer()
{
if (totalCouchPlayers <= 0)
{
Debug.Log(name + " - No players to remove for that connection.");
return;
}
totalCouchPlayers -= 1;
NetworkServer.Destroy(couchPlayersList[couchPlayersList.Count - 1]);
couchPlayersList.RemoveAt(couchPlayersList.Count - 1);
}
}
}

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 32f263c662d1e4d33870c9411461bbd0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 129321
packageName: Mirror
packageVersion: 96.0.1
assetPath: Assets/Mirror/Examples/CouchCoop/Scripts/CouchPlayerManager.cs
uploadId: 736421

View File

@ -0,0 +1,79 @@
using UnityEngine;
using Mirror;
namespace Mirror.Examples.CouchCoop
{
public class MovingPlatform : NetworkBehaviour
{
public Transform endTarget;
public float moveSpeed = 0.5f;
// allows for on demand syncing of stopping and starting platform movement, change via server
// note,sync vars changed via inspector do not sync. This is optional feature, can be removed
[SyncVar]
public bool moveObj = true;
// optional fancy features
public bool moveStopsUponExit = false;
public bool moveStartsUponCollision = false;
private Vector3 startPosition;
private Vector3 endPosition;
void Awake()
{
startPosition = transform.position;
endPosition = endTarget.position;
}
void Update()
{
if (moveObj)
{
float step = moveSpeed * Time.deltaTime;
transform.position = Vector3.MoveTowards(transform.position, endPosition, step);
if (Vector3.Distance(transform.position, endPosition) < 0.001f)
{
endPosition = endPosition == startPosition ? endTarget.position : startPosition;
if (isServer)
{
RpcResyncPosition(endPosition == startPosition ? (byte)1 : (byte)0);
}
}
}
}
[ClientRpc]
void RpcResyncPosition(byte _value)
{
//print("RpcResyncPosition: " + _value);
transform.position = _value == 1 ? endTarget.position : startPosition;
}
// optional
[ServerCallback]
private void OnCollisionEnter(Collision collision)
{
if (moveStartsUponCollision)
{
if (collision.gameObject.tag == "Player")
{
moveObj = true;
}
}
}
// optional
[ServerCallback]
private void OnCollisionExit(Collision collision)
{
if (moveStopsUponExit)
{
if (collision.gameObject.tag == "Player")
{
moveObj = false;
}
}
}
}
}

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 6c2bc1b05e6794a419ce8e1091f59a05
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 129321
packageName: Mirror
packageVersion: 96.0.1
assetPath: Assets/Mirror/Examples/CouchCoop/Scripts/MovingPlatform.cs
uploadId: 736421

View File

@ -0,0 +1,49 @@
using UnityEngine;
using Mirror;
namespace Mirror.Examples.CouchCoop
{
public class PlatformMovement : NetworkBehaviour
{
// A separate script to handle platform behaviour, see its partner script, MovingPlatform.cs
private bool onPlatform;
private Transform platformTransform;
private Vector3 lastPlatformPosition;
public override void OnStartAuthority()
{
this.enabled = true;
}
void FixedUpdate()
{
if (onPlatform)
{
Vector3 deltaPosition = platformTransform.position - lastPlatformPosition;
transform.position += deltaPosition;
lastPlatformPosition = platformTransform.position;
}
}
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "Finish")
{
platformTransform = collision.gameObject.GetComponent<Transform>();
lastPlatformPosition = platformTransform.position;
onPlatform = true;
}
}
private void OnCollisionExit(Collision collision)
{
// ideally set a Platform tag, but we'l just use a Unity Pre-set.
if (collision.gameObject.tag == "Finish")
{
onPlatform = false;
platformTransform = null;
}
}
}
}

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 19882c332836048ada1935c7fb20283b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 129321
packageName: Mirror
packageVersion: 96.0.1
assetPath: Assets/Mirror/Examples/CouchCoop/Scripts/PlatformMovement.cs
uploadId: 736421

View File

@ -0,0 +1,16 @@
# Couch Co-Op Example
Open scene: SceneCouchCoop
- Start game, click UI button Add Player, to add local couch players, add as few or as many local couch players as you want.
(only 4 keyboard inputs have been setup for this example, for more players, add more controls).
Join via another client, localhost, LAN or across internet, and add remote couch players.
(no forced amount, can be any combination, example, 1 vs 1, 2 vs 2, 2 vs 4, 99 vs 20)
- Jump keys are numbers 1, 2, 3, 4, depending on which player you are.
Then AD, FG, HJ, KL for movement, all can be customised on the CouchPlayerManager script.
Everyone joint uses arrow keys and space bar for quick fun testing of all local couch players.
(something you would remove for release)
- Locate Prefab: CouchPlayerManager
Set your custom controls here, the max couch players that can be spawned will depend on control key array lengths.

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: bd8cfa13483c4428facfd02c63e3dbca
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 129321
packageName: Mirror
packageVersion: 96.0.1
assetPath: Assets/Mirror/Examples/CouchCoop/_ReadMe.txt
uploadId: 736421