浏览代码

taking merge1

/main
David Woodruff 4 年前
当前提交
36fa2ccc
共有 190 个文件被更改,包括 4795 次插入9 次删除
  1. 57
      Packages/packages-lock.json
  2. 9
      ProjectSettings/DynamicsManager.asset
  3. 8
      ProjectSettings/EditorBuildSettings.asset
  4. 7
      ProjectSettings/ProjectSettings.asset
  5. 8
      Assets/Prefabs.meta
  6. 16
      ProjectSettings/BurstAotSettings_StandaloneWindows.json
  7. 7
      Assets/Prefabs/PlayerCharacter.prefab.meta
  8. 259
      Assets/Prefabs/PlayerCharacter.prefab
  9. 1001
      Assets/Scenes/MainMenu.unity
  10. 7
      Assets/Scenes/MainMenu.unity.meta
  11. 8
      Assets/Scenes/SampleScene.meta
  12. 648
      Assets/Scenes/SampleScene.unity
  13. 2
      Assets/Scenes/SampleScene/NavMesh.asset
  14. 8
      Assets/Scenes/SampleScene/NavMesh.asset.meta
  15. 88
      Assets/Scripts/Character.cs
  16. 11
      Assets/Scripts/Character.cs.meta
  17. 8
      Assets/Scripts/Client.meta
  18. 8
      Assets/Scripts/Client/UI.meta
  19. 8
      Assets/Scripts/Client/Game.meta
  20. 8
      Assets/Scripts/Client/Net.meta
  21. 11
      Assets/Scripts/Client/Game/ClientCharSelectBRState.cs.meta
  22. 11
      Assets/Scripts/Client/Game/ClientGameBRState.cs.meta
  23. 11
      Assets/Scripts/Client/Game/ClientMainMenuBRState.cs.meta
  24. 31
      Assets/Scripts/Client/Game/ClientCharSelectBRState.cs
  25. 28
      Assets/Scripts/Client/Game/ClientGameBRState.cs
  26. 37
      Assets/Scripts/Client/Game/ClientMainMenuBRState.cs
  27. 11
      Assets/Scripts/Client/Net/ClientGNHLogic.cs.meta
  28. 78
      Assets/Scripts/Client/Net/ClientGNHLogic.cs
  29. 11
      Assets/Scripts/Client/UI/MainMenuUI.cs.meta
  30. 60
      Assets/Scripts/Client/UI/MainMenuUI.cs
  31. 25
      Assets/Scripts/Interpolation.cs
  32. 11
      Assets/Scripts/Interpolation.cs.meta
  33. 40
      Assets/Scripts/PlayerInput.cs
  34. 11
      Assets/Scripts/PlayerInput.cs.meta
  35. 19
      Assets/Scripts/PositionInterpolation.cs
  36. 11
      Assets/Scripts/PositionInterpolation.cs.meta
  37. 8
      Assets/Scripts/Server.meta
  38. 8
      Assets/Scripts/Server/Game.meta
  39. 8
      Assets/Scripts/Server/Net.meta
  40. 102
      Assets/Scripts/Server/Net/ServerGNHLogic.cs
  41. 11
      Assets/Scripts/Server/Net/ServerGNHLogic.cs.meta
  42. 11
      Assets/Scripts/Server/Game/ServerCharSelectBRState.cs.meta
  43. 11
      Assets/Scripts/Server/Game/ServerGameBRState.cs.meta
  44. 31
      Assets/Scripts/Server/Game/ServerCharSelectBRState.cs
  45. 33
      Assets/Scripts/Server/Game/ServerGameBRState.cs
  46. 8
      Assets/Scripts/Shared.meta
  47. 8
      Assets/Scripts/Shared/Net.meta
  48. 11
      Assets/Scripts/Shared/Net/GameNetHub.cs.meta
  49. 149
      Assets/Scripts/Shared/Net/GameNetHub.cs
  50. 8
      Assets/Scripts/Shared/Game.meta
  51. 152
      Assets/Scripts/Shared/Game/BossRoomStateManager.cs
  52. 11
      Assets/Scripts/Shared/Game/BossRoomStateManager.cs.meta
  53. 35
      Assets/Scripts/Shared/Game/CharSelectBRState.cs
  54. 11
      Assets/Scripts/Shared/Game/CharSelectBRState.cs.meta
  55. 11
      Assets/Scripts/Shared/Game/GameBRState.cs.meta
  56. 33
      Assets/Scripts/Shared/Game/IBossRoomState.cs
  57. 11
      Assets/Scripts/Shared/Game/IBossRoomState.cs.meta
  58. 36
      Assets/Scripts/Shared/Game/GameBRState.cs
  59. 49
      Assets/Scripts/SimulationManager.cs
  60. 11
      Assets/Scripts/SimulationManager.cs.meta
  61. 5
      Packages/com.unity.multiplayer.transport.photon-realtime/CHANGELOG.md
  62. 7
      Packages/com.unity.multiplayer.transport.photon-realtime/CHANGELOG.md.meta
  63. 9
      Packages/com.unity.multiplayer.transport.photon-realtime/README.md
  64. 7
      Packages/com.unity.multiplayer.transport.photon-realtime/README.md.meta
  65. 8
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime.meta
  66. 8
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon.meta
  67. 8
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat.meta
  68. 8
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code.meta
  69. 18
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChannelCreationOptions.cs
  70. 11
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChannelCreationOptions.cs.meta
  71. 14
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChannelWellKnownProperties.cs
  72. 11
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChannelWellKnownProperties.cs.meta
  73. 191
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatChannel.cs
  74. 11
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatChannel.cs.meta
  75. 1001
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatClient.cs
  76. 11
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatClient.cs.meta
  77. 36
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatDisconnectCause.cs
  78. 11
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatDisconnectCause.cs.meta
  79. 33
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatEventCode.cs
  80. 11
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatEventCode.cs.meta
  81. 36
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatOperationCode.cs

57
Packages/packages-lock.json


{
"dependencies": {
"com.unity.burst": {
"version": "1.3.7",
"depth": 2,
"source": "registry",
"dependencies": {
"com.unity.mathematics": "1.2.1"
},
"url": "https://packages.unity.com"
},
"com.unity.collab-proxy": {
"version": "1.3.9",
"depth": 0,

},
"com.unity.collections": {
"version": "0.14.0-preview.16",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.test-framework.performance": "2.3.1-preview",
"com.unity.burst": "1.3.7"
},
"url": "https://packages.unity.com"
},
"com.unity.ext.nunit": {
"version": "1.0.0",
"depth": 1,

"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.mathematics": {
"version": "1.2.1",
"depth": 3,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"dependencies": {},
"hash": "8e7e3ca556843794618ab91c6b8334b291ff4e3d"
"dependencies": {
"com.unity.collections": "0.14.0-preview.16"
},
"hash": "726b77f90f2bb2879303cf72a22048ac0abf4084"
},
"com.unity.multiplayer.transport.litenet": {
"version": "file:com.unity.multiplayer.transport.litenet",

"com.unity.multiplayer.mlapi": "0.0.1-preview.1"
}
},
"com.unity.multiplayer.transport.photon-realtime": {
"version": "file:com.unity.multiplayer.transport.photon-realtime",
"depth": 0,
"source": "embedded",
"dependencies": {
"com.unity.multiplayer.mlapi": "0.0.1-preview.1"
}
},
"com.unity.nuget.newtonsoft-json": {
"version": "2.0.0-preview",
"depth": 3,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.test-framework": {
"version": "1.1.16",
"depth": 0,

"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.test-framework.performance": {
"version": "2.3.1-preview",
"depth": 2,
"source": "registry",
"dependencies": {
"com.unity.test-framework": "1.1.0",
"com.unity.nuget.newtonsoft-json": "2.0.0-preview"
},
"url": "https://packages.unity.com"
},

9
ProjectSettings/DynamicsManager.asset


--- !u!55 &1
PhysicsManager:
m_ObjectHideFlags: 0
serializedVersion: 11
serializedVersion: 13
m_DefaultMaxDepenetrationVelocity: 10
m_SleepThreshold: 0.005
m_DefaultContactOffset: 0.01
m_DefaultSolverIterations: 6

m_ClothInterCollisionStiffness: 0
m_ContactsGeneration: 1
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_AutoSimulation: 1
m_AutoSimulation: 0
m_ClothGravity: {x: 0, y: -9.81, z: 0}
m_ContactPairsMode: 0
m_BroadphaseType: 0
m_WorldBounds:

m_FrictionType: 0
m_EnableEnhancedDeterminism: 0
m_EnableUnifiedHeightmaps: 1
m_DefaultMaxAngluarSpeed: 7
m_SolverType: 0
m_DefaultMaxAngularSpeed: 7

8
ProjectSettings/EditorBuildSettings.asset


EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes: []
m_Scenes:
- enabled: 1
path: Assets/Scenes/MainMenu.unity
guid: 4b62455423c0e284f96f7fd6ac947bf9
- enabled: 1
path: Assets/Scenes/SampleScene.unity
guid: 9fc0d4010bbf28b4594072e72b8655ab
m_configObjects: {}

7
ProjectSettings/ProjectSettings.asset


bakeCollisionMeshes: 0
forceSingleInstance: 0
useFlipModelSwapchain: 1
resizableWindow: 0
resizableWindow: 1
useMacAppStoreValidation: 0
macAppStoreCategory: public.app-category.games
gpuSkinning: 1

xboxEnableFitness: 0
visibleInBackground: 1
allowFullscreenSwitch: 1
fullscreenMode: 1
fullscreenMode: 3
xboxSpeechDB: 0
xboxEnableHeadOrientation: 0
xboxEnableGuest: 0

resolutionScalingMode: 0
androidSupportedAspectRatio: 1
androidMaxAspectRatio: 2.1
applicationIdentifier: {}
applicationIdentifier:
Standalone: com.DefaultCompany.com.unity.multiplayer.samples.coop
buildNumber:
Standalone: 0
iPhone: 0

8
Assets/Prefabs.meta


fileFormatVersion: 2
guid: 5d9149b0a2db9664c9d7959745d00bf9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

16
ProjectSettings/BurstAotSettings_StandaloneWindows.json


{
"MonoBehaviour": {
"Version": 3,
"EnableBurstCompilation": true,
"EnableOptimisations": true,
"EnableSafetyChecks": false,
"EnableDebugInAllBuilds": false,
"UsePlatformSDKLinker": false,
"CpuMinTargetX32": 0,
"CpuMaxTargetX32": 0,
"CpuMinTargetX64": 0,
"CpuMaxTargetX64": 0,
"CpuTargetsX32": 6,
"CpuTargetsX64": 72
}
}

7
Assets/Prefabs/PlayerCharacter.prefab.meta


fileFormatVersion: 2
guid: e57f88b20c296674cb0c1517a43f99da
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

259
Assets/Prefabs/PlayerCharacter.prefab


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &922472105905938403
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 922472105905938412}
- component: {fileID: 922472105905938413}
- component: {fileID: 922472105905938415}
- component: {fileID: 922472105905938414}
- component: {fileID: 901965000}
- component: {fileID: 2483890359039831193}
- component: {fileID: -7978990056136126243}
m_Layer: 0
m_Name: PlayerCharacter
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &922472105905938412
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 922472105905938403}
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: 308914464942347706}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &922472105905938413
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 922472105905938403}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3}
m_Name:
m_EditorClassIdentifier:
NetworkedInstanceId: 0
PrefabHash: 6075374942793011955
PrefabHashGenerator: PlayerCharacter
AlwaysReplicateAsRoot: 0
DontDestroyWithOwner: 0
--- !u!136 &922472105905938415
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 922472105905938403}
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: 1, z: 0}
--- !u!54 &922472105905938414
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 922472105905938403}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 1
m_IsKinematic: 1
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!195 &901965000
NavMeshAgent:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 922472105905938403}
m_Enabled: 1
m_AgentTypeID: 0
m_Radius: 0.5
m_Speed: 3.5
m_Acceleration: 8
avoidancePriority: 50
m_AngularSpeed: 120
m_StoppingDistance: 0
m_AutoTraverseOffMeshLink: 1
m_AutoBraking: 1
m_AutoRepath: 1
m_Height: 2
m_BaseOffset: 0
m_WalkableMask: 4294967295
m_ObstacleAvoidanceType: 4
--- !u!114 &2483890359039831193
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 922472105905938403}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5ef335173735a554a98a17d4ef9b21c2, type: 3}
m_Name:
m_EditorClassIdentifier:
movementSpeed: 5
movementTarget: {x: 2, y: 0, z: 2}
--- !u!114 &-7978990056136126243
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 922472105905938403}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0eaaa5f4790dfc64ebc62ee85984bab9, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &2312369181857326860
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3876725910249473322}
- component: {fileID: 7677370582403823428}
- component: {fileID: 1658973705582038100}
m_Layer: 0
m_Name: Capsule
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3876725910249473322
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2312369181857326860}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 308914464942347706}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &7677370582403823428
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2312369181857326860}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &1658973705582038100
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2312369181857326860}
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_RayTraceProcedural: 0
m_RenderingLayerMask: 1
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: 1
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
m_AdditionalVertexStreams: {fileID: 0}
--- !u!1 &4347399796013429617
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 308914464942347706}
- component: {fileID: 2501205002747161907}
m_Layer: 0
m_Name: Graphics
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &308914464942347706
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4347399796013429617}
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: 3876725910249473322}
m_Father: {fileID: 922472105905938412}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2501205002747161907
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4347399796013429617}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7dac193e15c19dd47bcfb78c85bd6d8d, type: 3}
m_Name:
m_EditorClassIdentifier:

1001
Assets/Scenes/MainMenu.unity
文件差异内容过多而无法显示
查看文件

7
Assets/Scenes/MainMenu.unity.meta


fileFormatVersion: 2
guid: 4b62455423c0e284f96f7fd6ac947bf9
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scenes/SampleScene.meta


fileFormatVersion: 2
guid: d35e52e80fddfa34e8598be81bb477bb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

648
Assets/Scenes/SampleScene.unity


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 705507994}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 500
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 2
m_PVRDenoiserTypeDirect: 0
m_PVRDenoiserTypeIndirect: 0
m_PVRDenoiserTypeAO: 0
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 0
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 23800000, guid: c7720ceef5c5df34c98168df9d4f695e, type: 2}
--- !u!1 &532797402
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 532797406}
- component: {fileID: 532797405}
- component: {fileID: 532797404}
- component: {fileID: 532797403}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!64 &532797403
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 532797402}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &532797404
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 532797402}
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_RayTraceProcedural: 0
m_RenderingLayerMask: 1
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: 1
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
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &532797405
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 532797402}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &532797406
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 532797402}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: -1, z: 10}
m_LocalScale: {x: 2, y: 2, z: 2}
m_Children: []
m_Father: {fileID: 1233618361}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &705507993
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 705507995}
- component: {fileID: 705507994}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!108 &705507994
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 705507993}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 1
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &705507995
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 705507993}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 2, z: 10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1233618361}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &963194225
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 963194228}
- component: {fileID: 963194227}
- component: {fileID: 963194226}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &963194226
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_Enabled: 1
--- !u!20 &963194227
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &963194228
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_LocalRotation: {x: 0.5, y: 0, z: 0, w: 0.8660254}
m_LocalPosition: {x: 0, y: 10, z: -5.62}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 60, y: 0, z: 0}
--- !u!1 &1069853755
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1069853757}
- component: {fileID: 1069853756}
- component: {fileID: 1069853760}
- component: {fileID: 1069853759}
- component: {fileID: 1069853758}
- component: {fileID: 1069853761}
m_Layer: 0
m_Name: NetworkingManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1069853756
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1069853755}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 593a2fe42fa9d37498c96f9a383b6521, type: 3}
m_Name:
m_EditorClassIdentifier:
DontDestroy: 1
RunInBackground: 1
LogLevel: 1
NetworkConfig:
ProtocolVersion: 0
NetworkTransport: {fileID: 1069853760}
RegisteredScenes:
- SampleScene
AllowRuntimeSceneChanges: 0
NetworkedPrefabs:
- Prefab: {fileID: 922472105905938403, guid: e57f88b20c296674cb0c1517a43f99da, type: 3}
PlayerPrefab: 1
PlayerPrefabHash:
id: 0
CreatePlayerPrefab: 1
ReceiveTickrate: 0
MaxReceiveEventsPerTickRate: 1000
EventTickrate: 0
MaxObjectUpdatesPerTick: -1
ClientConnectionBufferTimeout: 10
ConnectionApproval: 0
ConnectionData:
SecondsHistory: 0
EnableTimeResync: 0
TimeResyncInterval: 30
EnableNetworkedVar: 0
EnsureNetworkedVarLengthSafety: 0
EnableSceneManagement: 0
ForceSamePrefabs: 1
UsePrefabSync: 0
RecycleNetworkIds: 1
NetworkIdRecycleDelay: 120
RpcHashSize: 0
LoadSceneTimeOut: 120
EnableMessageBuffering: 0
MessageBufferTimeout: 20
EnableNetworkLogs: 1
EnableEncryption: 0
SignKeyExchange: 0
ServerBase64PfxCertificate:
references:
version: 1
00000000:
type: {class: NullableBoolSerializable, ns: MLAPI.Configuration, asm: Unity.Multiplayer.MLAPI.Runtime}
data:
Value: 6075374942793011955
--- !u!4 &1069853757
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1069853755}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1069853758
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1069853755}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 52c005b32a68a254cbe502a4e5cb8eb6, type: 3}
m_Name:
m_EditorClassIdentifier:
appId: bc5b8b0d-edf3-4c61-9593-ce38da7f0c79
gameVersion: 0.0.0
region: EU
nickName:
roomName:
maxPlayers: 4
batchedTransportEventCode: 129
channelIdCodesStartRange: 130
attachSupportLogger: 1
sendQueueBatchSize: 4096
--- !u!114 &1069853759
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1069853755}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: db28424c2ae12f64da25c9ecccded6b1, type: 3}
m_Name:
m_EditorClassIdentifier:
Port: 7777
Address: 127.0.0.1
PingInterval: 1
DisconnectTimeout: 5
ReconnectDelay: 0.5
MaxConnectAttempts: 10
channels: []
MessageBufferSize: 5120
SimulatePacketLossChance: 0
SimulateMinLatency: 0
SimulateMaxLatency: 0
--- !u!114 &1069853760
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1069853755}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b84c2d8dfe509a34fb59e2b81f8e1319, type: 3}
m_Name:
m_EditorClassIdentifier:
MessageBufferSize: 5120
MaxConnections: 100
MaxSentMessageQueueSize: 128
ConnectAddress: 127.0.0.1
ConnectPort: 7777
ServerListenPort: 7777
ServerWebsocketListenPort: 8887
SupportWebsocket: 0
Channels: []
UseMLAPIRelay: 0
MLAPIRelayAddress: 184.72.104.138
MLAPIRelayPort: 8888
MessageSendMode: 0
--- !u!114 &1069853761
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1069853755}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e26f82009f8f36d45a99adae79eab7b9, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1233618360
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1233618361}
m_Layer: 0
m_Name: Environment
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!4 &1233618361
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1233618360}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 532797406}
- {fileID: 705507995}
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1601651753
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1601651754}
- component: {fileID: 1601651755}
m_Layer: 0
m_Name: SimulationManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1601651754
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1601651753}
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: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1601651755
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1601651753}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3e6c31da8c35c2743b0311f50e3e1a69, type: 3}
m_Name:
m_EditorClassIdentifier:
tickRate: 20

2
Assets/Scenes/SampleScene/NavMesh.asset
文件差异内容过多而无法显示
查看文件

8
Assets/Scenes/SampleScene/NavMesh.asset.meta


fileFormatVersion: 2
guid: c7720ceef5c5df34c98168df9d4f695e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

88
Assets/Scripts/Character.cs


using MLAPI;
using MLAPI.Messaging;
using System;
using System.IO;
using System.Linq;
using UnityEngine;
using UnityEngine.AI;
public class Character : NetworkedBehaviour
{
[SerializeField]
private float movementSpeed;
private NavMeshAgent _navMeshAgent;
private NavMeshPath _path;
private PositionInterpolation _interpolation;
public void Awake()
{
_path = new NavMeshPath();
_navMeshAgent = GetComponent<NavMeshAgent>();
_interpolation = GetComponentInChildren<PositionInterpolation>();
}
///<inheritdoc/>
public override void NetworkStart()
{
base.NetworkStart();
SimulationManager.Singleton.OnSimulationUpdate += SimulationUpdate;
SimulationManager.Singleton.OnSyncNetworkEvents += SyncNetworkEvents;
_navMeshAgent.updateRotation = false;
_navMeshAgent.updatePosition = true;
if (!IsServer)
{
Destroy(_navMeshAgent);
}
}
private void SyncNetworkEvents(float time, float deltaTime)
{
if (IsServer)
{
_interpolation.AddValue(time, transform.position);
InvokeClientRpcOnEveryoneExcept<float, Vector3>(ReplicatePosition, NetworkingManager.Singleton.ServerClientId, time, transform.position);
}
}
public void SetMovementTarget(Vector3 position)
{
_navMeshAgent.CalculatePath(position, _path);
}
private void SimulationUpdate(float time, float deltaTime)
{
if (IsServer)
{
NavigationMovement(deltaTime);
}
}
private void NavigationMovement(float deltaTime)
{
var corners = _path.corners; // TODO: maybe use non-alloc version
if (corners.Any() && Vector3.SqrMagnitude(corners[corners.Length - 1]- transform.position) < 1)
{
_path = new NavMeshPath();
corners = _path.corners;
}
var direction = corners.Length > 1 ? (corners[1]- corners[0]).normalized : Vector3.zero;
var movement = direction * movementSpeed * deltaTime;
_navMeshAgent.Move(movement);
}
[ClientRPC]
private void ReplicatePosition(float time, Vector3 value)
{
// The time which we receive here is server time. TODO We need to match it with our client time.
_interpolation.AddValue(time, value);
}
}

11
Assets/Scripts/Character.cs.meta


fileFormatVersion: 2
guid: 5ef335173735a554a98a17d4ef9b21c2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Client.meta


fileFormatVersion: 2
guid: 422ec0f4d28e6d4468624a9c76adab77
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Client/UI.meta


fileFormatVersion: 2
guid: 3d8dd27d96315be4c9c7413bc17b82c7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Client/Game.meta


fileFormatVersion: 2
guid: 96e5af1f6fcbe144a99396d22b4f7dbf
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Client/Net.meta


fileFormatVersion: 2
guid: 834e4dadbaf194f45a280e71aace6a16
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

11
Assets/Scripts/Client/Game/ClientCharSelectBRState.cs.meta


fileFormatVersion: 2
guid: 5c5d294b879617e448dbe34b7f09616d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
Assets/Scripts/Client/Game/ClientGameBRState.cs.meta


fileFormatVersion: 2
guid: fb79a8334ba58754c98a2ee9fc2a5dee
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
Assets/Scripts/Client/Game/ClientMainMenuBRState.cs.meta


fileFormatVersion: 2
guid: 5a65bc8be73a02c42a41f5efef95fbae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

31
Assets/Scripts/Client/Game/ClientCharSelectBRState.cs


using System;
using System.Collections.Generic;
using BossRoom;
namespace BossRoomClient
{
class ClientCharSelectBRState : CharSelectBRState
{
// !! STUB CLASS !!
// this will be fleshed out with all client-side logic for the character select BossRoom state.
public override void Destroy()
{
base.Destroy();
}
public override void Initialize(BossRoomStateManager manager, Dictionary<string, object> stateParams)
{
base.Initialize(manager, stateParams);
}
public override void Update()
{
base.Update();
}
}
}

