diff --git a/DarkFlow/Assets/Characters/1_Mutant/Mutant.prefab b/DarkFlow/Assets/Characters/1_Mutant/Mutant.prefab index ee7c218..6b42e95 100644 --- a/DarkFlow/Assets/Characters/1_Mutant/Mutant.prefab +++ b/DarkFlow/Assets/Characters/1_Mutant/Mutant.prefab @@ -813,6 +813,14 @@ PrefabInstance: type: 3} insertIndex: -1 addedObject: {fileID: 8027232384722410602} + - targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: a65433442e687234ab8043c546677d72, + type: 3} + insertIndex: -1 + addedObject: {fileID: 8825393132258296762} + - targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: a65433442e687234ab8043c546677d72, + type: 3} + insertIndex: -1 + addedObject: {fileID: 5652289010296803950} m_SourcePrefab: {fileID: 100100000, guid: a65433442e687234ab8043c546677d72, type: 3} --- !u!4 &1469482750486030645 stripped Transform: @@ -884,7 +892,7 @@ CharacterController: m_LayerOverridePriority: 0 m_IsTrigger: 0 m_ProvidesContacts: 0 - m_Enabled: 1 + m_Enabled: 0 serializedVersion: 3 m_Height: 1.47 m_Radius: 0.35 @@ -947,7 +955,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2247144937675617167} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 08144b7c84957034f941f3355775a20d, type: 3} m_Name: @@ -974,8 +982,6 @@ MonoBehaviour: BottomClamp: -30 CameraAngleOverride: 0 LockCameraPosition: 0 - _mainCamera: {fileID: 0} - _cinemachineVirtualCamera: {fileID: 0} --- !u!114 &6233464797961255142 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1021,7 +1027,7 @@ MonoBehaviour: ScaleThreshold: 0.01 UseQuaternionSynchronization: 0 UseQuaternionCompression: 0 - UseHalfFloatPrecision: 0 + UseHalfFloatPrecision: 1 InLocalSpace: 0 Interpolate: 1 SlerpPosition: 0 @@ -1039,3 +1045,35 @@ MonoBehaviour: m_EditorClassIdentifier: TransitionStateInfoList: [] m_Animator: {fileID: 222671947941112760} +--- !u!114 &8825393132258296762 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2247144937675617167} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f05cd39e2b8b7604caee407644cd00c3, type: 3} + m_Name: + m_EditorClassIdentifier: + isObjectPickedUp: + m_InternalValue: 0 + m_LocalHeldPosition: {x: 0, y: 2.85, z: 0} +--- !u!114 &5652289010296803950 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2247144937675617167} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 854c882e4139d184fbbe7fef3fa272e2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ServerPlayerMove: {fileID: 8825393132258296762} + m_CharacterController: {fileID: 2129690468861909873} + m_ThirdPersonController: {fileID: 5509808468128901478} + m_CameraFollow: {fileID: 994559427591439665} + m_PlayerInput: {fileID: 3639033402812819131} diff --git a/DarkFlow/Assets/Characters/2_Erika/Erika.prefab b/DarkFlow/Assets/Characters/2_Erika/Erika.prefab index fdf769d..1eb47ae 100644 --- a/DarkFlow/Assets/Characters/2_Erika/Erika.prefab +++ b/DarkFlow/Assets/Characters/2_Erika/Erika.prefab @@ -1275,6 +1275,10 @@ PrefabInstance: type: 3} insertIndex: -1 addedObject: {fileID: 2021050794510230391} + - targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 4f52f003eca24b843924f016ea500470, + type: 3} + insertIndex: -1 + addedObject: {fileID: 5118577325640955106} - targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 4f52f003eca24b843924f016ea500470, type: 3} insertIndex: -1 @@ -1282,7 +1286,11 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 4f52f003eca24b843924f016ea500470, type: 3} insertIndex: -1 - addedObject: {fileID: 5118577325640955106} + addedObject: {fileID: 716503057832604298} + - targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 4f52f003eca24b843924f016ea500470, + type: 3} + insertIndex: -1 + addedObject: {fileID: 800218253002373474} m_SourcePrefab: {fileID: 100100000, guid: 4f52f003eca24b843924f016ea500470, type: 3} --- !u!1 &4663426026667250098 stripped GameObject: @@ -1302,7 +1310,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3} m_Name: m_EditorClassIdentifier: - GlobalObjectIdHash: 3916998080 + GlobalObjectIdHash: 638232703 AlwaysReplicateAsRoot: 0 SynchronizeTransform: 1 ActiveSceneSynchronization: 0 @@ -1348,7 +1356,7 @@ CharacterController: m_LayerOverridePriority: 0 m_IsTrigger: 0 m_ProvidesContacts: 0 - m_Enabled: 1 + m_Enabled: 0 serializedVersion: 3 m_Height: 1.47 m_Radius: 0.35 @@ -1395,7 +1403,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4663426026667250098} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 08144b7c84957034f941f3355775a20d, type: 3} m_Name: @@ -1422,8 +1430,6 @@ MonoBehaviour: BottomClamp: -30 CameraAngleOverride: 0 LockCameraPosition: 0 - _mainCamera: {fileID: 0} - _cinemachineVirtualCamera: {fileID: 0} --- !u!114 &2021050794510230391 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1443,20 +1449,6 @@ MonoBehaviour: analogMovement: 0 cursorLocked: 1 cursorInputForLook: 1 ---- !u!114 &7905829003486985161 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4663426026667250098} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b02d2af4a8667b7439dfdd74d286fa7c, type: 3} - m_Name: - m_EditorClassIdentifier: - TransitionStateInfoList: [] - m_Animator: {fileID: 7385380308929055139} --- !u!114 &5118577325640955106 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1487,6 +1479,52 @@ MonoBehaviour: InLocalSpace: 0 Interpolate: 1 SlerpPosition: 0 +--- !u!114 &7905829003486985161 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4663426026667250098} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b02d2af4a8667b7439dfdd74d286fa7c, type: 3} + m_Name: + m_EditorClassIdentifier: + TransitionStateInfoList: [] + m_Animator: {fileID: 7385380308929055139} +--- !u!114 &716503057832604298 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4663426026667250098} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f05cd39e2b8b7604caee407644cd00c3, type: 3} + m_Name: + m_EditorClassIdentifier: + isObjectPickedUp: + m_InternalValue: 0 + m_LocalHeldPosition: {x: 0, y: 2.85, z: 0} +--- !u!114 &800218253002373474 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4663426026667250098} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 854c882e4139d184fbbe7fef3fa272e2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ServerPlayerMove: {fileID: 716503057832604298} + m_CharacterController: {fileID: 4810382554605961037} + m_ThirdPersonController: {fileID: 3088514794462180247} + m_CameraFollow: {fileID: 8408292032187987872} + m_PlayerInput: {fileID: 3771768284763951197} --- !u!4 &5475253377034111752 stripped Transform: m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 4f52f003eca24b843924f016ea500470, diff --git a/DarkFlow/Assets/DefaultNetworkPrefabs.asset b/DarkFlow/Assets/DefaultNetworkPrefabs.asset index 4f37506..23881cf 100644 --- a/DarkFlow/Assets/DefaultNetworkPrefabs.asset +++ b/DarkFlow/Assets/DefaultNetworkPrefabs.asset @@ -44,12 +44,6 @@ MonoBehaviour: SourcePrefabToOverride: {fileID: 0} SourceHashToOverride: 0 OverridingTargetPrefab: {fileID: 0} - - Override: 0 - Prefab: {fileID: 8854747452121219810, guid: 773b39ed367c011418f28a8bc3b8ca31, - type: 3} - SourcePrefabToOverride: {fileID: 0} - SourceHashToOverride: 0 - OverridingTargetPrefab: {fileID: 0} - Override: 0 Prefab: {fileID: 1314715293045440502, guid: 5f50a7405c2f67f4189e6a1d45e2bf1d, type: 3} diff --git a/DarkFlow/Assets/Prefabs/Cameras/PlayerFollowCamera.prefab b/DarkFlow/Assets/Prefabs/Cameras/PlayerFollowCamera.prefab index f0b1a11..73600f3 100644 --- a/DarkFlow/Assets/Prefabs/Cameras/PlayerFollowCamera.prefab +++ b/DarkFlow/Assets/Prefabs/Cameras/PlayerFollowCamera.prefab @@ -71,7 +71,6 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 8854747452121219814} - - component: {fileID: 8854747452121219813} - component: {fileID: 368218139850001400} m_Layer: 0 m_Name: PlayerFollowCamera @@ -96,26 +95,6 @@ Transform: - {fileID: 5203344646249168406} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &8854747452121219813 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8854747452121219810} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3} - m_Name: - m_EditorClassIdentifier: - GlobalObjectIdHash: 4247584135 - AlwaysReplicateAsRoot: 0 - SynchronizeTransform: 1 - ActiveSceneSynchronization: 0 - SceneMigrationSynchronization: 1 - SpawnWithObservers: 1 - DontDestroyWithOwner: 0 - AutoObjectParentSync: 1 --- !u!114 &368218139850001400 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/DarkFlow/Assets/Prefabs/Networking/NetworkPrefabs--6834.asset b/DarkFlow/Assets/Prefabs/Networking/NetworkPrefabs--6834.asset new file mode 100644 index 0000000..77f7609 --- /dev/null +++ b/DarkFlow/Assets/Prefabs/Networking/NetworkPrefabs--6834.asset @@ -0,0 +1,46 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e651dbb3fbac04af2b8f5abf007ddc23, type: 3} + m_Name: NetworkPrefabs--6834 + m_EditorClassIdentifier: + IsDefault: 0 + List: + - Override: 0 + Prefab: {fileID: 2247144937675617167, guid: 8935789bd413573419fa49f6379675d7, + type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 4663426026667250098, guid: 301cebf8eacff4b4a83bf8f95afafb31, + type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 5840646621225449203, guid: a0e8f6b1cff6ef747b984e52df011aa4, + type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 2829942877377803283, guid: ca8dae37cae2db2448c0243e11a5afc3, + type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 6821460796240439114, guid: dcfc69b7a3ef9f249b414fbf17ebfdf3, + type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} diff --git a/DarkFlow/Assets/Prefabs/Networking/NetworkPrefabs--6834.asset.meta b/DarkFlow/Assets/Prefabs/Networking/NetworkPrefabs--6834.asset.meta new file mode 100644 index 0000000..59e9b52 --- /dev/null +++ b/DarkFlow/Assets/Prefabs/Networking/NetworkPrefabs--6834.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 02fb61171a90d024dabed40fd213725a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/DarkFlow/Assets/Scenes/Bootstrap.unity b/DarkFlow/Assets/Scenes/Bootstrap.unity index ef6972a..6766b5b 100644 --- a/DarkFlow/Assets/Scenes/Bootstrap.unity +++ b/DarkFlow/Assets/Scenes/Bootstrap.unity @@ -513,6 +513,21 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 6485963998722371857, guid: d3062ecfb0bd4bf4da5e175e5a3e2e8f, + type: 3} + propertyPath: m_ProtocolType + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6485963998722371857, guid: d3062ecfb0bd4bf4da5e175e5a3e2e8f, + type: 3} + propertyPath: ConnectionData.Port + value: 9998 + objectReference: {fileID: 0} + - target: {fileID: 6485963998722371857, guid: d3062ecfb0bd4bf4da5e175e5a3e2e8f, + type: 3} + propertyPath: m_MaxPacketQueueSize + value: 256 + objectReference: {fileID: 0} - target: {fileID: 6485963998722371857, guid: d3062ecfb0bd4bf4da5e175e5a3e2e8f, type: 3} propertyPath: ConnectionData.ServerListenAddress @@ -584,6 +599,22 @@ PrefabInstance: value: objectReference: {fileID: 8854747452121219810, guid: 8be8c45aee6c276479f857be1ffeb2ab, type: 3} + - target: {fileID: 6485963998722371871, guid: d3062ecfb0bd4bf4da5e175e5a3e2e8f, + type: 3} + propertyPath: NetworkConfig.OldPrefabList.Array.size + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6485963998722371871, guid: d3062ecfb0bd4bf4da5e175e5a3e2e8f, + type: 3} + propertyPath: NetworkConfig.Prefabs.NetworkPrefabsLists.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6485963998722371871, guid: d3062ecfb0bd4bf4da5e175e5a3e2e8f, + type: 3} + propertyPath: NetworkConfig.Prefabs.NetworkPrefabsLists.Array.data[0] + value: + objectReference: {fileID: 11400000, guid: a1b89840132a9a74698ff1f0d721f9e2, + type: 2} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] diff --git a/DarkFlow/Assets/Scenes/Gameplay.unity b/DarkFlow/Assets/Scenes/Gameplay.unity index 22af830..7fcad41 100644 --- a/DarkFlow/Assets/Scenes/Gameplay.unity +++ b/DarkFlow/Assets/Scenes/Gameplay.unity @@ -155,6 +155,37 @@ MonoBehaviour: CameraRadius: 0.2 DampingIntoCollision: 0 DampingFromCollision: 2 +--- !u!1 &825465017 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 825465018} + m_Layer: 0 + m_Name: Point (2) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &825465018 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 825465017} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 3, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 1 + m_Children: [] + m_Father: {fileID: 2121872605} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &898180339 PrefabInstance: m_ObjectHideFlags: 0 @@ -243,6 +274,37 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: f66c914e9473afe4796ff1424867c0a5, type: 3} +--- !u!1 &1022041805 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1022041806} + m_Layer: 0 + m_Name: Point (3) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1022041806 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1022041805} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1.94, y: 0, z: 1.01} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 1 + m_Children: [] + m_Father: {fileID: 2121872605} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1058292731 PrefabInstance: m_ObjectHideFlags: 0 @@ -346,6 +408,37 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 154519ab488f20d468de4e06396e2441, type: 3} +--- !u!1 &1367546626 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1367546627} + m_Layer: 0 + m_Name: Point + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1367546627 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1367546626} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -2.43, y: 0, z: 5.15} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 1 + m_Children: [] + m_Father: {fileID: 2121872605} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!4 &1391518848 stripped Transform: m_CorrespondingSourceObject: {fileID: 7539522792964821713, guid: a4c43bf8901061a40a02054aba85ff81, @@ -470,6 +563,37 @@ MonoBehaviour: m_LightCookieSize: {x: 1, y: 1} m_LightCookieOffset: {x: 0, y: 0} m_SoftShadowQuality: 0 +--- !u!1 &1718297848 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1718297849} + m_Layer: 0 + m_Name: Point (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1718297849 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1718297848} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -3.22} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 1 + m_Children: [] + m_Father: {fileID: 2121872605} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1889354785 PrefabInstance: m_ObjectHideFlags: 0 @@ -567,6 +691,59 @@ PrefabInstance: insertIndex: -1 addedObject: {fileID: 107306948} m_SourcePrefab: {fileID: 100100000, guid: 773b39ed367c011418f28a8bc3b8ca31, type: 3} +--- !u!1 &2121872603 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2121872605} + - component: {fileID: 2121872604} + m_Layer: 0 + m_Name: PlayerSpawnPoints + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2121872604 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2121872603} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 756fbc7dbb18d7844b49d5d3d646c911, type: 3} + m_Name: + m_EditorClassIdentifier: + m_SpawnPoints: + - {fileID: 1367546626} + - {fileID: 1718297848} + - {fileID: 825465017} + - {fileID: 1022041805} +--- !u!4 &2121872605 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2121872603} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 1 + m_Children: + - {fileID: 1367546627} + - {fileID: 1718297849} + - {fileID: 825465018} + - {fileID: 1022041806} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &7539522792693849209 PrefabInstance: m_ObjectHideFlags: 0 @@ -661,6 +838,7 @@ SceneRoots: m_Roots: - {fileID: 7539522792693849209} - {fileID: 1549843939} + - {fileID: 2121872605} + - {fileID: 898180339} - {fileID: 1058292731} - {fileID: 1889354785} - - {fileID: 898180339} diff --git a/DarkFlow/Assets/Scripts/CameraFollow.cs b/DarkFlow/Assets/Scripts/CameraFollow.cs deleted file mode 100644 index b087e49..0000000 --- a/DarkFlow/Assets/Scripts/CameraFollow.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Unity.Netcode; -using Cinemachine; -using UnityEngine; -//using UnityEngine.Assertions; - -public class CameraFollow : NetworkBehaviour -{ - - private Transform m_CharFollow; - public CinemachineVirtualCamera m_CamFollow; - - void Start() - { - - if (!IsOwner) { return; } - AttachCamera(); - - } - - private void AttachCamera() - { - - m_CharFollow = GameObject.FindGameObjectWithTag("Player").transform.GetChild(0).transform; - - if (m_CamFollow) - { - m_CamFollow.Follow = m_CharFollow; - m_CamFollow.LookAt = m_CharFollow; - - } - } -} - diff --git a/DarkFlow/Assets/Scripts/ClientPlayerMove.cs b/DarkFlow/Assets/Scripts/ClientPlayerMove.cs new file mode 100644 index 0000000..1a3b24b --- /dev/null +++ b/DarkFlow/Assets/Scripts/ClientPlayerMove.cs @@ -0,0 +1,70 @@ +using System; +using Cinemachine; +using StarterAssets; +using Unity.Netcode; +using UnityEngine; +using UnityEngine.InputSystem; + +/// +/// Assumes client authority +/// +[RequireComponent(typeof(ServerPlayerMove))] +[DefaultExecutionOrder(1)] // after server component +public class ClientPlayerMove : NetworkBehaviour +{ + [SerializeField] + ServerPlayerMove m_ServerPlayerMove; + + [SerializeField] + CharacterController m_CharacterController; + + [SerializeField] + ThirdPersonController m_ThirdPersonController; + + [SerializeField] + Transform m_CameraFollow; + + [SerializeField] + PlayerInput m_PlayerInput; + + void Awake() + { + Cursor.lockState = CursorLockMode.Locked; + Cursor.visible = false; + + // ThirdPersonController & CharacterController are enabled only on owning clients. Ghost player objects have + // these two components disabled, and will enable a CapsuleCollider. Per the CharacterController documentation: + // https://docs.unity3d.com/Manual/CharacterControllers.html, a Character controller can push rigidbody + // objects aside while moving but will not be accelerated by incoming collisions. This means that a primitive + // CapsuleCollider must instead be used for ghost clients to simulate collisions between owning players and + // ghost clients. + m_ThirdPersonController.enabled = false; + m_CharacterController.enabled = false; + } + + public override void OnNetworkSpawn() + { + base.OnNetworkSpawn(); + + enabled = IsClient; + if (!IsOwner) + { + enabled = false; + m_CharacterController.enabled = false; + return; + } + + // player input is only enabled on owning players + m_PlayerInput.enabled = true; + m_ThirdPersonController.enabled = true; + + // see the note inside ServerPlayerMove why this step is also necessary for synchronizing initial player + // position on owning clients + m_CharacterController.enabled = true; + + var cinemachineVirtualCamera = FindObjectOfType(); + cinemachineVirtualCamera.Follow = m_CameraFollow; + } + + +} diff --git a/DarkFlow/Assets/Scripts/CameraFollow.cs.meta b/DarkFlow/Assets/Scripts/ClientPlayerMove.cs.meta similarity index 83% rename from DarkFlow/Assets/Scripts/CameraFollow.cs.meta rename to DarkFlow/Assets/Scripts/ClientPlayerMove.cs.meta index 89ce0b6..5c98bb3 100644 --- a/DarkFlow/Assets/Scripts/CameraFollow.cs.meta +++ b/DarkFlow/Assets/Scripts/ClientPlayerMove.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 437c8746001a80e4cba174abbfefa9ed +guid: 854c882e4139d184fbbe7fef3fa272e2 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/DarkFlow/Assets/Scripts/InputSystem/StarterAssets.inputsettings.asset b/DarkFlow/Assets/Scripts/InputSystem/StarterAssets.inputsettings.asset index 78d298e..1e677e1 100644 --- a/DarkFlow/Assets/Scripts/InputSystem/StarterAssets.inputsettings.asset +++ b/DarkFlow/Assets/Scripts/InputSystem/StarterAssets.inputsettings.asset @@ -17,7 +17,7 @@ MonoBehaviour: m_MaxEventBytesPerUpdate: 5242880 m_MaxQueuedEventsPerUpdate: 1000 m_CompensateForScreenOrientation: 0 - m_BackgroundBehavior: 0 + m_BackgroundBehavior: 1 m_EditorInputBehaviorInPlayMode: 0 m_DefaultDeadzoneMin: 0.125 m_DefaultDeadzoneMax: 0.925 @@ -29,7 +29,6 @@ MonoBehaviour: m_TapRadius: 5 m_MultiTapDelayTime: 0.75 m_DisableRedundantEventsMerging: 0 - m_ShortcutKeysConsumeInputs: 0 m_iOSSettings: m_MotionUsage: m_Enabled: 0 diff --git a/DarkFlow/Assets/Scripts/InputSystem/StarterAssetsInputs.cs b/DarkFlow/Assets/Scripts/InputSystem/StarterAssetsInputs.cs index 9372d1c..d1aa157 100644 --- a/DarkFlow/Assets/Scripts/InputSystem/StarterAssetsInputs.cs +++ b/DarkFlow/Assets/Scripts/InputSystem/StarterAssetsInputs.cs @@ -1,5 +1,5 @@ using UnityEngine; -#if ENABLE_INPUT_SYSTEM +#if ENABLE_INPUT_SYSTEM && STARTER_ASSETS_PACKAGES_CHECKED using UnityEngine.InputSystem; #endif @@ -20,7 +20,7 @@ public class StarterAssetsInputs : MonoBehaviour public bool cursorLocked = true; public bool cursorInputForLook = true; -#if ENABLE_INPUT_SYSTEM +#if ENABLE_INPUT_SYSTEM && STARTER_ASSETS_PACKAGES_CHECKED public void OnMove(InputValue value) { MoveInput(value.Get()); diff --git a/DarkFlow/Assets/Scripts/InputSystem/ThirdPersonController.cs b/DarkFlow/Assets/Scripts/InputSystem/ThirdPersonController.cs index ef5385e..9ae970d 100644 --- a/DarkFlow/Assets/Scripts/InputSystem/ThirdPersonController.cs +++ b/DarkFlow/Assets/Scripts/InputSystem/ThirdPersonController.cs @@ -1,14 +1,10 @@ -using Unity.Netcode; -using Cinemachine; -using UnityEngine; - -#if ENABLE_INPUT_SYSTEM +using UnityEngine; +#if ENABLE_INPUT_SYSTEM using UnityEngine.InputSystem; #endif -/* Note: animations are called via the controller for both -the character and capsule using animator null checks -*/ +/* Note: animations are called via the controller for both the character and capsule using animator null checks + */ namespace StarterAssets { @@ -16,8 +12,7 @@ namespace StarterAssets #if ENABLE_INPUT_SYSTEM [RequireComponent(typeof(PlayerInput))] #endif - //public class ThirdPersonController : MonoBehaviour - public class ThirdPersonController : NetworkBehaviour + public class ThirdPersonController : MonoBehaviour { [Header("Player")] [Tooltip("Move speed of the character in m/s")] @@ -109,19 +104,17 @@ public class ThirdPersonController : NetworkBehaviour private Animator _animator; private CharacterController _controller; private StarterAssetsInputs _input; - - public GameObject _mainCamera; - - public CinemachineVirtualCamera _cinemachineVirtualCamera; + private GameObject _mainCamera; private const float _threshold = 0.01f; + private bool _hasAnimator; private bool IsCurrentDeviceMouse { get { -#if ENABLE_INPUT_SYSTEM +#if ENABLE_INPUT_SYSTEM return _playerInput.currentControlScheme == "KeyboardMouse"; #else return false; @@ -132,70 +125,40 @@ private bool IsCurrentDeviceMouse private void Awake() { - //Initialize(); - - } - - - public override void OnNetworkSpawn() - { - Debug.Log(".......... OnNetworkSpawn"); - Initialize(); - } - - private void Initialize() - { - - //if (!IsClient && !IsOwner && !IsSpawned) { return; } - //if (!IsLocalPlayer || !IsOwner) { return; } - if (!IsOwner) { return; } - Debug.Log(".......... Initialize"); - - _mainCamera = GameObject.FindGameObjectWithTag("MainCamera"); - _playerInput = GetComponent(); - _playerInput.enabled = true; - - _cinemachineVirtualCamera = FindObjectOfType(); - _cinemachineVirtualCamera.Follow = transform.GetChild(0); - _cinemachineVirtualCamera.LookAt = transform.GetChild(0); - + // get a reference to our main camera + if (_mainCamera == null) + { + _mainCamera = GameObject.FindGameObjectWithTag("MainCamera"); + } } - private void Start() - { - _cinemachineTargetYaw = CinemachineCameraTarget.transform.rotation.eulerAngles.y; _hasAnimator = TryGetComponent(out _animator); _controller = GetComponent(); _input = GetComponent(); -#if ENABLE_INPUT_SYSTEM +#if ENABLE_INPUT_SYSTEM _playerInput = GetComponent(); #else - Debug.LogError( "Starter Assets package is missing dependencies."); + Debug.LogError("Starter Assets package is missing dependencies. Please use Tools/Starter Assets/Reinstall Dependencies to fix it"); #endif + AssignAnimationIDs(); // reset our timeouts on start _jumpTimeoutDelta = JumpTimeout; _fallTimeoutDelta = FallTimeout; - - } - private void Update() { - - if (!IsOwner) { return; } - _hasAnimator = TryGetComponent(out _animator); + JumpAndGravity(); GroundedCheck(); Move(); - } private void LateUpdate() @@ -253,16 +216,21 @@ private void Move() // set target speed based on move speed, sprint speed and if sprint is pressed float targetSpeed = _input.sprint ? SprintSpeed : MoveSpeed; + // a simplistic acceleration and deceleration designed to be easy to remove, replace, or iterate upon + + // note: Vector2's == operator uses approximation so is not floating point error prone, and is cheaper than magnitude // if there is no input, set the target speed to 0 if (_input.move == Vector2.zero) targetSpeed = 0.0f; // a reference to the players current horizontal velocity float currentHorizontalSpeed = new Vector3(_controller.velocity.x, 0.0f, _controller.velocity.z).magnitude; + float speedOffset = 0.1f; float inputMagnitude = _input.analogMovement ? _input.move.magnitude : 1f; // accelerate or decelerate to target speed - if (currentHorizontalSpeed < targetSpeed - speedOffset || currentHorizontalSpeed > targetSpeed + speedOffset) + if (currentHorizontalSpeed < targetSpeed - speedOffset || + currentHorizontalSpeed > targetSpeed + speedOffset) { // creates curved result rather than a linear one giving a more organic speed change // note T in Lerp is clamped, so we don't need to clamp our speed @@ -283,24 +251,25 @@ private void Move() // normalise input direction Vector3 inputDirection = new Vector3(_input.move.x, 0.0f, _input.move.y).normalized; - + // note: Vector2's != operator uses approximation so is not floating point error prone, and is cheaper than magnitude // if there is a move input rotate player when the player is moving if (_input.move != Vector2.zero) { - _targetRotation = Mathf.Atan2(inputDirection.x, inputDirection.z) * Mathf.Rad2Deg + _mainCamera.transform.eulerAngles.y; - - float rotation = Mathf.SmoothDampAngle(transform.eulerAngles.y, _targetRotation, ref _rotationVelocity, RotationSmoothTime); + _targetRotation = Mathf.Atan2(inputDirection.x, inputDirection.z) * Mathf.Rad2Deg + + _mainCamera.transform.eulerAngles.y; + float rotation = Mathf.SmoothDampAngle(transform.eulerAngles.y, _targetRotation, ref _rotationVelocity, + RotationSmoothTime); // rotate to face input direction relative to camera position transform.rotation = Quaternion.Euler(0.0f, rotation, 0.0f); - } - //Debug.Log(".......... " + _targetRotation); + Vector3 targetDirection = Quaternion.Euler(0.0f, _targetRotation, 0.0f) * Vector3.forward; // move the player - _controller.Move(targetDirection.normalized * (_speed * Time.deltaTime) + new Vector3(0.0f, _verticalVelocity, 0.0f) * Time.deltaTime); + _controller.Move(targetDirection.normalized * (_speed * Time.deltaTime) + + new Vector3(0.0f, _verticalVelocity, 0.0f) * Time.deltaTime); // update animator if using character if (_hasAnimator) @@ -407,7 +376,9 @@ private void OnFootstep(AnimationEvent animationEvent) if (FootstepAudioClips.Length > 0) { var index = Random.Range(0, FootstepAudioClips.Length); - AudioSource.PlayClipAtPoint(FootstepAudioClips[index], transform.TransformPoint(_controller.center), FootstepAudioVolume); + // MTT CHANGE START (for simplicity's sake, playing at the transform's position suffices) + AudioSource.PlayClipAtPoint(FootstepAudioClips[index], transform.position, FootstepAudioVolume); + // MTT CHANGE END } } } @@ -416,8 +387,10 @@ private void OnLand(AnimationEvent animationEvent) { if (animationEvent.animatorClipInfo.weight > 0.5f) { - AudioSource.PlayClipAtPoint(LandingAudioClip, transform.TransformPoint(_controller.center), FootstepAudioVolume); + // MTT CHANGE START (for simplicity's sake, playing at the transform's position suffices) + AudioSource.PlayClipAtPoint(LandingAudioClip, transform.position, FootstepAudioVolume); + // MTT CHANGE END } } } -} +} \ No newline at end of file diff --git a/DarkFlow/Assets/Scripts/ServerPlayerMove.cs b/DarkFlow/Assets/Scripts/ServerPlayerMove.cs new file mode 100644 index 0000000..aab89f4 --- /dev/null +++ b/DarkFlow/Assets/Scripts/ServerPlayerMove.cs @@ -0,0 +1,55 @@ +using System; +using Unity.Netcode; +using Unity.Netcode.Components; +using UnityEngine; + + +[DefaultExecutionOrder(0)] // before client component +public class ServerPlayerMove : NetworkBehaviour +{ + public NetworkVariable isObjectPickedUp = new NetworkVariable(); + + NetworkObject m_PickedUpObject; + + [SerializeField] + Vector3 m_LocalHeldPosition; + + + public override void OnNetworkSpawn() + { + if (!IsServer) + { + enabled = false; + return; + } + + OnServerSpawnPlayer(); + + base.OnNetworkSpawn(); + } + + void OnServerSpawnPlayer() + { + // this is done server side, so we have a single source of truth for our spawn point list + var spawnPoint = ServerPlayerSpawnPoints.Instance.ConsumeNextSpawnPoint(); + var spawnPosition = spawnPoint ? spawnPoint.transform.position : Vector3.zero; + transform.position = spawnPosition; + + // A note specific to owner authority: + // Side Note: Specific to Owner Authoritative + // Setting the position works as and can be set in OnNetworkSpawn server-side unless there is a + // CharacterController that is enabled by default on the authoritative side. With CharacterController, it + // needs to be disabled by default (i.e. in Awake), the server applies the position (OnNetworkSpawn), and then + // the owner of the NetworkObject should enable CharacterController during OnNetworkSpawn. Otherwise, + // CharacterController will initialize itself with the initial position (before synchronization) and updates the + // transform after synchronization with the initial position, thus overwriting the synchronized position. + } + + + + + + + + +} diff --git a/DarkFlow/Assets/Scripts/ServerPlayerMove.cs.meta b/DarkFlow/Assets/Scripts/ServerPlayerMove.cs.meta new file mode 100644 index 0000000..5f3ba9d --- /dev/null +++ b/DarkFlow/Assets/Scripts/ServerPlayerMove.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f05cd39e2b8b7604caee407644cd00c3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/DarkFlow/Assets/Scripts/ServerPlayerSpawnPoints.cs b/DarkFlow/Assets/Scripts/ServerPlayerSpawnPoints.cs new file mode 100644 index 0000000..222aa17 --- /dev/null +++ b/DarkFlow/Assets/Scripts/ServerPlayerSpawnPoints.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; +using UnityEngine; + +public class ServerPlayerSpawnPoints : MonoBehaviour +{ + [SerializeField] + List m_SpawnPoints; + + static ServerPlayerSpawnPoints s_Instance; + + public static ServerPlayerSpawnPoints Instance + { + get + { + if (s_Instance == null) + { + s_Instance = FindObjectOfType(); + } + + return s_Instance; + } + } + + void OnDestroy() + { + s_Instance = null; + } + + public GameObject ConsumeNextSpawnPoint() + { + if (m_SpawnPoints.Count == 0) + { + return null; + } + + var toReturn = m_SpawnPoints[m_SpawnPoints.Count - 1]; + m_SpawnPoints.RemoveAt(m_SpawnPoints.Count - 1); + return toReturn; + } +} diff --git a/DarkFlow/Assets/Scripts/ServerPlayerSpawnPoints.cs.meta b/DarkFlow/Assets/Scripts/ServerPlayerSpawnPoints.cs.meta new file mode 100644 index 0000000..b3dbe3d --- /dev/null +++ b/DarkFlow/Assets/Scripts/ServerPlayerSpawnPoints.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 756fbc7dbb18d7844b49d5d3d646c911 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: