浏览代码

Character spawning and simple input handling and positon replication (#5)

* Character spawning and simple input handling and positon replication

* fix: fix prefab component layout

* refactor: Add asmdef files

* refactor: update namespaces

* refactor: Add tasks to TODOs and add comments

* refactor: Rename ClientInputSender

* docs: Add comments.

* refactor: Instance field naming follow Unity conventions, TODOs reference Jira tasks.
/main
GitHub 4 年前
当前提交
b192efad
共有 40 个文件被更改,包括 1344 次插入0 次删除
  1. 8
      Assets/BossRoom.meta
  2. 8
      Assets/BossRoom/Prefabs.meta
  3. 272
      Assets/BossRoom/Prefabs/Player.prefab
  4. 7
      Assets/BossRoom/Prefabs/Player.prefab.meta
  5. 8
      Assets/BossRoom/Scenes/SampleScene.meta
  6. 651
      Assets/BossRoom/Scenes/SampleScene.unity
  7. 2
      Assets/BossRoom/Scenes/SampleScene/NavMesh.asset
  8. 8
      Assets/BossRoom/Scenes/SampleScene/NavMesh.asset.meta
  9. 8
      Assets/BossRoom/Scripts/Client.meta
  10. 17
      Assets/BossRoom/Scripts/Client/BossRoom.Client.asmdef
  11. 7
      Assets/BossRoom/Scripts/Client/BossRoom.Client.asmdef.meta
  12. 45
      Assets/BossRoom/Scripts/Client/ClientCharacterVisualization.cs
  13. 11
      Assets/BossRoom/Scripts/Client/ClientCharacterVisualization.cs.meta
  14. 48
      Assets/BossRoom/Scripts/Client/ClientInputSender.cs
  15. 11
      Assets/BossRoom/Scripts/Client/ClientInputSender.cs.meta
  16. 8
      Assets/BossRoom/Scripts/Server.meta
  17. 17
      Assets/BossRoom/Scripts/Server/BossRoom.Server.asmdef
  18. 7
      Assets/BossRoom/Scripts/Server/BossRoom.Server.asmdef.meta
  19. 108
      Assets/BossRoom/Scripts/Server/ServerCharacterMovement.cs
  20. 11
      Assets/BossRoom/Scripts/Server/ServerCharacterMovement.cs.meta
  21. 8
      Assets/BossRoom/Scripts/Shared.meta
  22. 16
      Assets/BossRoom/Scripts/Shared/BossRoom.Shared.asmdef
  23. 7
      Assets/BossRoom/Scripts/Shared/BossRoom.Shared.asmdef.meta
  24. 40
      Assets/BossRoom/Scripts/Shared/NetworkCharacterState.cs
  25. 11
      Assets/BossRoom/Scripts/Shared/NetworkCharacterState.cs.meta
  26. 0
      /Assets/BossRoom/Scenes.meta
  27. 0
      /Assets/BossRoom/Scripts.meta
  28. 0
      /Assets/BossRoom/Scenes/SampleScene.unity.meta
  29. 0
      /Assets/BossRoom/Scripts/Development.meta
  30. 0
      /Assets/BossRoom/Scripts/Development

8
Assets/BossRoom.meta


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

8
Assets/BossRoom/Prefabs.meta


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

272
Assets/BossRoom/Prefabs/Player.prefab


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &606642622058593710
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 80535263913599867}
- component: {fileID: 332961461464523551}
- component: {fileID: 1396173073952796847}
m_Layer: 0
m_Name: Capsule
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &80535263913599867
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 606642622058593710}
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: 1935255767028652502}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &332961461464523551
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 606642622058593710}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &1396173073952796847
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 606642622058593710}
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 &1150911143890575567
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1935255767028652502}
m_Layer: 0
m_Name: Client_Visuals
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1935255767028652502
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1150911143890575567}
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: 80535263913599867}
m_Father: {fileID: 4600110157238723791}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &4600110157238723781
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4600110157238723791}
- component: {fileID: 4600110157238723790}
- component: {fileID: 4600110157238723777}
- component: {fileID: 4600110157238723776}
- component: {fileID: 4600110157238723779}
- component: {fileID: 4093145920273822261}
- component: {fileID: 4470766618279719912}
- component: {fileID: -3542424572169399493}
- component: {fileID: 6970334877957368017}
m_Layer: 0
m_Name: Player
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4600110157238723791
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4600110157238723781}
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: 1935255767028652502}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4600110157238723790
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4600110157238723781}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3}
m_Name:
m_EditorClassIdentifier:
NetworkedInstanceId: 0
PrefabHash: 1897319656204293034
PrefabHashGenerator: Player
AlwaysReplicateAsRoot: 0
DontDestroyWithOwner: 0
--- !u!114 &4600110157238723777
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4600110157238723781}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: edb78c1621dad5149bb47b96120d3fbf, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &4600110157238723776
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4600110157238723781}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 331c67f15523ad7419792662b9768f44, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &4600110157238723779
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4600110157238723781}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fdad0914904cc1e47933ecd7a58514ac, type: 3}
m_Name:
m_EditorClassIdentifier:
m_MovementSpeed: 3
--- !u!114 &4093145920273822261
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4600110157238723781}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9520a47fc61d5ab4ca99cdac2d574909, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ClientVisuals: {fileID: 1935255767028652502}
--- !u!54 &4470766618279719912
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4600110157238723781}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 0
m_IsKinematic: 1
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!195 &-3542424572169399493
NavMeshAgent:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4600110157238723781}
m_Enabled: 0
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!136 &6970334877957368017
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4600110157238723781}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 0
m_Radius: 0.5
m_Height: 2
m_Direction: 1
m_Center: {x: 0, y: 1, z: 0}