28
Assets/Scripts/Client/Game/ClientGameBRState.cs


using System;
using System.Collections.Generic;
using BossRoom;
namespace BossRoomClient
{
class ClientGameBRState : GameBRState
{
// !! STUB CLASS !!
// this will be fleshed out with all client-side logic for the Game BossRoom state.
public override void Destroy()
{
base.Destroy();
}
public override void Initialize(BossRoomStateManager manager, Dictionary<string, object> stateParams)
{
base.Initialize(manager, stateParams);
}
public override void Update()
{
base.Update();
}
}
}

37
Assets/Scripts/Client/Game/ClientMainMenuBRState.cs


using System;
using System.Collections.Generic;
using BossRoom;
namespace BossRoomClient
{
/// <summary>
/// The BossRoom state logic that runs during MainMenu. Unlike most states, there is only a client variant of this (you are always
/// a client when sitting at the Main Menu screen).
/// </summary>
class ClientMainMenuBRState : IBossRoomState
{
private BossRoomStateManager m_manager;
public BossRoomState State { get { return BossRoomState.MAINMENU; } }
public void Destroy()
{
}
public void Initialize(BossRoomStateManager manager, Dictionary<string, object> stateParams)
{
m_manager = manager;
UnityEngine.Application.targetFrameRate = 60;
}
public void Update()
{
}
}
}

11
Assets/Scripts/Client/Net/ClientGNHLogic.cs.meta


fileFormatVersion: 2
guid: 5bd31edc1b1fd1342b3bf8193a5a03b2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

78
Assets/Scripts/Client/Net/ClientGNHLogic.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using BossRoom;
namespace BossRoomClient
{
/// <summary>
/// Client logic for the GameNetHub. Contains implementations for all of GameNetHub's S2C RPCs.
/// </summary>
public class ClientGNHLogic
{
private GameNetHub m_hub;
public ClientGNHLogic(GameNetHub hub)
{
m_hub = hub;
}
public void RecvConnectFinished( ConnectStatus status, BossRoomState targetState )
{
//on success, there is nothing to do (the MLAPI scene management system will take us to the next scene).
//on failure, we must raise an event so that the UI layer can display something.
Debug.Log("RecvConnectFinished Got status: " + status);
m_hub.GetComponent<BossRoomStateManager>().ChangeState(targetState, null);
}
/// <summary>
/// Either loads a Guid string from Unity preferences, or creates one and checkpoints it, then returns it.
/// </summary>
/// <returns>The Guid that uniquely identifies this client install, in string form. </returns>
private static string GetOrCreateGuid()
{
if( PlayerPrefs.HasKey("client_guid"))
{
return PlayerPrefs.GetString("client_guid");
}
System.Guid g = System.Guid.NewGuid();
string guid_string = g.ToString();
PlayerPrefs.SetString("client_guid", guid_string);
return guid_string;
}
/// <summary>
/// Wraps the invocation of NetworkingManager.StartClient, including our GUID as the payload.
/// </summary>
/// <remarks>
/// This method must be static because, when it is invoked, the client still doesn't know it's a client yet, and in particular, GameNetHub hasn't
/// yet initialized its client and server GNHLogic objects yet (which it does in NetworkStart, based on the role that the current player is performing).
/// </remarks>
/// <param name="ipaddress">the IP address of the host to connect to. (currently IPV4 only)</param>
/// <param name="port">The port of the host to connect to. </param>
public static void StartClient(GameNetHub hub, string ipaddress, int port)
{
string client_guid = GetOrCreateGuid();
string payload = $"client_guid={client_guid}\n"; //minimal format where key=value pairs are separated by newlines.
byte[] payload_bytes = System.Text.Encoding.UTF8.GetBytes(payload);
//DMW_NOTE: non-portable. We need to be updated when moving to UTP transport.
var transport = hub.NetworkingManagerGO.GetComponent<MLAPI.Transports.UNET.UnetTransport>();
transport.ConnectAddress = ipaddress;
transport.ConnectPort = port;
hub.NetManager.NetworkConfig.ConnectionData = payload_bytes;
//and...we're off! MLAPI will establish a socket connection to the host.
// If the socket connection fails, we'll hear back by [???] (FIXME: GOMPS-79, need to handle transport layer failures too).
// If the socket connection succeeds, we'll get our RecvConnectFinished invoked. This is where game-layer failures will be reported.
hub.NetManager.StartClient();
}
}
}

11
Assets/Scripts/Client/UI/MainMenuUI.cs.meta