7
Assets/BossRoom/Prefabs/Player.prefab.meta


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

8
Assets/BossRoom/Scenes/SampleScene.meta


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

651
Assets/BossRoom/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: bba3bb41c6cbe4947a4e19778cbc40bc, type: 2}
--- !u!1 &74788320
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 74788321}
- component: {fileID: 74788324}
- component: {fileID: 74788323}
- component: {fileID: 74788322}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!4 &74788321
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 74788320}
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: 216673149}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!64 &74788322
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 74788320}
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 &74788323
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 74788320}
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 &74788324
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 74788320}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &216673148
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 216673149}
m_Layer: 0
m_Name: Environment
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!4 &216673149
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 216673148}
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: 74788321}
- {fileID: 586636177}
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &586636173
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 586636177}
- component: {fileID: 586636176}
- component: {fileID: 586636175}
- component: {fileID: 586636174}
m_Layer: 0
m_Name: Cube
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!65 &586636174
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 586636173}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &586636175
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 586636173}
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 &586636176
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 586636173}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &586636177
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 586636173}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -1.462, y: 0.2971146, z: -1.431}
m_LocalScale: {x: 2, y: 1, z: 2}
m_Children: []
m_Father: {fileID: 216673149}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &669501775
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 669501777}
- component: {fileID: 669501776}
- component: {fileID: 669501778}
- component: {fileID: 669501779}
m_Layer: 0
m_Name: NetworkingManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &669501776
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 669501775}
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: 669501778}
RegisteredScenes:
- SampleScene
AllowRuntimeSceneChanges: 0
NetworkedPrefabs:
- Prefab: {fileID: 4600110157238723781, guid: bb87f9bac2595f8499c048016c4b2e1d, type: 3}
PlayerPrefab: 1
PlayerPrefabHash:
id: 0
CreatePlayerPrefab: 1
ReceiveTickrate: 64
MaxReceiveEventsPerTickRate: 500
EventTickrate: 64
ClientConnectionBufferTimeout: 10
ConnectionApproval: 0
ConnectionData:
SecondsHistory: 5
EnableTimeResync: 0
TimeResyncInterval: 30
EnableNetworkedVar: 1
EnsureNetworkedVarLengthSafety: 0
EnableSceneManagement: 1
ForceSamePrefabs: 1
UsePrefabSync: 0
RecycleNetworkIds: 1
NetworkIdRecycleDelay: 120
RpcHashSize: 0
LoadSceneTimeOut: 120
EnableMessageBuffering: 1
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: 1897319656204293034
--- !u!4 &669501777
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 669501775}
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: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &669501778
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 669501775}
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 &669501779
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 669501775}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e26f82009f8f36d45a99adae79eab7b9, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !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: 0
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: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
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: -6}
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}

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

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


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

8
Assets/BossRoom/Scripts/Client.meta


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

17
Assets/BossRoom/Scripts/Client/BossRoom.Client.asmdef


{
"name": "BossRoom.Client",
"rootNamespace": "",
"references": [
"GUID:1491147abca9d7d4bb7105af628b223e",
"GUID:16d7768bae8d50d44b658fc9bb9d4a7d"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

7
Assets/BossRoom/Scripts/Client/BossRoom.Client.asmdef.meta


fileFormatVersion: 2
guid: ed77cc04b29ffca42860b1220217e140
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

45
Assets/BossRoom/Scripts/Client/ClientCharacterVisualization.cs


using BossRoom.Shared;
using MLAPI;
using UnityEngine;
namespace BossRoom.Client
{
/// <summary>
/// <see cref="ClientCharacterVisualization"/> is responsible for displaying a character on the client's screen based on state information sent by the server.
/// </summary>
[RequireComponent(typeof(NetworkCharacterState))]
public class ClientCharacterVisualization : NetworkedBehaviour
{
private NetworkCharacterState m_NetworkCharacterState;
/// <summary>
/// The GameObject which visually represents the character is a child object of the character GameObject. This needs to be the case to support host mode.
/// In host mode <see cref="MonoBehaviour.transform"/> is the transform which is relevant for gameplay.
/// <see cref="m_ClientVisuals"/> is the visual representation on the client side which has interpolated position values.
/// </summary>
[SerializeField]
private Transform m_ClientVisuals;
/// <inheritdoc />
public override void NetworkStart()
{
if (!IsClient)
{
enabled = false;
}
}
void Awake()
{
m_NetworkCharacterState = GetComponent<NetworkCharacterState>();
}
void Update()
{
// TODO [GOMPS-75] Needs core sdk support. This and rotation should grab the interpolated value of network position based on the last received snapshots.
m_ClientVisuals.position = m_NetworkCharacterState.NetworkPosition.Value;
m_ClientVisuals.rotation = Quaternion.Euler(0, m_NetworkCharacterState.NetworkRotationY.Value, 0);
}
}
}

11
Assets/BossRoom/Scripts/Client/ClientCharacterVisualization.cs.meta


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

48
Assets/BossRoom/Scripts/Client/ClientInputSender.cs


using BossRoom.Shared;
using MLAPI;
using UnityEngine;
namespace BossRoom.Client
{
/// <summary>
/// Captures inputs for a character on a client and sends them to the server.
/// </summary>
[RequireComponent(typeof(NetworkCharacterState))]
public class ClientInputSender : NetworkedBehaviour
{
private NetworkCharacterState m_NetworkCharacter;
public override void NetworkStart()
{
// TODO [GOMPS-81] Don't use NetworkedBehaviour for just NetworkStart
if (!IsClient || !IsOwner)
{
enabled = false;
}
}
void Awake()
{
m_NetworkCharacter = GetComponent<NetworkCharacterState>();
}
void FixedUpdate()
{
// TODO [GOMPS-82] replace with new Unity Input System
// Is mouse button pressed (not just checking for down to allow continuous movement inputs by holding the mouse button down)
if (Input.GetMouseButton(0))
{
RaycastHit hit;
if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit))
{
// The MLAPI_INTERNAL channel is a reliable sequenced channel. Inputs should always arrive and be in order that's why this channel is used.
m_NetworkCharacter.InvokeServerRpc(m_NetworkCharacter.SendCharacterInputServerRpc, hit.point,
"MLAPI_INTERNAL");
}
}
}
}
}

11
Assets/BossRoom/Scripts/Client/ClientInputSender.cs.meta


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

8
Assets/BossRoom/Scripts/Server.meta


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

17
Assets/BossRoom/Scripts/Server/BossRoom.Server.asmdef