fileFormatVersion: 2
guid: f6144e8dd0fc8ec4cb23a1a49059aa08
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

60
Assets/Scripts/Client/UI/MainMenuUI.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BossRoomViz
{
/// <summary>
/// Provides backing logic for all of the UI that runs in the MainMenu stage.
/// </summary>
public class MainMenuUI : MonoBehaviour
{
public GameObject GameHubGO;
public GameObject InputTextGO;
private BossRoom.GameNetHub m_netHub;
// Start is called before the first frame update
void Start()
{
m_netHub = GameHubGO.GetComponent<BossRoom.GameNetHub>();
}
// Update is called once per frame
void Update()
{
}
/// <summary>
/// Gets the IP Address the user set in the UI, or returns 127.0.0.1 if IP is not present.
/// </summary>
/// <returns>IP address entered by user, in string form. </returns>
private string GetIPAddress()
{
string iptext = InputTextGO.GetComponent<UnityEngine.UI.Text>().text;
if( iptext == "" )
{
return "127.0.0.1";
}
return iptext;
}
public void OnHostClicked()
{
Debug.Log("Host Clicked");
GetIPAddress();
m_netHub.StartHost(GetIPAddress(), 9998);
}
public void OnConnectClicked()
{
Debug.Log("Connect Clicked");
m_netHub.StartClient(GetIPAddress(), 9998);
}
}
}

25
Assets/Scripts/Interpolation.cs


using System;
using UnityEngine;
public abstract class Interpolation<T> : MonoBehaviour
{
public abstract Func<T, T, float, T> LerpFunction { get;}
private (float, T) _last;
private (float, T) _previous;
public T GetValueForTime(float time)
{
float timeSincePrevious = time - _previous.Item1;
float t = (timeSincePrevious / (_last.Item1 - _previous.Item1) - 1f);
return LerpFunction(_previous.Item2, _last.Item2, t);
}
public void AddValue(float time, T value)
{
_previous = _last;
_last = (time, value);
}
}

11
Assets/Scripts/Interpolation.cs.meta


fileFormatVersion: 2
guid: 4be874942db508e4bb7c4481d0ffb727
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

40
Assets/Scripts/PlayerInput.cs


using MLAPI;
using MLAPI.Messaging;
using System;
using UnityEngine;
public class PlayerInput : NetworkedBehaviour
{
private Character character;
public void Awake()
{
character = GetComponent<Character>();
}
public override void NetworkStart()
{
if (IsClient)
{
SimulationManager.Singleton.OnSimulationUpdate += SimulationUpdate;
}
}
private void SimulationUpdate(float time, float deltaTime)
{
if (Input.GetMouseButton(0))
{
RaycastHit hit;
if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit))
{
InvokeServerRpc(SendPlayerInput, hit.point);
}
}
}
[ServerRPC]
public void SendPlayerInput(Vector3 position)
{
character.SetMovementTarget(position);
}
}

11
Assets/Scripts/PlayerInput.cs.meta


fileFormatVersion: 2
guid: 0eaaa5f4790dfc64ebc62ee85984bab9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

19
Assets/Scripts/PositionInterpolation.cs


using System;
using UnityEngine;
using MLAPI;
[DefaultExecutionOrder(200)]
public class PositionInterpolation : Interpolation<Vector3>
{
public override Func<Vector3, Vector3, float, Vector3> LerpFunction => Vector3.LerpUnclamped;
private void Update()
{
var value = GetValueForTime(NetworkingManager.Singleton.NetworkTime);
if (!float.IsNaN(value.x))
{
transform.position = value;
}
}
}

11
Assets/Scripts/PositionInterpolation.cs.meta


fileFormatVersion: 2
guid: 7dac193e15c19dd47bcfb78c85bd6d8d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Server.meta


fileFormatVersion: 2
guid: fea36b5492aa19d4f88d4dd297330468
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Server/Game.meta


fileFormatVersion: 2
guid: 75639e6fb8c2e4b4aac37138c9601db1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Server/Net.meta


fileFormatVersion: 2
guid: b49db31b9d52a4e499fc7edbb83dcbc7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

102
Assets/Scripts/Server/Net/ServerGNHLogic.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using BossRoom;