{
"name": "BossRoom.Server",
"rootNamespace": "",
"references": [
"GUID:1491147abca9d7d4bb7105af628b223e",
"GUID:16d7768bae8d50d44b658fc9bb9d4a7d"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

7
Assets/BossRoom/Scripts/Server/BossRoom.Server.asmdef.meta


fileFormatVersion: 2
guid: e91388c96bf375d4b870c24441e365db
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

108
Assets/BossRoom/Scripts/Server/ServerCharacterMovement.cs


using System;
using System.Linq;
using BossRoom.Shared;
using MLAPI;
using UnityEngine;
using UnityEngine.AI;
namespace BossRoom.Server
{
public enum MovementState
{
Idle = 0,
PathFollowing = 1,
}
/// <summary>
/// Component responsible for moving a character on the server side based on inputs.
/// </summary>
[RequireComponent(typeof(NetworkCharacterState), typeof(NavMeshAgent))]
public class ServerCharacterMovement : NetworkedBehaviour
{
private NavMeshAgent m_NavMeshAgent;
private NetworkCharacterState m_NetworkCharacterState;
private NavMeshPath m_DesiredMovementPath;
private MovementState m_MovementState;
[SerializeField]
private float m_MovementSpeed; // TODO [GOMPS-86] this should be assigned based on character definition
public override void NetworkStart()
{
if (!IsServer)
{
// Disable server component on clients
enabled = false;
return;
}
// On the server enable navMeshAgent and initialize
m_NavMeshAgent.enabled = true;
m_NetworkCharacterState.OnReceivedClientInput += SetMovementTarget;
m_DesiredMovementPath = new NavMeshPath();
}
private void SetMovementTarget(Vector3 position)
{
m_MovementState = MovementState.PathFollowing;
// Recalculate navigation path only on target change.
m_NavMeshAgent.CalculatePath(position, m_DesiredMovementPath);
}
private void Awake()
{
m_NavMeshAgent = GetComponent<NavMeshAgent>();
m_NetworkCharacterState = GetComponent<NetworkCharacterState>();
}
private void FixedUpdate()
{
if (m_MovementState == MovementState.PathFollowing)
{
Movement();
}
// Send new position values to the client
m_NetworkCharacterState.NetworkPosition.Value = transform.position;
m_NetworkCharacterState.NetworkRotationY.Value = transform.rotation.eulerAngles.y;
}
private void Movement()
{
var corners = m_DesiredMovementPath.corners;
// If we don't have a movement path stop moving
if (corners.Length == 0)
{
m_MovementState = MovementState.Idle;
return;
}
var desiredMovementAmount = m_MovementSpeed * Time.fixedDeltaTime;
// If there is less distance to move left in the path than our desired amount
if (Vector3.SqrMagnitude(corners[corners.Length - 1] - transform.position) < (desiredMovementAmount * desiredMovementAmount))
{
// Set to destination and stop moving
transform.position = corners[corners.Length - 1];
m_MovementState = MovementState.Idle;
return;
}
// Get the direction to move along based on the calculated path.
var direction = corners.Length > 1
? (corners[1] - corners[0]).normalized
: throw new InvalidOperationException("Navigation path should have a start and end position");
var movementVector = direction * desiredMovementAmount;
m_NavMeshAgent.Move(movementVector);
transform.rotation = Quaternion.LookRotation(movementVector);
m_NavMeshAgent.CalculatePath(corners[corners.Length - 1], m_DesiredMovementPath);
}
}
}

11
Assets/BossRoom/Scripts/Server/ServerCharacterMovement.cs.meta


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

8
Assets/BossRoom/Scripts/Shared.meta


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

16
Assets/BossRoom/Scripts/Shared/BossRoom.Shared.asmdef


{
"name": "BossRoom.Shared",
"rootNamespace": "",
"references": [
"GUID:1491147abca9d7d4bb7105af628b223e"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

7
Assets/BossRoom/Scripts/Shared/BossRoom.Shared.asmdef.meta


fileFormatVersion: 2
guid: 16d7768bae8d50d44b658fc9bb9d4a7d
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

40
Assets/BossRoom/Scripts/Shared/NetworkCharacterState.cs


using System;
using MLAPI;
using MLAPI.Messaging;
using MLAPI.NetworkedVar;
using UnityEngine;
namespace BossRoom.Shared
{
/// <summary>
/// Contains all NetworkedVars and RPCs of a character. This component is present on both client and server objects.
/// </summary>
public class NetworkCharacterState : NetworkedBehaviour
{
/// <summary>
/// The networked position of this Character. This reflects the authorative position on the server.
/// </summary>
public NetworkedVarVector3 NetworkPosition { get;} = new NetworkedVarVector3();
/// <summary>
/// The networked rotation of this Character. This reflects the authorative rotation on the server.
/// </summary>
public NetworkedVarFloat NetworkRotationY { get; } = new NetworkedVarFloat();
/// <summary>
/// Gets invoked when inputs are received from the client which own this networked character.
/// </summary>
public event Action<Vector3> OnReceivedClientInput;
/// <summary>
/// RPC to send inputs for this character from a client to a server.
/// </summary>
/// <param name="movementTarget">The position which this character should move towards.</param>
[ServerRPC]
public void SendCharacterInputServerRpc(Vector3 movementTarget)
{
OnReceivedClientInput?.Invoke(movementTarget);
}
}
}

11
Assets/BossRoom/Scripts/Shared/NetworkCharacterState.cs.meta


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

/Assets/Scenes.meta → /Assets/BossRoom/Scenes.meta

/Assets/Scripts.meta → /Assets/BossRoom/Scripts.meta

/Assets/Scenes/SampleScene.unity.meta → /Assets/BossRoom/Scenes/SampleScene.unity.meta

/Assets/Scripts/Development.meta → /Assets/BossRoom/Scripts/Development.meta

/Assets/Scripts/Development → /Assets/BossRoom/Scripts/Development

正在加载...
取消
保存