diff --git a/.yamato/mobile-build-and-run.yml b/.yamato/mobile-build-and-run.yml index 885d67e31..332083314 100644 --- a/.yamato/mobile-build-and-run.yml +++ b/.yamato/mobile-build-and-run.yml @@ -17,7 +17,7 @@ Build_Player_With_Tests_iOS_{{ project.name }}_{{ editor }}: - unity-downloader-cli -c Editor -c iOS -u {{ editor }} --fast --wait - curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr --output utr - chmod +x ./utr - - ./utr --suite=playmode --platform=iOS --editor-location=.Editor --testproject={{ project.path }} --player-save-path=build/players --artifacts_path=build/logs --build-only --testfilter=Unity.Multiplayer.Samples.BossRoom.Tests.Runtime + - ./utr --suite=playmode --platform=iOS --editor-location=.Editor --testproject={{ project.path }} --player-save-path=build/players --artifacts_path=build/logs --build-only --testfilter=Unity.BossRoom.Tests.Runtime artifacts: players: @@ -48,7 +48,7 @@ Build_Player_With_Tests_Android_{{ project.name }}_{{ editor }}: - unity-downloader-cli -c Editor -c Android -u {{ editor }} --fast --wait # Build player(s) - set UTR_VERSION=0.12.0 - - ./utr.bat --suite=playmode --platform=Android --editor-location=.Editor --testproject={{ project.path }} --player-save-path=build/players --artifacts_path=build/logs --scripting-backend=mono --build-only --testfilter=Unity.Multiplayer.Samples.BossRoom.Tests.Runtime + - ./utr.bat --suite=playmode --platform=Android --editor-location=.Editor --testproject={{ project.path }} --player-save-path=build/players --artifacts_path=build/logs --scripting-backend=mono --build-only --testfilter=Unity.BossRoom.Tests.Runtime artifacts: players: paths: @@ -86,7 +86,7 @@ mobile_test_ios_{{ project.name }}_{{ editor }}: # Give UTR execution permissions - chmod +x ./utr # Run the test build on the device - - ./utr --suite=playmode --platform=iOS --player-load-path=build/players --artifacts_path=build/test-results --testfilter=Unity.Multiplayer.Samples.BossRoom.Tests.Runtime + - ./utr --suite=playmode --platform=iOS --player-load-path=build/players --artifacts_path=build/test-results --testfilter=Unity.BossRoom.Tests.Runtime artifacts: logs: @@ -119,7 +119,7 @@ mobile_test_android_{{ project.name }}_{{ editor }}: start %ANDROID_SDK_ROOT%\platform-tools\adb.exe connect %BOKKEN_DEVICE_IP% start %ANDROID_SDK_ROOT%\platform-tools\adb.exe devices set UTR_VERSION=0.12.0 - ./utr --artifacts_path=build/test-results --testproject={{ project.path }} --editor-location=.Editor --reruncount=2 --suite=playmode --platform=android --player-connection-ip=%BOKKEN_HOST_IP% --player-load-path=build/players --testfilter=Unity.Multiplayer.Samples.BossRoom.Tests.Runtime + ./utr --artifacts_path=build/test-results --testproject={{ project.path }} --editor-location=.Editor --reruncount=2 --suite=playmode --platform=android --player-connection-ip=%BOKKEN_HOST_IP% --player-load-path=build/players --testfilter=Unity.BossRoom.Tests.Runtime # Set uploadable artifact paths artifacts: logs: diff --git a/.yamato/project-tests.yml b/.yamato/project-tests.yml index 0f14f925b..c20d3a979 100644 --- a/.yamato/project-tests.yml +++ b/.yamato/project-tests.yml @@ -17,7 +17,7 @@ test_{{ project.name }}_{{ editor }}_{{ platform.name }}: - npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm - pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple - unity-downloader-cli -u {{ editor }} -c editor -w --fast - - upm-ci project test -u {{ editor }} --project-path {{ project.path }} --type project-tests --extra-utr-arg=--testfilter=Unity.Multiplayer.Samples.BossRoom.Tests.Runtime + - upm-ci project test -u {{ editor }} --project-path {{ project.path }} --type project-tests --extra-utr-arg=--testfilter=Unity.BossRoom.Tests.Runtime artifacts: logs: paths: diff --git a/Assets/Prefabs/Character/Character.prefab b/Assets/Prefabs/Character/Character.prefab index 650711076..b8b42c5b0 100644 --- a/Assets/Prefabs/Character/Character.prefab +++ b/Assets/Prefabs/Character/Character.prefab @@ -10,11 +10,8 @@ GameObject: m_Component: - component: {fileID: 4600110157238723791} - component: {fileID: 4600110157238723790} - - component: {fileID: 4600110157238723777} - - component: {fileID: -909640835356089789} - component: {fileID: 514105321093282895} - component: {fileID: -5107732197415868221} - - component: {fileID: -6618539813679097072} - component: {fileID: 7420593339233078707} - component: {fileID: 4058497248645145345} - component: {fileID: 350177175035117514} @@ -24,6 +21,7 @@ GameObject: - component: {fileID: 4309865414312164521} - component: {fileID: 753347877357705413} - component: {fileID: -2014321709067566591} + - component: {fileID: 3884788294438199994} m_Layer: 3 m_Name: Character m_TagString: Player @@ -62,36 +60,6 @@ MonoBehaviour: AlwaysReplicateAsRoot: 0 DontDestroyWithOwner: 0 AutoObjectParentSync: 1 ---- !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: - heldNetworkObject: - m_InternalValue: 0 - m_NetworkHealthState: {fileID: 514105321093282895} - m_NetworkLifeState: {fileID: -5107732197415868221} - m_CharacterClassContainer: {fileID: -6618539813679097072} ---- !u!114 &-909640835356089789 -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: ae9a06a3585027044ababe9f9cb7b8e6, type: 3} - m_Name: - m_EditorClassIdentifier: - m_ClientCharacterVisualization: {fileID: 0} --- !u!114 &514105321093282895 MonoBehaviour: m_ObjectHideFlags: 0 @@ -120,19 +88,6 @@ MonoBehaviour: m_EditorClassIdentifier: m_LifeState: m_InternalValue: 0 ---- !u!114 &-6618539813679097072 -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: 4a3a07abfb44d50469112a0db6a202b2, type: 3} - m_Name: - m_EditorClassIdentifier: - m_CharacterClass: {fileID: 0} --- !u!114 &7420593339233078707 MonoBehaviour: m_ObjectHideFlags: 0 @@ -145,10 +100,11 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 920a440eb254ba348915767fd046027a, type: 3} m_Name: m_EditorClassIdentifier: - m_NetworkCharacterState: {fileID: 4600110157238723777} + m_ClientVisualization: {fileID: 0} + m_CharacterClass: {fileID: 0} m_BrainEnabled: 1 m_KilledDestroyDelaySeconds: 3 - m_StartingAction: 0 + m_StartingAction: {fileID: 0} m_DamageReceiver: {fileID: 753347877357705413} m_Movement: {fileID: 4309865414312164521} m_PhysicsWrapper: {fileID: 4058497248645145345} @@ -248,7 +204,6 @@ MonoBehaviour: m_EditorClassIdentifier: m_NavMeshAgent: {fileID: 745390554272530562} m_Rigidbody: {fileID: 3375535791397456380} - m_NetworkCharacterState: {fileID: 4600110157238723777} m_CharLogic: {fileID: 7420593339233078707} --- !u!114 &753347877357705413 MonoBehaviour: @@ -289,3 +244,16 @@ MonoBehaviour: ScaleThreshold: 0.01 InLocalSpace: 0 Interpolate: 1 +--- !u!114 &3884788294438199994 +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: ebe9bfd21e47445488dfd84b4e0c9884, type: 3} + m_Name: + m_EditorClassIdentifier: + m_AvatarRegistry: {fileID: 11400000, guid: 48d17d764bff6c643a3dc035fb71c979, type: 2} diff --git a/Assets/Prefabs/Character/Imp.prefab b/Assets/Prefabs/Character/Imp.prefab index f38f3b3c8..0075669bf 100644 --- a/Assets/Prefabs/Character/Imp.prefab +++ b/Assets/Prefabs/Character/Imp.prefab @@ -69,16 +69,6 @@ PrefabInstance: objectReference: {fileID: 3121817358174221070} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 1ffde884792e9a44a9fbe049ebb79c9f, type: 3} ---- !u!1 &5858966600248860054 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 6839301660383890230, guid: 1ffde884792e9a44a9fbe049ebb79c9f, type: 3} - m_PrefabInstance: {fileID: 1127359556114831008} - m_PrefabAsset: {fileID: 0} ---- !u!4 &6486568539699693356 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 6170428688339538316, guid: 1ffde884792e9a44a9fbe049ebb79c9f, type: 3} - m_PrefabInstance: {fileID: 1127359556114831008} - m_PrefabAsset: {fileID: 0} --- !u!95 &929086692793228630 stripped Animator: m_CorrespondingSourceObject: {fileID: 234724737205816310, guid: 1ffde884792e9a44a9fbe049ebb79c9f, type: 3} @@ -95,6 +85,11 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 9520a47fc61d5ab4ca99cdac2d574909, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &5858966600248860054 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 6839301660383890230, guid: 1ffde884792e9a44a9fbe049ebb79c9f, type: 3} + m_PrefabInstance: {fileID: 1127359556114831008} + m_PrefabAsset: {fileID: 0} --- !u!114 &5401475423617019972 MonoBehaviour: m_ObjectHideFlags: 0 @@ -108,6 +103,11 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Animator: {fileID: 929086692793228630} +--- !u!4 &6486568539699693356 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 6170428688339538316, guid: 1ffde884792e9a44a9fbe049ebb79c9f, type: 3} + m_PrefabInstance: {fileID: 1127359556114831008} + m_PrefabAsset: {fileID: 0} --- !u!1001 &2173896227866280545 PrefabInstance: m_ObjectHideFlags: 0 @@ -247,6 +247,14 @@ PrefabInstance: propertyPath: animator value: objectReference: {fileID: 929086692793228630} + - target: {fileID: 8398944656959553575, guid: 64cfd098f62285f42918875fef849e88, type: 3} + propertyPath: m_CharacterClass + value: + objectReference: {fileID: 11400000, guid: fa81aca63f2fce545a3b9e046b6e42e7, type: 2} + - target: {fileID: 8398944656959553575, guid: 64cfd098f62285f42918875fef849e88, type: 3} + propertyPath: m_ClientVisualization + value: + objectReference: {fileID: 3121817358174221070} - target: {fileID: 8398944656959553575, guid: 64cfd098f62285f42918875fef849e88, type: 3} propertyPath: m_KilledDestroyDelaySeconds value: 2 @@ -265,27 +273,6 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 64cfd098f62285f42918875fef849e88, type: 3} ---- !u!1 &3713729372785093424 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 3288448142974003537, guid: 64cfd098f62285f42918875fef849e88, type: 3} - m_PrefabInstance: {fileID: 2173896227866280545} - m_PrefabAsset: {fileID: 0} ---- !u!4 &3713729372785093434 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 3288448142974003547, guid: 64cfd098f62285f42918875fef849e88, type: 3} - m_PrefabInstance: {fileID: 2173896227866280545} - m_PrefabAsset: {fileID: 0} ---- !u!114 &9169118397563301302 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 6995351927119310807, guid: 64cfd098f62285f42918875fef849e88, type: 3} - m_PrefabInstance: {fileID: 2173896227866280545} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3713729372785093424} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: ae9a06a3585027044ababe9f9cb7b8e6, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!114 &827948680237315002 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 1537501989561463259, guid: 64cfd098f62285f42918875fef849e88, type: 3} @@ -297,17 +284,11 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6733907396f36c44891916e5c62f25a0, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &3837839015300097846 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 3128178037050369367, guid: 64cfd098f62285f42918875fef849e88, type: 3} +--- !u!1 &3713729372785093424 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 3288448142974003537, guid: 64cfd098f62285f42918875fef849e88, type: 3} m_PrefabInstance: {fileID: 2173896227866280545} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3713729372785093424} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 818290ebb0ac23541921b4dfc6842778, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!114 &-4570750241117365215 MonoBehaviour: m_ObjectHideFlags: 0 @@ -325,8 +306,24 @@ MonoBehaviour: m_UIStatePrefab: {fileID: -1943162842029199943, guid: 2b07482491a17964380023240087ce16, type: 3} m_NetworkNameState: {fileID: 0} m_NetworkHealthState: {fileID: 827948680237315002} - m_ClientCharacter: {fileID: 9169118397563301302} + m_ServerCharacter: {fileID: 0} m_BaseHP: {fileID: 11400000, guid: 95633dc134a4e654f863831b22b5681a, type: 2} m_TransformToTrack: {fileID: 6486568539699693356} m_VerticalWorldOffset: 2.2 m_VerticalScreenOffset: 20 +--- !u!4 &3713729372785093434 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 3288448142974003547, guid: 64cfd098f62285f42918875fef849e88, type: 3} + m_PrefabInstance: {fileID: 2173896227866280545} + m_PrefabAsset: {fileID: 0} +--- !u!114 &3837839015300097846 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 3128178037050369367, guid: 64cfd098f62285f42918875fef849e88, type: 3} + m_PrefabInstance: {fileID: 2173896227866280545} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3713729372785093424} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 818290ebb0ac23541921b4dfc6842778, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Prefabs/Character/ImpBoss.prefab b/Assets/Prefabs/Character/ImpBoss.prefab index a16a005c1..7dae503c9 100644 --- a/Assets/Prefabs/Character/ImpBoss.prefab +++ b/Assets/Prefabs/Character/ImpBoss.prefab @@ -131,6 +131,14 @@ PrefabInstance: propertyPath: animator value: objectReference: {fileID: 8461429659892969874} + - target: {fileID: 8398944656959553575, guid: 64cfd098f62285f42918875fef849e88, type: 3} + propertyPath: m_CharacterClass + value: + objectReference: {fileID: 11400000, guid: 1fdbcd02edb11484a91de118f5ef44b3, type: 2} + - target: {fileID: 8398944656959553575, guid: 64cfd098f62285f42918875fef849e88, type: 3} + propertyPath: m_ClientVisualization + value: + objectReference: {fileID: 5970403413429264330} - target: {fileID: 8398944656959553575, guid: 64cfd098f62285f42918875fef849e88, type: 3} propertyPath: m_KilledDestroyDelaySeconds value: -1 @@ -149,27 +157,6 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 64cfd098f62285f42918875fef849e88, type: 3} ---- !u!1 &3688950541947916333 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 3288448142974003537, guid: 64cfd098f62285f42918875fef849e88, type: 3} - m_PrefabInstance: {fileID: 2203142923062114684} - m_PrefabAsset: {fileID: 0} ---- !u!4 &3688950541947916327 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 3288448142974003547, guid: 64cfd098f62285f42918875fef849e88, type: 3} - m_PrefabInstance: {fileID: 2203142923062114684} - m_PrefabAsset: {fileID: 0} ---- !u!114 &9189411777962710699 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 6995351927119310807, guid: 64cfd098f62285f42918875fef849e88, type: 3} - m_PrefabInstance: {fileID: 2203142923062114684} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3688950541947916333} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: ae9a06a3585027044ababe9f9cb7b8e6, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!114 &848206395698055335 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 1537501989561463259, guid: 64cfd098f62285f42918875fef849e88, type: 3} @@ -181,28 +168,16 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6733907396f36c44891916e5c62f25a0, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &3889605435075370027 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 3128178037050369367, guid: 64cfd098f62285f42918875fef849e88, type: 3} +--- !u!4 &3688950541947916327 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 3288448142974003547, guid: 64cfd098f62285f42918875fef849e88, type: 3} m_PrefabInstance: {fileID: 2203142923062114684} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3688950541947916333} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 818290ebb0ac23541921b4dfc6842778, type: 3} - m_Name: - m_EditorClassIdentifier: ---- !u!114 &2936679228580278264 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 3914205191616059012, guid: 64cfd098f62285f42918875fef849e88, type: 3} +--- !u!1 &3688950541947916333 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 3288448142974003537, guid: 64cfd098f62285f42918875fef849e88, type: 3} m_PrefabInstance: {fileID: 2203142923062114684} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3688950541947916333} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4a3a07abfb44d50469112a0db6a202b2, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!114 &3035161527766636097 MonoBehaviour: m_ObjectHideFlags: 0 @@ -220,7 +195,7 @@ MonoBehaviour: m_UIStatePrefab: {fileID: -1943162842029199943, guid: 2b07482491a17964380023240087ce16, type: 3} m_NetworkNameState: {fileID: 0} m_NetworkHealthState: {fileID: 848206395698055335} - m_ClientCharacter: {fileID: 9189411777962710699} + m_ServerCharacter: {fileID: 0} m_BaseHP: {fileID: 11400000, guid: f393c51c2bce455478a0b995b8d4e3dd, type: 2} m_TransformToTrack: {fileID: 2561745155600296936} m_VerticalWorldOffset: 0 @@ -237,9 +212,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: b7ee3f8e8fb4491495b03f890258082e, type: 3} m_Name: m_EditorClassIdentifier: - m_NetworkLifeState: {fileID: 3889605435075370027} m_CharacterName: The Boss - m_CharacterClass: {fileID: 2936679228580278264} --- !u!114 &8073394427373638825 MonoBehaviour: m_ObjectHideFlags: 0 @@ -254,6 +227,17 @@ MonoBehaviour: m_EditorClassIdentifier: m_NetworkLifeState: {fileID: 3889605435075370027} m_NetworkHealthState: {fileID: 848206395698055335} +--- !u!114 &3889605435075370027 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 3128178037050369367, guid: 64cfd098f62285f42918875fef849e88, type: 3} + m_PrefabInstance: {fileID: 2203142923062114684} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3688950541947916333} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 818290ebb0ac23541921b4dfc6842778, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1001 &8515429031237761636 PrefabInstance: m_ObjectHideFlags: 0 @@ -323,42 +307,42 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 1e8ae28d24c5683478548d7e96e5ba55, type: 3} ---- !u!1 &2938305229903524178 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 6839301660383890230, guid: 1e8ae28d24c5683478548d7e96e5ba55, type: 3} - m_PrefabInstance: {fileID: 8515429031237761636} - m_PrefabAsset: {fileID: 0} --- !u!4 &2561745155600296936 stripped Transform: m_CorrespondingSourceObject: {fileID: 6170428688339538316, guid: 1e8ae28d24c5683478548d7e96e5ba55, type: 3} m_PrefabInstance: {fileID: 8515429031237761636} m_PrefabAsset: {fileID: 0} ---- !u!95 &8461429659892969874 stripped -Animator: - m_CorrespondingSourceObject: {fileID: 234724737205816310, guid: 1e8ae28d24c5683478548d7e96e5ba55, type: 3} +--- !u!1 &2938305229903524178 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 6839301660383890230, guid: 1e8ae28d24c5683478548d7e96e5ba55, type: 3} m_PrefabInstance: {fileID: 8515429031237761636} m_PrefabAsset: {fileID: 0} ---- !u!114 &5970403413429264330 stripped +--- !u!114 &2816369992019265630 MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 2663813019036984750, guid: 1e8ae28d24c5683478548d7e96e5ba55, type: 3} - m_PrefabInstance: {fileID: 8515429031237761636} + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2938305229903524178} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 9520a47fc61d5ab4ca99cdac2d574909, type: 3} + m_Script: {fileID: 11500000, guid: e8d0727d5ae3244e3b569694d3912374, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &2816369992019265630 + m_Animator: {fileID: 8461429659892969874} +--- !u!114 &5970403413429264330 stripped MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} + m_CorrespondingSourceObject: {fileID: 2663813019036984750, guid: 1e8ae28d24c5683478548d7e96e5ba55, type: 3} + m_PrefabInstance: {fileID: 8515429031237761636} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2938305229903524178} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e8d0727d5ae3244e3b569694d3912374, type: 3} + m_Script: {fileID: 11500000, guid: 9520a47fc61d5ab4ca99cdac2d574909, type: 3} m_Name: m_EditorClassIdentifier: - m_Animator: {fileID: 8461429659892969874} +--- !u!95 &8461429659892969874 stripped +Animator: + m_CorrespondingSourceObject: {fileID: 234724737205816310, guid: 1e8ae28d24c5683478548d7e96e5ba55, type: 3} + m_PrefabInstance: {fileID: 8515429031237761636} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Prefabs/Character/PlayerAvatar.prefab b/Assets/Prefabs/Character/PlayerAvatar.prefab index 7a8e3bf4f..80ecc67a1 100644 --- a/Assets/Prefabs/Character/PlayerAvatar.prefab +++ b/Assets/Prefabs/Character/PlayerAvatar.prefab @@ -111,7 +111,7 @@ PrefabInstance: - target: {fileID: 4600110157238723779, guid: 0d2d836e2e83b754fa1a1c4022d6d65d, type: 3} propertyPath: m_NetworkCharacterDefinition value: - objectReference: {fileID: 2466014342928185240} + objectReference: {fileID: 0} - target: {fileID: 4600110157238723781, guid: 0d2d836e2e83b754fa1a1c4022d6d65d, type: 3} propertyPath: m_Name value: PlayerAvatar @@ -176,6 +176,10 @@ PrefabInstance: propertyPath: animator value: objectReference: {fileID: 1829276847453002016} + - target: {fileID: 7420593339233078707, guid: 0d2d836e2e83b754fa1a1c4022d6d65d, type: 3} + propertyPath: m_ClientVisualization + value: + objectReference: {fileID: 7209204667172237188} - target: {fileID: 7690172137830037487, guid: 0d2d836e2e83b754fa1a1c4022d6d65d, type: 3} propertyPath: m_Enabled value: 1 @@ -186,6 +190,7 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: - {fileID: 4462343263575301329, guid: 0d2d836e2e83b754fa1a1c4022d6d65d, type: 3} + - {fileID: -6618539813679097072, guid: 0d2d836e2e83b754fa1a1c4022d6d65d, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 0d2d836e2e83b754fa1a1c4022d6d65d, type: 3} --- !u!114 &741733315856861890 stripped MonoBehaviour: @@ -198,28 +203,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 920a440eb254ba348915767fd046027a, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &2292431908892550450 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: -909640835356089789, guid: 0d2d836e2e83b754fa1a1c4022d6d65d, type: 3} - m_PrefabInstance: {fileID: 7831782662127126385} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6009713983291384756} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: ae9a06a3585027044ababe9f9cb7b8e6, type: 3} - m_Name: - m_EditorClassIdentifier: ---- !u!114 &5230418375993597025 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: -6618539813679097072, guid: 0d2d836e2e83b754fa1a1c4022d6d65d, type: 3} - m_PrefabInstance: {fileID: 7831782662127126385} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6009713983291384756} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4a3a07abfb44d50469112a0db6a202b2, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &6009713983291384756 stripped GameObject: m_CorrespondingSourceObject: {fileID: 4600110157238723781, guid: 0d2d836e2e83b754fa1a1c4022d6d65d, type: 3} @@ -237,19 +220,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d99850df10e83c142b4b65527d7cea91, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &2466014342928185240 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6009713983291384756} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: ebe9bfd21e47445488dfd84b4e0c9884, type: 3} - m_Name: - m_EditorClassIdentifier: - m_AvatarRegistry: {fileID: 11400000, guid: 48d17d764bff6c643a3dc035fb71c979, type: 2} --- !u!114 &2576537793715222015 MonoBehaviour: m_ObjectHideFlags: 0 @@ -265,9 +235,8 @@ MonoBehaviour: m_DisplayHealth: 1 m_DisplayName: 1 m_UIStatePrefab: {fileID: -1943162842029199943, guid: 2b07482491a17964380023240087ce16, type: 3} - m_NetworkNameState: {fileID: -8197545831548902967} m_NetworkHealthState: {fileID: 7751377510591478590} - m_ClientCharacter: {fileID: 2292431908892550450} + m_NetworkNameState: {fileID: -8197545831548902967} m_BaseHP: {fileID: 0} m_TransformToTrack: {fileID: 7902288483105483375} m_VerticalWorldOffset: 2.2 @@ -309,7 +278,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 331c67f15523ad7419792662b9768f44, type: 3} m_Name: m_EditorClassIdentifier: - m_CharacterClassContainer: {fileID: 5230418375993597025} m_PhysicsWrapper: {fileID: 6116655102486013040} --- !u!114 &4887850889182527394 MonoBehaviour: @@ -323,9 +291,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: b7ee3f8e8fb4491495b03f890258082e, type: 3} m_Name: m_EditorClassIdentifier: - m_NetworkLifeState: {fileID: 6173771494986166194} m_CharacterName: - m_CharacterClass: {fileID: 5230418375993597025} --- !u!114 &5043718152237111612 MonoBehaviour: m_ObjectHideFlags: 0 @@ -352,7 +318,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_GraphicsAnimator: {fileID: 1829276847453002016} - m_NetworkAvatarGuidState: {fileID: 2466014342928185240} + m_NetworkAvatarGuidState: {fileID: 6438351454149486027} --- !u!114 &7232939173259361562 MonoBehaviour: m_ObjectHideFlags: 0 @@ -382,15 +348,15 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: bc85fa0320dca1545a3e037ee46391cf, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &6173771494986166194 stripped +--- !u!114 &6438351454149486027 stripped MonoBehaviour: - m_CorrespondingSourceObject: {fileID: -5107732197415868221, guid: 0d2d836e2e83b754fa1a1c4022d6d65d, type: 3} + m_CorrespondingSourceObject: {fileID: 3884788294438199994, guid: 0d2d836e2e83b754fa1a1c4022d6d65d, type: 3} m_PrefabInstance: {fileID: 7831782662127126385} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6009713983291384756} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 818290ebb0ac23541921b4dfc6842778, type: 3} + m_Script: {fileID: 11500000, guid: ebe9bfd21e47445488dfd84b4e0c9884, type: 3} m_Name: m_EditorClassIdentifier: --- !u!114 &7751377510591478590 stripped diff --git a/Assets/Prefabs/Character/VandalImp.prefab b/Assets/Prefabs/Character/VandalImp.prefab index ae2fcbe57..ef208dae0 100644 --- a/Assets/Prefabs/Character/VandalImp.prefab +++ b/Assets/Prefabs/Character/VandalImp.prefab @@ -172,6 +172,14 @@ PrefabInstance: propertyPath: m_ClientCharacterVisualization value: objectReference: {fileID: 3806176119258990995} + - target: {fileID: 8398944656959553575, guid: 64cfd098f62285f42918875fef849e88, type: 3} + propertyPath: m_CharacterClass + value: + objectReference: {fileID: 11400000, guid: 686e97a1c3abaf243a72ce1c5a9d7a9f, type: 2} + - target: {fileID: 8398944656959553575, guid: 64cfd098f62285f42918875fef849e88, type: 3} + propertyPath: m_ClientVisualization + value: + objectReference: {fileID: 3806176119258990995} - target: {fileID: 8398944656959553575, guid: 64cfd098f62285f42918875fef849e88, type: 3} propertyPath: m_KilledDestroyDelaySeconds value: 2 @@ -198,9 +206,8 @@ MonoBehaviour: m_DisplayHealth: 1 m_DisplayName: 0 m_UIStatePrefab: {fileID: -1943162842029199943, guid: 2b07482491a17964380023240087ce16, type: 3} - m_NetworkNameState: {fileID: 0} m_NetworkHealthState: {fileID: 4217591550483468666} - m_ClientCharacter: {fileID: 5676175182600834934} + m_NetworkNameState: {fileID: 0} m_BaseHP: {fileID: 11400000, guid: f41e9bb72a80c694d81c8038aaa732a6, type: 2} m_TransformToTrack: {fileID: 5009206627901439409} m_VerticalWorldOffset: 2.2 @@ -221,14 +228,3 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6733907396f36c44891916e5c62f25a0, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &5676175182600834934 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 6995351927119310807, guid: 64cfd098f62285f42918875fef849e88, type: 3} - m_PrefabInstance: {fileID: 3445720743357571233} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 176558388678216176} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: ae9a06a3585027044ababe9f9cb7b8e6, type: 3} - m_Name: - m_EditorClassIdentifier: diff --git a/Assets/Prefabs/Dungeon/Dungeon Pieces/pots/env_pot.prefab b/Assets/Prefabs/Dungeon/Dungeon Pieces/pots/env_pot.prefab index 7df8ce113..a182fbae4 100644 --- a/Assets/Prefabs/Dungeon/Dungeon Pieces/pots/env_pot.prefab +++ b/Assets/Prefabs/Dungeon/Dungeon Pieces/pots/env_pot.prefab @@ -11,7 +11,6 @@ GameObject: - component: {fileID: 3325143161705299546} - component: {fileID: 445632146649864073} - component: {fileID: 7463718357983197496} - - component: {fileID: -2116509465241817417} - component: {fileID: 1105258724552395641} m_Layer: 6 m_Name: env_pot @@ -86,19 +85,6 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!65 &-2116509465241817417 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4371491365999748502} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1.573169, y: 1.7050593, z: 2.3699942} - m_Center: {x: -0.00072851777, y: 0.84555674, z: 0.00000011920929} --- !u!205 &1105258724552395641 LODGroup: m_ObjectHideFlags: 0 @@ -133,7 +119,6 @@ GameObject: - component: {fileID: 4351019165808278882} - component: {fileID: 1992051593484461120} - component: {fileID: 58995602954167653} - - component: {fileID: 572313768502490765} m_Layer: 6 m_Name: env_pot_LOD1 m_TagString: Untagged @@ -206,16 +191,3 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!65 &572313768502490765 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6662347260629290564} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1.573169, y: 1.7050593, z: 2.3699942} - m_Center: {x: -0.00072851777, y: 0.84555674, z: 0.00000011920929} diff --git a/Assets/Prefabs/Game/Arrow.prefab b/Assets/Prefabs/Game/Arrow.prefab index 2d41051c3..88534c00c 100644 --- a/Assets/Prefabs/Game/Arrow.prefab +++ b/Assets/Prefabs/Game/Arrow.prefab @@ -13,7 +13,6 @@ GameObject: - component: {fileID: 3502399447191095046} - component: {fileID: 7839532612941405576} - component: {fileID: 144087972406990258} - - component: {fileID: 1392226273213099329} m_Layer: 7 m_Name: Arrow m_TagString: Untagged @@ -104,20 +103,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: a091211e6ee54d14f965bccf3b7db5bd, type: 3} m_Name: m_EditorClassIdentifier: - m_NetState: {fileID: 1392226273213099329} m_OurCollider: {fileID: 8403335067046434128} ---- !u!114 &1392226273213099329 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2842198241268549130} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 9f1775357f78b684294a25ef49f1a97d, type: 3} - m_Name: - m_EditorClassIdentifier: + m_OnHitParticlePrefab: {fileID: 0} + m_TrailRenderer: {fileID: 1980287036615436777} + m_Visualization: {fileID: 4059957049433480825} --- !u!1001 &1617519574143475747 PrefabInstance: m_ObjectHideFlags: 0 @@ -205,8 +194,14 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - m_RemovedComponents: [] + m_RemovedComponents: + - {fileID: 153916515354694390, guid: 7efe25e27bd78fe43a07ecddd75be717, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 7efe25e27bd78fe43a07ecddd75be717, type: 3} +--- !u!96 &1980287036615436777 stripped +TrailRenderer: + m_CorrespondingSourceObject: {fileID: 939547987977570762, guid: 7efe25e27bd78fe43a07ecddd75be717, type: 3} + m_PrefabInstance: {fileID: 1617519574143475747} + m_PrefabAsset: {fileID: 0} --- !u!4 &4059957049433480825 stripped Transform: m_CorrespondingSourceObject: {fileID: 3325143161705299546, guid: 7efe25e27bd78fe43a07ecddd75be717, type: 3} diff --git a/Assets/Prefabs/Game/BreakableCrystal.prefab b/Assets/Prefabs/Game/BreakableCrystal.prefab index e2fb8c868..c14b25bc6 100644 --- a/Assets/Prefabs/Game/BreakableCrystal.prefab +++ b/Assets/Prefabs/Game/BreakableCrystal.prefab @@ -10,10 +10,8 @@ GameObject: m_Component: - component: {fileID: 4505851899529102149} - component: {fileID: -8668463530818694599} - - component: {fileID: 7561466626167410996} - component: {fileID: -8903857516321632127} - component: {fileID: 8991873088713291135} - - component: {fileID: 1078500237150943861} - component: {fileID: 1536483666502863715} - component: {fileID: 3135071028605826927} m_Layer: 6 @@ -55,20 +53,6 @@ MonoBehaviour: AlwaysReplicateAsRoot: 0 DontDestroyWithOwner: 0 AutoObjectParentSync: 1 ---- !u!114 &7561466626167410996 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 884761565141663561} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 07cb03f8b4d75ed4abb9801aa531be91, type: 3} - m_Name: - m_EditorClassIdentifier: - IsBroken: - m_InternalValue: 0 --- !u!114 &-8903857516321632127 MonoBehaviour: m_ObjectHideFlags: 0 @@ -85,6 +69,13 @@ MonoBehaviour: m_NetworkHealthState: {fileID: 1536483666502863715} m_Collider: {fileID: 8991873088713291135} m_SpecialDamageFlags: 0 + m_BrokenPrefab: {fileID: 2858583284541929654, guid: a10826c3d0e970f459ad7c6883267d2c, type: 3} + m_PrebrokenPrefab: {fileID: 0} + m_BrokenPrefabPos: {fileID: 2925848032892422867} + m_UnbrokenGameObjects: + - {fileID: 2580953892932309097} + IsBroken: + m_InternalValue: 0 --- !u!136 &8991873088713291135 CapsuleCollider: m_ObjectHideFlags: 0 @@ -99,24 +90,6 @@ CapsuleCollider: m_Height: 2 m_Direction: 1 m_Center: {x: 0, y: 1, z: 0} ---- !u!114 &1078500237150943861 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 884761565141663561} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53ee998b78e989840b42284bf1b455ad, type: 3} - m_Name: - m_EditorClassIdentifier: - m_BrokenPrefab: {fileID: 2858583284541929654, guid: a10826c3d0e970f459ad7c6883267d2c, type: 3} - m_PrebrokenPrefab: {fileID: 0} - m_BrokenPrefabPos: {fileID: 2925848032892422867} - m_UnbrokenGameObjects: - - {fileID: 2580953892932309097} - m_NetState: {fileID: 7561466626167410996} --- !u!114 &1536483666502863715 MonoBehaviour: m_ObjectHideFlags: 0 @@ -146,9 +119,8 @@ MonoBehaviour: m_DisplayHealth: 1 m_DisplayName: 0 m_UIStatePrefab: {fileID: -1943162842029199943, guid: 2b07482491a17964380023240087ce16, type: 3} - m_NetworkNameState: {fileID: 0} m_NetworkHealthState: {fileID: 1536483666502863715} - m_ClientCharacter: {fileID: 0} + m_NetworkNameState: {fileID: 0} m_BaseHP: {fileID: 11400000, guid: 35bb8d80ab89bf64aa87c6e1a7863370, type: 2} m_TransformToTrack: {fileID: 2925848032892422867} m_VerticalWorldOffset: 0 diff --git a/Assets/Prefabs/Game/BreakablePillar.prefab b/Assets/Prefabs/Game/BreakablePillar.prefab index 5671f499a..7aee6489b 100644 --- a/Assets/Prefabs/Game/BreakablePillar.prefab +++ b/Assets/Prefabs/Game/BreakablePillar.prefab @@ -10,10 +10,8 @@ GameObject: m_Component: - component: {fileID: 4505851899529102149} - component: {fileID: -8668463530818694599} - - component: {fileID: 7561466626167410996} - component: {fileID: -8903857516321632127} - component: {fileID: 1460791283510277443} - - component: {fileID: 7670444733571025649} - component: {fileID: 6825752226794478105} m_Layer: 6 m_Name: BreakablePillar @@ -32,6 +30,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 5054035021295717131} m_Father: {fileID: 0} @@ -53,20 +52,6 @@ MonoBehaviour: AlwaysReplicateAsRoot: 0 DontDestroyWithOwner: 0 AutoObjectParentSync: 1 ---- !u!114 &7561466626167410996 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 884761565141663561} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 07cb03f8b4d75ed4abb9801aa531be91, type: 3} - m_Name: - m_EditorClassIdentifier: - IsBroken: - m_InternalValue: 0 --- !u!114 &-8903857516321632127 MonoBehaviour: m_ObjectHideFlags: 0 @@ -83,6 +68,13 @@ MonoBehaviour: m_NetworkHealthState: {fileID: 0} m_Collider: {fileID: 1460791283510277443} m_SpecialDamageFlags: 6 + m_BrokenPrefab: {fileID: 6418514439632820891, guid: 78436b90c00aaab49b4d522550dd9250, type: 3} + m_PrebrokenPrefab: {fileID: 0} + m_BrokenPrefabPos: {fileID: 4505851899529102149} + m_UnbrokenGameObjects: + - {fileID: 3658718798844854089} + IsBroken: + m_InternalValue: 0 --- !u!65 &1460791283510277443 BoxCollider: m_ObjectHideFlags: 0 @@ -96,24 +88,6 @@ BoxCollider: serializedVersion: 2 m_Size: {x: 3.54, y: 8.287147, z: 3.8} m_Center: {x: 1.18, y: 4.1465364, z: 2} ---- !u!114 &7670444733571025649 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 884761565141663561} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53ee998b78e989840b42284bf1b455ad, type: 3} - m_Name: - m_EditorClassIdentifier: - m_BrokenPrefab: {fileID: 6418514439632820891, guid: 78436b90c00aaab49b4d522550dd9250, type: 3} - m_PrebrokenPrefab: {fileID: 0} - m_BrokenPrefabPos: {fileID: 4505851899529102149} - m_UnbrokenGameObjects: - - {fileID: 3658718798844854089} - m_NetState: {fileID: 7561466626167410996} --- !u!54 &6825752226794478105 Rigidbody: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Game/BreakablePot.prefab b/Assets/Prefabs/Game/BreakablePot.prefab index 8f40f68a9..0abf29662 100644 --- a/Assets/Prefabs/Game/BreakablePot.prefab +++ b/Assets/Prefabs/Game/BreakablePot.prefab @@ -9,11 +9,9 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 4505851899529102149} - - component: {fileID: 7561466626167410996} - component: {fileID: -8668463530818694599} - component: {fileID: -8903857516321632127} - component: {fileID: 8991873088713291135} - - component: {fileID: 3650973476923201136} m_Layer: 6 m_Name: BreakablePot m_TagString: Untagged @@ -31,25 +29,12 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1927651668276376163} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &7561466626167410996 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 884761565141663561} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 07cb03f8b4d75ed4abb9801aa531be91, type: 3} - m_Name: - m_EditorClassIdentifier: - IsBroken: - m_InternalValue: 0 --- !u!114 &-8668463530818694599 MonoBehaviour: m_ObjectHideFlags: 0 @@ -82,6 +67,13 @@ MonoBehaviour: m_NetworkHealthState: {fileID: 0} m_Collider: {fileID: 8991873088713291135} m_SpecialDamageFlags: 0 + m_BrokenPrefab: {fileID: 1001931975397017578, guid: 03e282e700b05664daab32d4e7965212, type: 3} + m_PrebrokenPrefab: {fileID: 3819967873106414044, guid: 98dce1da5a97464448a4290ecfd75607, type: 3} + m_BrokenPrefabPos: {fileID: 1927651668276376163} + m_UnbrokenGameObjects: + - {fileID: 598843305552521647} + IsBroken: + m_InternalValue: 0 --- !u!136 &8991873088713291135 CapsuleCollider: m_ObjectHideFlags: 0 @@ -96,24 +88,6 @@ CapsuleCollider: m_Height: 2 m_Direction: 1 m_Center: {x: 0, y: 1, z: 0} ---- !u!114 &3650973476923201136 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 884761565141663561} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53ee998b78e989840b42284bf1b455ad, type: 3} - m_Name: - m_EditorClassIdentifier: - m_BrokenPrefab: {fileID: 1001931975397017578, guid: 03e282e700b05664daab32d4e7965212, type: 3} - m_PrebrokenPrefab: {fileID: 3819967873106414044, guid: 98dce1da5a97464448a4290ecfd75607, type: 3} - m_BrokenPrefabPos: {fileID: 1927651668276376163} - m_UnbrokenGameObjects: - - {fileID: 598843305552521647} - m_NetState: {fileID: 7561466626167410996} --- !u!1001 &3811502052812393529 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Game/ChargedArrow1.prefab b/Assets/Prefabs/Game/ChargedArrow1.prefab index b30741be0..db56e8657 100644 --- a/Assets/Prefabs/Game/ChargedArrow1.prefab +++ b/Assets/Prefabs/Game/ChargedArrow1.prefab @@ -13,7 +13,6 @@ GameObject: - component: {fileID: 3502399447191095046} - component: {fileID: -1136310187947973561} - component: {fileID: 144087972406990258} - - component: {fileID: 1392226273213099329} m_Layer: 7 m_Name: ChargedArrow1 m_TagString: Untagged @@ -104,20 +103,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: a091211e6ee54d14f965bccf3b7db5bd, type: 3} m_Name: m_EditorClassIdentifier: - m_NetState: {fileID: 1392226273213099329} m_OurCollider: {fileID: 8403335067046434128} ---- !u!114 &1392226273213099329 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2842198241268549130} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 9f1775357f78b684294a25ef49f1a97d, type: 3} - m_Name: - m_EditorClassIdentifier: + m_OnHitParticlePrefab: {fileID: 8618909711417914730, guid: dc9de50a71cc1854586afa8a275a6a6b, type: 3} + m_TrailRenderer: {fileID: 1758917354011932238} + m_Visualization: {fileID: 761584903563702131} --- !u!1001 &2645013183017095465 PrefabInstance: m_ObjectHideFlags: 0 @@ -173,10 +162,16 @@ PrefabInstance: propertyPath: m_Name value: ChargedArrow1Graphics objectReference: {fileID: 0} - m_RemovedComponents: [] + m_RemovedComponents: + - {fileID: 153916515354694390, guid: 585c6ea238a48fa42aff7b37c4ce9964, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 585c6ea238a48fa42aff7b37c4ce9964, type: 3} --- !u!4 &761584903563702131 stripped Transform: m_CorrespondingSourceObject: {fileID: 3325143161705299546, guid: 585c6ea238a48fa42aff7b37c4ce9964, type: 3} m_PrefabInstance: {fileID: 2645013183017095465} m_PrefabAsset: {fileID: 0} +--- !u!96 &1758917354011932238 stripped +TrailRenderer: + m_CorrespondingSourceObject: {fileID: 4385405951865464679, guid: 585c6ea238a48fa42aff7b37c4ce9964, type: 3} + m_PrefabInstance: {fileID: 2645013183017095465} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Prefabs/Game/ChargedArrow2.prefab b/Assets/Prefabs/Game/ChargedArrow2.prefab index 47acb3ea6..dc3e1964b 100644 --- a/Assets/Prefabs/Game/ChargedArrow2.prefab +++ b/Assets/Prefabs/Game/ChargedArrow2.prefab @@ -13,7 +13,6 @@ GameObject: - component: {fileID: 3502399447191095046} - component: {fileID: -3511301982335683285} - component: {fileID: 144087972406990258} - - component: {fileID: 1392226273213099329} m_Layer: 7 m_Name: ChargedArrow2 m_TagString: Untagged @@ -104,20 +103,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: a091211e6ee54d14f965bccf3b7db5bd, type: 3} m_Name: m_EditorClassIdentifier: - m_NetState: {fileID: 1392226273213099329} m_OurCollider: {fileID: 8403335067046434128} ---- !u!114 &1392226273213099329 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2842198241268549130} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 9f1775357f78b684294a25ef49f1a97d, type: 3} - m_Name: - m_EditorClassIdentifier: + m_OnHitParticlePrefab: {fileID: -6745866273066112404, guid: ae64395b058ab5e4db24271fb6fadb93, type: 3} + m_TrailRenderer: {fileID: 4685086537884760797} + m_Visualization: {fileID: 6052162863261286440} --- !u!1001 &9068228851964018290 PrefabInstance: m_ObjectHideFlags: 0 @@ -173,8 +162,14 @@ PrefabInstance: propertyPath: m_Name value: ChargedArrow2Graphics objectReference: {fileID: 0} - m_RemovedComponents: [] + m_RemovedComponents: + - {fileID: 153916515354694390, guid: 113758aacd326b5478e4d68c739b6cb8, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 113758aacd326b5478e4d68c739b6cb8, type: 3} +--- !u!96 &4685086537884760797 stripped +TrailRenderer: + m_CorrespondingSourceObject: {fileID: 4385405951379145903, guid: 113758aacd326b5478e4d68c739b6cb8, type: 3} + m_PrefabInstance: {fileID: 9068228851964018290} + m_PrefabAsset: {fileID: 0} --- !u!4 &6052162863261286440 stripped Transform: m_CorrespondingSourceObject: {fileID: 3325143161705299546, guid: 113758aacd326b5478e4d68c739b6cb8, type: 3} diff --git a/Assets/Prefabs/Game/ChargedArrow3.prefab b/Assets/Prefabs/Game/ChargedArrow3.prefab index 66f533633..0423e964c 100644 --- a/Assets/Prefabs/Game/ChargedArrow3.prefab +++ b/Assets/Prefabs/Game/ChargedArrow3.prefab @@ -13,7 +13,6 @@ GameObject: - component: {fileID: 3502399447191095046} - component: {fileID: -2604036011194100329} - component: {fileID: 144087972406990258} - - component: {fileID: 1392226273213099329} m_Layer: 7 m_Name: ChargedArrow3 m_TagString: Untagged @@ -104,20 +103,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: a091211e6ee54d14f965bccf3b7db5bd, type: 3} m_Name: m_EditorClassIdentifier: - m_NetState: {fileID: 1392226273213099329} m_OurCollider: {fileID: 8403335067046434128} ---- !u!114 &1392226273213099329 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2842198241268549130} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 9f1775357f78b684294a25ef49f1a97d, type: 3} - m_Name: - m_EditorClassIdentifier: + m_OnHitParticlePrefab: {fileID: 4562743285343113751, guid: 274d5f31ee594904399cb65bae8ec339, type: 3} + m_TrailRenderer: {fileID: 9219353030242320945} + m_Visualization: {fileID: 7856784432745151475} --- !u!1001 &4840718439739065769 PrefabInstance: m_ObjectHideFlags: 0 @@ -180,3 +169,8 @@ Transform: m_CorrespondingSourceObject: {fileID: 3325143161705299546, guid: 6a92ad6db28369f4bb6b63e3fcf3cf7f, type: 3} m_PrefabInstance: {fileID: 4840718439739065769} m_PrefabAsset: {fileID: 0} +--- !u!96 &9219353030242320945 stripped +TrailRenderer: + m_CorrespondingSourceObject: {fileID: 4385405950053795736, guid: 6a92ad6db28369f4bb6b63e3fcf3cf7f, type: 3} + m_PrefabInstance: {fileID: 4840718439739065769} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Prefabs/Game/EnemySpawner.prefab b/Assets/Prefabs/Game/EnemySpawner.prefab index 60921a65b..9d776c394 100644 --- a/Assets/Prefabs/Game/EnemySpawner.prefab +++ b/Assets/Prefabs/Game/EnemySpawner.prefab @@ -360,9 +360,8 @@ GameObject: - component: {fileID: 8727022540156222958} - component: {fileID: -1287160331463954971} - component: {fileID: 4844841199312666291} - - component: {fileID: 2847004539442057774} - component: {fileID: 4501025776099328933} - - component: {fileID: 3157323278774936386} + - component: {fileID: 5343699662503375493} m_Layer: 6 m_Name: EnemySpawner m_TagString: Untagged @@ -453,20 +452,6 @@ MonoBehaviour: m_MinSpawnCap: 2 m_MaxSpawnCap: 10 m_SpawnCapIncreasePerPlayer: 1 ---- !u!114 &2847004539442057774 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6205854018081152875} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 07cb03f8b4d75ed4abb9801aa531be91, type: 3} - m_Name: - m_EditorClassIdentifier: - IsBroken: - m_InternalValue: 0 --- !u!114 &4501025776099328933 MonoBehaviour: m_ObjectHideFlags: 0 @@ -481,7 +466,9 @@ MonoBehaviour: m_EditorClassIdentifier: m_BreakableElements: [] m_DormantCooldown: 180 ---- !u!114 &3157323278774936386 + IsBroken: + m_InternalValue: 0 +--- !u!114 &5343699662503375493 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -490,9 +477,13 @@ MonoBehaviour: m_GameObject: {fileID: 6205854018081152875} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53ee998b78e989840b42284bf1b455ad, type: 3} + m_Script: {fileID: 11500000, guid: eb44a31731a459546bdf01f1af48173c, type: 3} m_Name: m_EditorClassIdentifier: + m_MaxHealth: {fileID: 0} + m_NetworkHealthState: {fileID: 0} + m_Collider: {fileID: 0} + m_SpecialDamageFlags: 0 m_BrokenPrefab: {fileID: 0} m_PrebrokenPrefab: {fileID: 0} m_BrokenPrefabPos: {fileID: 8727022540156222958} @@ -500,7 +491,8 @@ MonoBehaviour: - {fileID: 6584753279329625147} - {fileID: 3587901247331972367} - {fileID: 5320772107039249662} - m_NetState: {fileID: 2847004539442057774} + IsBroken: + m_InternalValue: 0 --- !u!1 &6584753279329625147 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Game/ImpTossedItem.prefab b/Assets/Prefabs/Game/ImpTossedItem.prefab index b6efa9f03..c9d4d31a8 100644 --- a/Assets/Prefabs/Game/ImpTossedItem.prefab +++ b/Assets/Prefabs/Game/ImpTossedItem.prefab @@ -46,7 +46,6 @@ GameObject: - component: {fileID: 3757530492134123977} - component: {fileID: 6563030650317158872} - component: {fileID: 6687170048049847228} - - component: {fileID: 5792943200133235216} - component: {fileID: 6117531884891153614} - component: {fileID: 1764934990006973250} - component: {fileID: 5323097792596109926} @@ -205,18 +204,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 ---- !u!114 &5792943200133235216 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5473352307376472481} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 2f9ce43d3a12cc143a792bd3006335bf, type: 3} - m_Name: - m_EditorClassIdentifier: m_TossedItemVisualTransform: {fileID: 6872988056795508615} m_TossedObjectGraphics: {fileID: 4462238722508864556} m_FallingSound: {fileID: 6117531884891153614} diff --git a/Assets/Prefabs/Game/InteractiveBossDoor.prefab b/Assets/Prefabs/Game/InteractiveBossDoor.prefab index 3f9bb7830..285e8f1ce 100644 --- a/Assets/Prefabs/Game/InteractiveBossDoor.prefab +++ b/Assets/Prefabs/Game/InteractiveBossDoor.prefab @@ -26,6 +26,7 @@ Transform: m_LocalRotation: {x: 0, y: -0, z: -0, w: 1} m_LocalPosition: {x: -3.33389, y: 5.1356144, z: -0.00000047683716} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 5281082990251655230} m_RootOrder: 0 @@ -56,6 +57,7 @@ Transform: m_LocalRotation: {x: 0, y: -0.00000011920929, z: -0, w: 1} m_LocalPosition: {x: 3.2996511, y: 5.1356144, z: -0.00000047683716} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 5281082990251655230} m_RootOrder: 1 @@ -88,6 +90,7 @@ Transform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 5, z: 0} m_LocalScale: {x: 12, y: 10, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1962970309805677278} m_RootOrder: 0 @@ -149,6 +152,7 @@ Transform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 5, z: 0} m_LocalScale: {x: 12, y: 10, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1962970309805677278} m_RootOrder: 1 @@ -208,6 +212,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 3784045606710551546} - {fileID: 1067615519027872932} @@ -240,6 +245,7 @@ Transform: m_LocalRotation: {x: -1.7112914e-15, y: 1, z: -0.000000021855694, w: -0.0000000754979} m_LocalPosition: {x: -0.05600357, y: -0.015982103, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 8352429603068409619} - {fileID: 3823504829683890292} @@ -256,9 +262,7 @@ GameObject: m_Component: - component: {fileID: 7788790407431586433} - component: {fileID: 7788790407431586461} - - component: {fileID: 7788790407431586434} - component: {fileID: 7788790407431586435} - - component: {fileID: 7788790407431586432} m_Layer: 0 m_Name: InteractiveBossDoor m_TagString: Untagged @@ -276,6 +280,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 5694566148258285863} - {fileID: 1962970309805677278} @@ -300,18 +305,6 @@ MonoBehaviour: AlwaysReplicateAsRoot: 0 DontDestroyWithOwner: 0 AutoObjectParentSync: 1 ---- !u!114 &7788790407431586434 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7788790407431586438} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 012e73faa11cbe24987c752e542cbf1c, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!114 &7788790407431586435 MonoBehaviour: m_ObjectHideFlags: 0 @@ -326,22 +319,9 @@ MonoBehaviour: m_EditorClassIdentifier: m_SwitchesThatOpenThisDoor: [] m_Animator: {fileID: 9017285538409940355} - m_NetworkDoorState: {fileID: 7788790407431586434} m_AnimatorDoorOpenBoolID: 48337822 ---- !u!114 &7788790407431586432 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7788790407431586438} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: c9f71c13463198a4bb7ab269b0241148, type: 3} - m_Name: - m_EditorClassIdentifier: + ForceOpen: 0 m_PhysicsObject: {fileID: 9183722010770990113} - m_DoorState: {fileID: 7788790407431586434} --- !u!1 &9183722010770990113 GameObject: m_ObjectHideFlags: 0 @@ -370,6 +350,7 @@ Transform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 5, z: 0} m_LocalScale: {x: 12, y: 10, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 7788790407431586433} m_RootOrder: 0 @@ -473,14 +454,9 @@ GameObject: m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: 5aaa823f44d09b9499e0b010951524aa, type: 3} m_PrefabInstance: {fileID: 700970646951541397} m_PrefabAsset: {fileID: 0} ---- !u!4 &1022563868116311422 stripped -Transform: - m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 5aaa823f44d09b9499e0b010951524aa, type: 3} - m_PrefabInstance: {fileID: 700970646951541397} - m_PrefabAsset: {fileID: 0} --- !u!95 &9017285538409940355 Animator: - serializedVersion: 3 + serializedVersion: 4 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} @@ -493,6 +469,7 @@ Animator: m_UpdateMode: 0 m_ApplyRootMotion: 0 m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 m_WarningMessage: m_HasTransformHierarchy: 1 m_AllowConstantClipSamplingOptimization: 1 @@ -510,3 +487,8 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Animator: {fileID: 9017285538409940355} +--- !u!4 &1022563868116311422 stripped +Transform: + m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 5aaa823f44d09b9499e0b010951524aa, type: 3} + m_PrefabInstance: {fileID: 700970646951541397} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Prefabs/Game/InteractiveFloorSwitch.prefab b/Assets/Prefabs/Game/InteractiveFloorSwitch.prefab index 9f7be2ed5..05507d40b 100644 --- a/Assets/Prefabs/Game/InteractiveFloorSwitch.prefab +++ b/Assets/Prefabs/Game/InteractiveFloorSwitch.prefab @@ -11,7 +11,6 @@ GameObject: - component: {fileID: 3908844207393841435} - component: {fileID: 8813941274818146980} - component: {fileID: 8868977774515229684} - - component: {fileID: 4267112279641007250} - component: {fileID: 4683613762970647871} m_Layer: 9 m_Name: InteractiveFloorSwitch @@ -66,18 +65,6 @@ MonoBehaviour: AlwaysReplicateAsRoot: 0 DontDestroyWithOwner: 0 AutoObjectParentSync: 1 ---- !u!114 &4267112279641007250 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7898142965061138134} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: d761b7be955d370428f1b3a33b7f15ad, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!114 &4683613762970647871 MonoBehaviour: m_ObjectHideFlags: 0 @@ -92,7 +79,6 @@ MonoBehaviour: m_EditorClassIdentifier: m_Animator: {fileID: 4008997029943342380} m_Collider: {fileID: 8813941274818146980} - m_FloorSwitchState: {fileID: 4267112279641007250} m_AnimatorPressedDownBoolVarID: -10327783 --- !u!1001 &1875502744404388572 PrefabInstance: diff --git a/Assets/Prefabs/Game/StaticNetworkObjects/BossRoomStaticNetworkObjects.prefab b/Assets/Prefabs/Game/StaticNetworkObjects/BossRoomStaticNetworkObjects.prefab index b9330f75b..2a46812a0 100644 --- a/Assets/Prefabs/Game/StaticNetworkObjects/BossRoomStaticNetworkObjects.prefab +++ b/Assets/Prefabs/Game/StaticNetworkObjects/BossRoomStaticNetworkObjects.prefab @@ -109,15 +109,15 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 6159356710943207705} - - {fileID: 6935654466643495624} - - {fileID: 6935654467925003220} - - {fileID: 6935654468154135699} - {fileID: 1364294803222551865} - {fileID: 2870191899104640561} + - {fileID: 6935654466643495624} - {fileID: 2870191899709542901} - {fileID: 2870191899799693295} + - {fileID: 6935654467925003220} - {fileID: 2870191898905528358} - {fileID: 2870191898099640040} + - {fileID: 6935654468154135699} - {fileID: 2870191898151103500} - {fileID: 2870191899486836352} m_Father: {fileID: 3049900457365411514} @@ -339,7 +339,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} propertyPath: m_RootOrder - value: 7 + value: 5 objectReference: {fileID: 0} - target: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} propertyPath: m_LocalPosition.x @@ -383,22 +383,22 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} ---- !u!4 &2870191899799693295 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} - m_PrefabInstance: {fileID: 1827608496278873258} - m_PrefabAsset: {fileID: 0} ---- !u!114 &8192964624700552606 stripped +--- !u!114 &2104268434153223211 stripped MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 7561466626167410996, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} + m_CorrespondingSourceObject: {fileID: -8903857516321632127, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} m_PrefabInstance: {fileID: 1827608496278873258} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 07cb03f8b4d75ed4abb9801aa531be91, type: 3} + m_Script: {fileID: 11500000, guid: eb44a31731a459546bdf01f1af48173c, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!4 &2870191899799693295 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} + m_PrefabInstance: {fileID: 1827608496278873258} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1827608496279998292 PrefabInstance: m_ObjectHideFlags: 0 @@ -548,7 +548,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} propertyPath: m_RootOrder - value: 6 + value: 4 objectReference: {fileID: 0} - target: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} propertyPath: m_LocalPosition.x @@ -592,22 +592,22 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} ---- !u!4 &2870191899709542901 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} - m_PrefabInstance: {fileID: 1827608496436646576} - m_PrefabAsset: {fileID: 0} ---- !u!114 &8192964625146938244 stripped +--- !u!114 &2104268434029314609 stripped MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 7561466626167410996, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} + m_CorrespondingSourceObject: {fileID: -8903857516321632127, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} m_PrefabInstance: {fileID: 1827608496436646576} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 07cb03f8b4d75ed4abb9801aa531be91, type: 3} + m_Script: {fileID: 11500000, guid: eb44a31731a459546bdf01f1af48173c, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!4 &2870191899709542901 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} + m_PrefabInstance: {fileID: 1827608496436646576} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1827608496493147942 PrefabInstance: m_ObjectHideFlags: 0 @@ -626,11 +626,11 @@ PrefabInstance: - target: {fileID: 4501025776099328933, guid: a6647793a8bc7c846abba94be1d257e5, type: 3} propertyPath: m_BreakableElements.Array.data[0] value: - objectReference: {fileID: 8192964624700552606} + objectReference: {fileID: 2104268434029314609} - target: {fileID: 4501025776099328933, guid: a6647793a8bc7c846abba94be1d257e5, type: 3} propertyPath: m_BreakableElements.Array.data[1] value: - objectReference: {fileID: 8192964625146938244} + objectReference: {fileID: 2104268434153223211} - target: {fileID: 4844841199312666291, guid: a6647793a8bc7c846abba94be1d257e5, type: 3} propertyPath: m_MinSpawnCap value: 1 @@ -653,7 +653,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8727022540156222958, guid: a6647793a8bc7c846abba94be1d257e5, type: 3} propertyPath: m_RootOrder - value: 1 + value: 3 objectReference: {fileID: 0} - target: {fileID: 8727022540156222958, guid: a6647793a8bc7c846abba94be1d257e5, type: 3} propertyPath: m_LocalPosition.x @@ -895,22 +895,22 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} ---- !u!4 &2870191899486836352 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} - m_PrefabInstance: {fileID: 1827608496794654149} - m_PrefabAsset: {fileID: 0} ---- !u!114 &8192964625466148081 stripped +--- !u!114 &2104268433840096580 stripped MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 7561466626167410996, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} + m_CorrespondingSourceObject: {fileID: -8903857516321632127, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} m_PrefabInstance: {fileID: 1827608496794654149} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 07cb03f8b4d75ed4abb9801aa531be91, type: 3} + m_Script: {fileID: 11500000, guid: eb44a31731a459546bdf01f1af48173c, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!4 &2870191899486836352 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} + m_PrefabInstance: {fileID: 1827608496794654149} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1827608496819222441 PrefabInstance: m_ObjectHideFlags: 0 @@ -1126,7 +1126,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} propertyPath: m_RootOrder - value: 5 + value: 2 objectReference: {fileID: 0} - target: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} propertyPath: m_LocalPosition.x @@ -1170,22 +1170,22 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} ---- !u!4 &2870191899104640561 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} - m_PrefabInstance: {fileID: 1827608497175821684} - m_PrefabAsset: {fileID: 0} ---- !u!114 &8192964625613483072 stripped +--- !u!114 &2104268433424346613 stripped MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 7561466626167410996, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} + m_CorrespondingSourceObject: {fileID: -8903857516321632127, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} m_PrefabInstance: {fileID: 1827608497175821684} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 07cb03f8b4d75ed4abb9801aa531be91, type: 3} + m_Script: {fileID: 11500000, guid: eb44a31731a459546bdf01f1af48173c, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!4 &2870191899104640561 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} + m_PrefabInstance: {fileID: 1827608497175821684} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1827608497240689507 PrefabInstance: m_ObjectHideFlags: 0 @@ -1203,7 +1203,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} propertyPath: m_RootOrder - value: 8 + value: 7 objectReference: {fileID: 0} - target: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} propertyPath: m_LocalPosition.x @@ -1247,22 +1247,22 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} ---- !u!4 &2870191898905528358 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} - m_PrefabInstance: {fileID: 1827608497240689507} - m_PrefabAsset: {fileID: 0} ---- !u!114 &8192964625951251031 stripped +--- !u!114 &2104268433224981474 stripped MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 7561466626167410996, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} + m_CorrespondingSourceObject: {fileID: -8903857516321632127, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} m_PrefabInstance: {fileID: 1827608497240689507} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 07cb03f8b4d75ed4abb9801aa531be91, type: 3} + m_Script: {fileID: 11500000, guid: eb44a31731a459546bdf01f1af48173c, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!4 &2870191898905528358 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} + m_PrefabInstance: {fileID: 1827608497240689507} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1827608497398822667 PrefabInstance: m_ObjectHideFlags: 0 @@ -1479,11 +1479,11 @@ PrefabInstance: - target: {fileID: 4501025776099328933, guid: a6647793a8bc7c846abba94be1d257e5, type: 3} propertyPath: m_BreakableElements.Array.data[0] value: - objectReference: {fileID: 8192964625466148081} + objectReference: {fileID: 2104268432504963016} - target: {fileID: 4501025776099328933, guid: a6647793a8bc7c846abba94be1d257e5, type: 3} propertyPath: m_BreakableElements.Array.data[1] value: - objectReference: {fileID: 8192964626818645629} + objectReference: {fileID: 2104268433840096580} - target: {fileID: 4844841199312666291, guid: a6647793a8bc7c846abba94be1d257e5, type: 3} propertyPath: m_MinSpawnCap value: 1 @@ -1506,7 +1506,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8727022540156222958, guid: a6647793a8bc7c846abba94be1d257e5, type: 3} propertyPath: m_RootOrder - value: 3 + value: 9 objectReference: {fileID: 0} - target: {fileID: 8727022540156222958, guid: a6647793a8bc7c846abba94be1d257e5, type: 3} propertyPath: m_LocalPosition.x @@ -1639,11 +1639,11 @@ PrefabInstance: - target: {fileID: 4501025776099328933, guid: a6647793a8bc7c846abba94be1d257e5, type: 3} propertyPath: m_BreakableElements.Array.data[0] value: - objectReference: {fileID: 8192964626757153945} + objectReference: {fileID: 2104268433224981474} - target: {fileID: 4501025776099328933, guid: a6647793a8bc7c846abba94be1d257e5, type: 3} propertyPath: m_BreakableElements.Array.data[1] value: - objectReference: {fileID: 8192964625951251031} + objectReference: {fileID: 2104268432419091756} - target: {fileID: 4844841199312666291, guid: a6647793a8bc7c846abba94be1d257e5, type: 3} propertyPath: m_MinSpawnCap value: 1 @@ -1666,7 +1666,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8727022540156222958, guid: a6647793a8bc7c846abba94be1d257e5, type: 3} propertyPath: m_RootOrder - value: 2 + value: 6 objectReference: {fileID: 0} - target: {fileID: 8727022540156222958, guid: a6647793a8bc7c846abba94be1d257e5, type: 3} propertyPath: m_LocalPosition.x @@ -1996,7 +1996,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} propertyPath: m_RootOrder - value: 9 + value: 8 objectReference: {fileID: 0} - target: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} propertyPath: m_LocalPosition.x @@ -2040,22 +2040,22 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} ---- !u!4 &2870191898099640040 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} - m_PrefabInstance: {fileID: 1827608498047641005} - m_PrefabAsset: {fileID: 0} ---- !u!114 &8192964626757153945 stripped +--- !u!114 &2104268432419091756 stripped MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 7561466626167410996, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} + m_CorrespondingSourceObject: {fileID: -8903857516321632127, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} m_PrefabInstance: {fileID: 1827608498047641005} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 07cb03f8b4d75ed4abb9801aa531be91, type: 3} + m_Script: {fileID: 11500000, guid: eb44a31731a459546bdf01f1af48173c, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!4 &2870191898099640040 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} + m_PrefabInstance: {fileID: 1827608498047641005} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1827608498103685661 PrefabInstance: m_ObjectHideFlags: 0 @@ -2183,22 +2183,22 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} ---- !u!4 &2870191898151103500 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} - m_PrefabInstance: {fileID: 1827608498128793417} - m_PrefabAsset: {fileID: 0} ---- !u!114 &8192964626818645629 stripped +--- !u!114 &2104268432504963016 stripped MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 7561466626167410996, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} + m_CorrespondingSourceObject: {fileID: -8903857516321632127, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} m_PrefabInstance: {fileID: 1827608498128793417} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 07cb03f8b4d75ed4abb9801aa531be91, type: 3} + m_Script: {fileID: 11500000, guid: eb44a31731a459546bdf01f1af48173c, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!4 &2870191898151103500 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} + m_PrefabInstance: {fileID: 1827608498128793417} + m_PrefabAsset: {fileID: 0} --- !u!1001 &3199511253520616568 PrefabInstance: m_ObjectHideFlags: 0 @@ -2349,11 +2349,11 @@ PrefabInstance: - target: {fileID: 4501025776099328933, guid: a6647793a8bc7c846abba94be1d257e5, type: 3} propertyPath: m_BreakableElements.Array.data[0] value: - objectReference: {fileID: 8192964625613483072} + objectReference: {fileID: 2885072656803778301} - target: {fileID: 4501025776099328933, guid: a6647793a8bc7c846abba94be1d257e5, type: 3} propertyPath: m_BreakableElements.Array.data[1] value: - objectReference: {fileID: 4938561330712956744} + objectReference: {fileID: 2104268433424346613} - target: {fileID: 4844841199312666291, guid: a6647793a8bc7c846abba94be1d257e5, type: 3} propertyPath: m_MinSpawnCap value: 1 @@ -2442,7 +2442,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} propertyPath: m_RootOrder - value: 4 + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} + propertyPath: m_LocalScale.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} + propertyPath: m_LocalScale.z + value: 1 objectReference: {fileID: 0} - target: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} propertyPath: m_LocalPosition.x @@ -2491,15 +2499,15 @@ Transform: m_CorrespondingSourceObject: {fileID: 4505851899529102149, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} m_PrefabInstance: {fileID: 3199511254763724412} m_PrefabAsset: {fileID: 0} ---- !u!114 &4938561330712956744 stripped +--- !u!114 &2885072656803778301 stripped MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 7561466626167410996, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} + m_CorrespondingSourceObject: {fileID: -8903857516321632127, guid: 054386ac446cf834c9d7f603a57ab70b, type: 3} m_PrefabInstance: {fileID: 3199511254763724412} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 07cb03f8b4d75ed4abb9801aa531be91, type: 3} + m_Script: {fileID: 11500000, guid: eb44a31731a459546bdf01f1af48173c, type: 3} m_Name: m_EditorClassIdentifier: --- !u!1001 &5187384963340716615 diff --git a/Assets/Prefabs/Game/StaticNetworkObjects/GlobalStaticNetworkObjects.prefab b/Assets/Prefabs/Game/StaticNetworkObjects/GlobalStaticNetworkObjects.prefab deleted file mode 100644 index 70d665815..000000000 --- a/Assets/Prefabs/Game/StaticNetworkObjects/GlobalStaticNetworkObjects.prefab +++ /dev/null @@ -1,187 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &6025483860628262854 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 2127969045013110154} - m_Layer: 0 - m_Name: GlobalStaticNetworkObjects - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &2127969045013110154 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6025483860628262854} - 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: 6803673045227533488} - - {fileID: 6432827414648884918} - m_Father: {fileID: 0} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1001 &1159588455107771115 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 2127969045013110154} - m_Modifications: - - target: {fileID: 297185343939699586, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3} - propertyPath: m_Name - value: BossRoomState - objectReference: {fileID: 0} - - target: {fileID: 3608714310874968837, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3} - propertyPath: GlobalObjectIdHash - value: 951099334 - objectReference: {fileID: 0} - - target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3} - propertyPath: m_RootOrder - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5762482089640033414, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3} - propertyPath: m_NetworkObjectsSeparator - value: - objectReference: {fileID: 0} - - target: {fileID: 5762482089640033414, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3} - propertyPath: m_RuntimeNetworkObjectsSeparator - value: - objectReference: {fileID: 0} - - target: {fileID: 5762482089640033414, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3} - propertyPath: m_GameObjectsThatWillBeInjectedAutomatically.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 5762482089640033414, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3} - propertyPath: m_GameObjectsThatWillBeInjectedAutomatically.Array.data[0] - value: - objectReference: {fileID: 8528489606206953337} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3} ---- !u!4 &6803673045227533488 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3} - m_PrefabInstance: {fileID: 1159588455107771115} - m_PrefabAsset: {fileID: 0} ---- !u!1001 &8976529767578041044 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 2127969045013110154} - m_Modifications: - - target: {fileID: 776943915682426285, guid: d026428052f506a4a99ce1b7c94c4d45, type: 3} - propertyPath: m_Name - value: DebugCheatsManager - objectReference: {fileID: 0} - - target: {fileID: 2726635115303138402, guid: d026428052f506a4a99ce1b7c94c4d45, type: 3} - propertyPath: m_RootOrder - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 2726635115303138402, guid: d026428052f506a4a99ce1b7c94c4d45, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2726635115303138402, guid: d026428052f506a4a99ce1b7c94c4d45, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2726635115303138402, guid: d026428052f506a4a99ce1b7c94c4d45, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2726635115303138402, guid: d026428052f506a4a99ce1b7c94c4d45, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 2726635115303138402, guid: d026428052f506a4a99ce1b7c94c4d45, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2726635115303138402, guid: d026428052f506a4a99ce1b7c94c4d45, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2726635115303138402, guid: d026428052f506a4a99ce1b7c94c4d45, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2726635115303138402, guid: d026428052f506a4a99ce1b7c94c4d45, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2726635115303138402, guid: d026428052f506a4a99ce1b7c94c4d45, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2726635115303138402, guid: d026428052f506a4a99ce1b7c94c4d45, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 6695920927348029111, guid: d026428052f506a4a99ce1b7c94c4d45, type: 3} - propertyPath: GlobalObjectIdHash - value: 951099334 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: d026428052f506a4a99ce1b7c94c4d45, type: 3} ---- !u!1 &8528489606206953337 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 776943915682426285, guid: d026428052f506a4a99ce1b7c94c4d45, type: 3} - m_PrefabInstance: {fileID: 8976529767578041044} - m_PrefabAsset: {fileID: 0} ---- !u!4 &6432827414648884918 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 2726635115303138402, guid: d026428052f506a4a99ce1b7c94c4d45, type: 3} - m_PrefabInstance: {fileID: 8976529767578041044} - m_PrefabAsset: {fileID: 0} diff --git a/Assets/Prefabs/Game/StaticNetworkObjects/GlobalStaticNetworkObjects.prefab.meta b/Assets/Prefabs/Game/StaticNetworkObjects/GlobalStaticNetworkObjects.prefab.meta deleted file mode 100644 index c3d0b389d..000000000 --- a/Assets/Prefabs/Game/StaticNetworkObjects/GlobalStaticNetworkObjects.prefab.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 0a1c028b65755ff438485f33ef43e4fe -PrefabImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Prefabs/NetworkingManager.prefab b/Assets/Prefabs/NetworkingManager.prefab index a645a616f..e27c761a6 100644 --- a/Assets/Prefabs/NetworkingManager.prefab +++ b/Assets/Prefabs/NetworkingManager.prefab @@ -45,7 +45,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_ProtocolType: 0 - m_MaxPacketQueueSize: 256 + m_MaxPacketQueueSize: 512 m_MaxPayloadSize: 32000 m_MaxSendQueueSize: 50000000 m_HeartbeatTimeoutMS: 500 diff --git a/Assets/Prefabs/State/BossRoomState.prefab b/Assets/Prefabs/State/BossRoomState.prefab index 7f236d072..d1c291f14 100644 --- a/Assets/Prefabs/State/BossRoomState.prefab +++ b/Assets/Prefabs/State/BossRoomState.prefab @@ -71,11 +71,10 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: parentReference: - TypeName: Unity.Multiplayer.Samples.BossRoom.Shared.ApplicationController + TypeName: Unity.BossRoom.ApplicationLifecycle.ApplicationController autoRun: 1 autoInjectGameObjects: [] m_NetcodeHooks: {fileID: 1290852967062359934} - m_NetworkGameStateTransform: {fileID: 11400000, guid: 07bddcdf06738e74cb79d30065ff96af, type: 2} m_PlayerPrefab: {fileID: 6009713983291384767, guid: 8237adf32a9b6de4892e6febe6b4bdef, type: 3} m_PlayerSpawnPoints: - {fileID: 6319832178442273571} diff --git a/Assets/Prefabs/State/CharSelectState.prefab b/Assets/Prefabs/State/CharSelectState.prefab index f4c926380..9e9c2bea6 100644 --- a/Assets/Prefabs/State/CharSelectState.prefab +++ b/Assets/Prefabs/State/CharSelectState.prefab @@ -65,7 +65,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: parentReference: - TypeName: Unity.Multiplayer.Samples.BossRoom.Shared.ApplicationController + TypeName: Unity.BossRoom.ApplicationLifecycle.ApplicationController autoRun: 1 autoInjectGameObjects: [] m_NetcodeHooks: {fileID: 8494646029522094751} @@ -82,7 +82,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: parentReference: - TypeName: Unity.Multiplayer.Samples.BossRoom.Shared.ApplicationController + TypeName: Unity.BossRoom.ApplicationLifecycle.ApplicationController autoRun: 1 autoInjectGameObjects: [] m_NetcodeHooks: {fileID: 8494646029522094751} diff --git a/Assets/Prefabs/State/MainMenuState.prefab b/Assets/Prefabs/State/MainMenuState.prefab index cdaa75ad4..97afb7441 100644 --- a/Assets/Prefabs/State/MainMenuState.prefab +++ b/Assets/Prefabs/State/MainMenuState.prefab @@ -70,7 +70,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: parentReference: - TypeName: Unity.Multiplayer.Samples.BossRoom.Shared.ApplicationController + TypeName: Unity.BossRoom.ApplicationLifecycle.ApplicationController autoRun: 1 autoInjectGameObjects: [] m_NameGenerationData: {fileID: 11400000, guid: cc0e4025ad893614a8db0d9c10bf7c4f, type: 2} diff --git a/Assets/Prefabs/State/PostGameState.prefab b/Assets/Prefabs/State/PostGameState.prefab index d6ac2fe34..106996045 100644 --- a/Assets/Prefabs/State/PostGameState.prefab +++ b/Assets/Prefabs/State/PostGameState.prefab @@ -64,13 +64,13 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: parentReference: - TypeName: Unity.Multiplayer.Samples.BossRoom.Shared.ApplicationController + TypeName: Unity.BossRoom.ApplicationLifecycle.ApplicationController autoRun: 1 autoInjectGameObjects: - {fileID: 0} - {fileID: 0} m_NetcodeHooks: {fileID: 6576822806953781696} - synchronizedStateData: {fileID: 6889826313803109754} + networkPostGame: {fileID: 6889826313803109754} --- !u!114 &6576822806953781696 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/BossRoom.unity b/Assets/Scenes/BossRoom.unity index b3f5a362f..ff28adf0f 100644 --- a/Assets/Scenes/BossRoom.unity +++ b/Assets/Scenes/BossRoom.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c0ca8cdb10ab12f8d334998c6273477c6b0395747dab1570fe3791ae63f1df26 -size 510349 +oid sha256:b419d5ac5b7c74bcd718576bf608231e7738091a5ef6d6c188a6e05f4ada2ec4 +size 422255 diff --git a/Assets/Scenes/BossRoom/DungeonBossRoom.unity b/Assets/Scenes/BossRoom/DungeonBossRoom.unity index ce5dccbdf..7f190c77d 100644 --- a/Assets/Scenes/BossRoom/DungeonBossRoom.unity +++ b/Assets/Scenes/BossRoom/DungeonBossRoom.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1f69751e21d066b21fe64f560453195213527855f0ecb61dbc4603334bcca1c6 -size 336244 +oid sha256:d0f0ddaaf10020f714dc598e2ffd877f0d57cb6e01a70b5bf5725aa95836ee06 +size 335325 diff --git a/Assets/Scenes/BossRoom/DungeonEntrance.unity b/Assets/Scenes/BossRoom/DungeonEntrance.unity index 31db138e6..afd3d5e27 100644 --- a/Assets/Scenes/BossRoom/DungeonEntrance.unity +++ b/Assets/Scenes/BossRoom/DungeonEntrance.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4d530d91dfe8f536cfcc4495fa1b003a30cc7d94f043778199258daf534cf414 -size 35628 +oid sha256:3d920c46604581c08911a26f77feae40ef42eec1f068c8c652a99d851893ccfa +size 32536 diff --git a/Assets/Scenes/BossRoom/DungeonTransition.unity b/Assets/Scenes/BossRoom/DungeonTransition.unity index b5526af22..f6baab5cd 100644 --- a/Assets/Scenes/BossRoom/DungeonTransition.unity +++ b/Assets/Scenes/BossRoom/DungeonTransition.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:482eb01df086d7596fd41ec36f2e5847a8d0245a513df3af89510fcf0a5a698f -size 25787 +oid sha256:fd06bcd32ee6eddef987ad17d127ff54710fc0b83e8b65246741f31965c6f9eb +size 26310 diff --git a/Assets/Scripts/ApplicationLifecycle/ApplicationController.cs b/Assets/Scripts/ApplicationLifecycle/ApplicationController.cs index 28c987d98..b2ba6cd18 100644 --- a/Assets/Scripts/ApplicationLifecycle/ApplicationController.cs +++ b/Assets/Scripts/ApplicationLifecycle/ApplicationController.cs @@ -1,17 +1,21 @@ using System; using System.Collections; -using BossRoom.Scripts.Shared.Net.UnityServices.Auth; -using Unity.Multiplayer.Samples.BossRoom.ApplicationLifecycle.Messages; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; -using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Infrastructure; -using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies; +using Unity.BossRoom.ApplicationLifecycle.Messages; +using Unity.BossRoom.ConnectionManagement; +using Unity.BossRoom.Gameplay.GameState; +using Unity.BossRoom.Gameplay.Messages; +using Unity.BossRoom.Infrastructure; +using Unity.BossRoom.UnityServices; +using Unity.BossRoom.UnityServices.Auth; +using Unity.BossRoom.UnityServices.Lobbies; +using Unity.BossRoom.Utils; using Unity.Netcode; using UnityEngine; using UnityEngine.SceneManagement; using VContainer; using VContainer.Unity; -namespace Unity.Multiplayer.Samples.BossRoom.Shared +namespace Unity.BossRoom.ApplicationLifecycle { /// diff --git a/Assets/Scripts/ApplicationLifecycle/Messages/QuitApplicationMessage.cs b/Assets/Scripts/ApplicationLifecycle/Messages/QuitApplicationMessage.cs index ba2da707e..70c421318 100644 --- a/Assets/Scripts/ApplicationLifecycle/Messages/QuitApplicationMessage.cs +++ b/Assets/Scripts/ApplicationLifecycle/Messages/QuitApplicationMessage.cs @@ -1,6 +1,6 @@ using System; -namespace Unity.Multiplayer.Samples.BossRoom.ApplicationLifecycle.Messages +namespace Unity.BossRoom.ApplicationLifecycle.Messages { public struct QuitApplicationMessage { diff --git a/Assets/Scripts/Audio/AudioMixerConfigurator.cs b/Assets/Scripts/Audio/AudioMixerConfigurator.cs index 329a6276f..0e9017ea6 100644 --- a/Assets/Scripts/Audio/AudioMixerConfigurator.cs +++ b/Assets/Scripts/Audio/AudioMixerConfigurator.cs @@ -1,7 +1,8 @@ +using Unity.BossRoom.Utils; using UnityEngine; using UnityEngine.Audio; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Audio { /// /// Initializes the game's AudioMixer to use volumes stored in preferences. Provides diff --git a/Assets/Scripts/Audio/ClientMusicPlayer.cs b/Assets/Scripts/Audio/ClientMusicPlayer.cs index eec045f3a..8dc345942 100644 --- a/Assets/Scripts/Audio/ClientMusicPlayer.cs +++ b/Assets/Scripts/Audio/ClientMusicPlayer.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Audio { /// /// Music player that handles start of boss battle, victory and restart @@ -25,11 +25,6 @@ public class ClientMusicPlayer : MonoBehaviour /// public static ClientMusicPlayer Instance { get; private set; } - void Start() - { - - } - public void PlayThemeMusic(bool restart) { PlayTrack(m_ThemeMusic, true, restart); diff --git a/Assets/Scripts/CameraController.meta b/Assets/Scripts/CameraUtils.meta similarity index 100% rename from Assets/Scripts/CameraController.meta rename to Assets/Scripts/CameraUtils.meta diff --git a/Assets/Scripts/CameraController/CameraController.cs b/Assets/Scripts/CameraUtils/CameraController.cs similarity index 94% rename from Assets/Scripts/CameraController/CameraController.cs rename to Assets/Scripts/CameraUtils/CameraController.cs index 657a530bb..802e4e0e5 100644 --- a/Assets/Scripts/CameraController/CameraController.cs +++ b/Assets/Scripts/CameraUtils/CameraController.cs @@ -2,7 +2,7 @@ using UnityEngine; using UnityEngine.Assertions; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.CameraUtils { public class CameraController : MonoBehaviour { diff --git a/Assets/Scripts/CameraController/CameraController.cs.meta b/Assets/Scripts/CameraUtils/CameraController.cs.meta similarity index 100% rename from Assets/Scripts/CameraController/CameraController.cs.meta rename to Assets/Scripts/CameraUtils/CameraController.cs.meta diff --git a/Assets/Scripts/CameraController/Unity.BossRoom.CameraController.asmdef b/Assets/Scripts/CameraUtils/Unity.BossRoom.CameraUtils.asmdef similarity index 87% rename from Assets/Scripts/CameraController/Unity.BossRoom.CameraController.asmdef rename to Assets/Scripts/CameraUtils/Unity.BossRoom.CameraUtils.asmdef index a74c7fce9..ea57eaeb2 100644 --- a/Assets/Scripts/CameraController/Unity.BossRoom.CameraController.asmdef +++ b/Assets/Scripts/CameraUtils/Unity.BossRoom.CameraUtils.asmdef @@ -1,5 +1,5 @@ { - "name": "Unity.BossRoom.CameraController", + "name": "Unity.BossRoom.CameraUtils", "rootNamespace": "", "references": [ "Cinemachine" @@ -13,4 +13,4 @@ "defineConstraints": [], "versionDefines": [], "noEngineReferences": false -} \ No newline at end of file +} diff --git a/Assets/Scripts/CameraController/Unity.BossRoom.CameraController.asmdef.meta b/Assets/Scripts/CameraUtils/Unity.BossRoom.CameraUtils.asmdef.meta similarity index 100% rename from Assets/Scripts/CameraController/Unity.BossRoom.CameraController.asmdef.meta rename to Assets/Scripts/CameraUtils/Unity.BossRoom.CameraUtils.asmdef.meta diff --git a/Assets/Scripts/ConnectionManagement/ConnectionManager.cs b/Assets/Scripts/ConnectionManagement/ConnectionManager.cs index af0114117..6ebf40d62 100644 --- a/Assets/Scripts/ConnectionManagement/ConnectionManager.cs +++ b/Assets/Scripts/ConnectionManagement/ConnectionManager.cs @@ -1,11 +1,13 @@ using System; using System.Collections.Generic; +using Unity.BossRoom.Utils; using Unity.Collections; using Unity.Netcode; using UnityEngine; +using UUnity.BossRoom.ConnectionManagement; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.ConnectionManagement { public enum ConnectStatus { diff --git a/Assets/Scripts/ConnectionManagement/ConnectionState/ClientConnectedState.cs b/Assets/Scripts/ConnectionManagement/ConnectionState/ClientConnectedState.cs index 9f7822934..c4a7252aa 100644 --- a/Assets/Scripts/ConnectionManagement/ConnectionState/ClientConnectedState.cs +++ b/Assets/Scripts/ConnectionManagement/ConnectionState/ClientConnectedState.cs @@ -1,9 +1,9 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies; +using Unity.BossRoom.UnityServices.Lobbies; using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.ConnectionManagement { /// /// Connection state corresponding to a connected client. When being disconnected, transitions to the diff --git a/Assets/Scripts/ConnectionManagement/ConnectionState/ClientConnectingState.cs b/Assets/Scripts/ConnectionManagement/ConnectionState/ClientConnectingState.cs index 0fd399747..beb17ce44 100644 --- a/Assets/Scripts/ConnectionManagement/ConnectionState/ClientConnectingState.cs +++ b/Assets/Scripts/ConnectionManagement/ConnectionState/ClientConnectingState.cs @@ -1,12 +1,13 @@ using System; using System.Threading.Tasks; -using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies; +using Unity.BossRoom.UnityServices.Lobbies; +using Unity.Multiplayer.Samples.BossRoom; using Unity.Multiplayer.Samples.Utilities; using Unity.Netcode.Transports.UTP; using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.ConnectionManagement { /// /// Connection state corresponding to when a client is attempting to connect to a server. Starts the client when diff --git a/Assets/Scripts/ConnectionManagement/ConnectionState/ClientReconnectingState.cs b/Assets/Scripts/ConnectionManagement/ConnectionState/ClientReconnectingState.cs index 4f7c99188..115bcc0b0 100644 --- a/Assets/Scripts/ConnectionManagement/ConnectionState/ClientReconnectingState.cs +++ b/Assets/Scripts/ConnectionManagement/ConnectionState/ClientReconnectingState.cs @@ -1,10 +1,10 @@ using System; using System.Collections; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; +using Unity.BossRoom.Infrastructure; using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.ConnectionManagement { /// /// Connection state corresponding to a client attempting to reconnect to a server. It will try to reconnect a diff --git a/Assets/Scripts/ConnectionManagement/ConnectionState/ConnectionState.cs b/Assets/Scripts/ConnectionManagement/ConnectionState/ConnectionState.cs index 6be73a6e9..f0b9c6a2c 100644 --- a/Assets/Scripts/ConnectionManagement/ConnectionState/ConnectionState.cs +++ b/Assets/Scripts/ConnectionManagement/ConnectionState/ConnectionState.cs @@ -1,10 +1,10 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; +using Unity.BossRoom.Infrastructure; using Unity.Netcode; using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.ConnectionManagement { /// /// Base class representing a connection state. diff --git a/Assets/Scripts/ConnectionManagement/ConnectionState/DisconnectingWithReasonState.cs b/Assets/Scripts/ConnectionManagement/ConnectionState/DisconnectingWithReasonState.cs index 427cdf12e..96d6c8217 100644 --- a/Assets/Scripts/ConnectionManagement/ConnectionState/DisconnectingWithReasonState.cs +++ b/Assets/Scripts/ConnectionManagement/ConnectionState/DisconnectingWithReasonState.cs @@ -1,4 +1,4 @@ -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.ConnectionManagement { /// /// Connection state corresponding to a client who received a message from the server with a disconnect reason. diff --git a/Assets/Scripts/ConnectionManagement/ConnectionState/HostingState.cs b/Assets/Scripts/ConnectionManagement/ConnectionState/HostingState.cs index 8fa548ed9..8a60ece37 100644 --- a/Assets/Scripts/ConnectionManagement/ConnectionState/HostingState.cs +++ b/Assets/Scripts/ConnectionManagement/ConnectionState/HostingState.cs @@ -1,13 +1,14 @@ using System; using System.Collections; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; -using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies; +using Unity.BossRoom.Infrastructure; +using Unity.BossRoom.UnityServices.Lobbies; +using Unity.Multiplayer.Samples.BossRoom; using Unity.Multiplayer.Samples.Utilities; using Unity.Netcode; using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.ConnectionManagement { /// /// Connection state corresponding to a listening host. Handles incoming client connections. When shutting down or diff --git a/Assets/Scripts/ConnectionManagement/ConnectionState/OfflineState.cs b/Assets/Scripts/ConnectionManagement/ConnectionState/OfflineState.cs index 016dc3a66..3c36166ca 100644 --- a/Assets/Scripts/ConnectionManagement/ConnectionState/OfflineState.cs +++ b/Assets/Scripts/ConnectionManagement/ConnectionState/OfflineState.cs @@ -1,9 +1,8 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Client; -using Unity.Multiplayer.Samples.BossRoom.Shared; -using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies; +using Unity.BossRoom.ConnectionManagement; +using Unity.BossRoom.UnityServices.Lobbies; +using Unity.BossRoom.Utils; using Unity.Multiplayer.Samples.Utilities; -using Unity.Netcode; using Unity.Netcode.Transports.UTP; using Unity.Services.Authentication; using Unity.Services.Core; @@ -11,7 +10,7 @@ using UnityEngine.SceneManagement; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom +namespace UUnity.BossRoom.ConnectionManagement { /// /// Connection state corresponding to when the NetworkManager is shut down. From this state we can transition to the diff --git a/Assets/Scripts/ConnectionManagement/ConnectionState/OnlineState.cs b/Assets/Scripts/ConnectionManagement/ConnectionState/OnlineState.cs index 87743ea41..4b4ba7e89 100644 --- a/Assets/Scripts/ConnectionManagement/ConnectionState/OnlineState.cs +++ b/Assets/Scripts/ConnectionManagement/ConnectionState/OnlineState.cs @@ -1,4 +1,4 @@ -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.ConnectionManagement { /// /// Base class representing an online connection state. diff --git a/Assets/Scripts/ConnectionManagement/ConnectionState/StartingHostState.cs b/Assets/Scripts/ConnectionManagement/ConnectionState/StartingHostState.cs index 74a875275..774c00a3a 100644 --- a/Assets/Scripts/ConnectionManagement/ConnectionState/StartingHostState.cs +++ b/Assets/Scripts/ConnectionManagement/ConnectionState/StartingHostState.cs @@ -1,11 +1,13 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies; +using Unity.BossRoom.Infrastructure; +using Unity.BossRoom.UnityServices.Lobbies; +using Unity.Multiplayer.Samples.BossRoom; using Unity.Netcode; using Unity.Netcode.Transports.UTP; using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.ConnectionManagement { /// /// Connection state corresponding to a host starting up. Starts the host when entering the state. If successful, diff --git a/Assets/Scripts/ConnectionManagement/SessionPlayerData.cs b/Assets/Scripts/ConnectionManagement/SessionPlayerData.cs index e61f1d4da..4e1a65558 100644 --- a/Assets/Scripts/ConnectionManagement/SessionPlayerData.cs +++ b/Assets/Scripts/ConnectionManagement/SessionPlayerData.cs @@ -1,6 +1,8 @@ +using Unity.BossRoom.Infrastructure; +using Unity.Multiplayer.Samples.BossRoom; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.ConnectionManagement { public struct SessionPlayerData : ISessionPlayerData { @@ -8,6 +10,7 @@ public struct SessionPlayerData : ISessionPlayerData public int PlayerNumber; public Vector3 PlayerPosition; public Quaternion PlayerRotation; + /// Instead of using a NetworkGuid (two ulongs) we could just use an int or even a byte-sized index into an array of possible avatars defined in our game data source public NetworkGuid AvatarNetworkGuid; public int CurrentHitPoints; public bool HasCharacterSpawned; diff --git a/Assets/Scripts/Editor/BakingMenu.cs b/Assets/Scripts/Editor/BakingMenu.cs index b493d6253..f6152271c 100644 --- a/Assets/Scripts/Editor/BakingMenu.cs +++ b/Assets/Scripts/Editor/BakingMenu.cs @@ -3,7 +3,7 @@ using UnityEditor; using UnityEngine.Rendering; -namespace Unity.Multiplayer.Samples.BossRoom.Scripts.Editor +namespace Unity.BossRoom.Editor { /// /// This is a script that creates a menu for baking lights (and changing other lighting features) for Boss Room. diff --git a/Assets/Scripts/Editor/Readme/Readme.cs b/Assets/Scripts/Editor/Readme/Readme.cs index 9193dfcf5..b661fe152 100644 --- a/Assets/Scripts/Editor/Readme/Readme.cs +++ b/Assets/Scripts/Editor/Readme/Readme.cs @@ -1,7 +1,7 @@ using System; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Editor +namespace Unity.BossRoom.Editor { /// /// Custom readme class based on the readme created for URP. For more context, see: diff --git a/Assets/Scripts/Editor/Readme/ReadmeEditor.cs b/Assets/Scripts/Editor/Readme/ReadmeEditor.cs index 28fc3a969..e5a626183 100644 --- a/Assets/Scripts/Editor/Readme/ReadmeEditor.cs +++ b/Assets/Scripts/Editor/Readme/ReadmeEditor.cs @@ -4,7 +4,7 @@ using System.IO; using System.Reflection; -namespace Unity.Multiplayer.Samples.BossRoom.Editor +namespace Unity.BossRoom.Editor { /// /// Custom readme editor window based on the readme created for URP. For more context, see: diff --git a/Assets/Scripts/Editor/SceneBootstrapper.cs b/Assets/Scripts/Editor/SceneBootstrapper.cs index f9d63b54f..36a3ff62a 100644 --- a/Assets/Scripts/Editor/SceneBootstrapper.cs +++ b/Assets/Scripts/Editor/SceneBootstrapper.cs @@ -2,7 +2,7 @@ using UnityEditor.SceneManagement; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Editor +namespace Unity.BossRoom.Editor { /// /// Class that permits auto-loading a bootstrap scene when the editor switches play state. This class is diff --git a/Assets/Scripts/Gameplay/Action/BaseTypes/Action.cs b/Assets/Scripts/Gameplay/Action/Action.cs similarity index 89% rename from Assets/Scripts/Gameplay/Action/BaseTypes/Action.cs rename to Assets/Scripts/Gameplay/Action/Action.cs index 3e5c1dfe1..e440776d6 100644 --- a/Assets/Scripts/Gameplay/Action/BaseTypes/Action.cs +++ b/Assets/Scripts/Gameplay/Action/Action.cs @@ -1,14 +1,13 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using Unity.Multiplayer.Samples.BossRoom.Server; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.VisualEffects; using Unity.Netcode; using UnityEngine; -using UnityEngine.Assertions; -using BlockingMode = Unity.Multiplayer.Samples.BossRoom.Actions.BlockingModeType; +using BlockingMode = Unity.BossRoom.Gameplay.Actions.BlockingModeType; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { /// /// The abstract parent class that all Actions derive from. @@ -98,14 +97,14 @@ public virtual void Reset() /// Called when the Action starts actually playing (which may be after it is created, because of queueing). /// /// false if the action decided it doesn't want to run after all, true otherwise. - public abstract bool OnStart(ServerCharacter parent); + public abstract bool OnStart(ServerCharacter serverCharacter); /// /// Called each frame while the action is running. /// /// true to keep running, false to stop. The Action will stop by default when its duration expires, if it has a duration set. - public abstract bool OnUpdate(ServerCharacter parent); + public abstract bool OnUpdate(ServerCharacter clientCharacter); /// /// Called each frame (before OnUpdate()) for the active ("blocking") Action, asking if it should become a background Action. @@ -119,16 +118,16 @@ public virtual bool ShouldBecomeNonBlocking() /// /// Called when the Action ends naturally. By default just calls Cancel() /// - public virtual void End(ServerCharacter parent) + public virtual void End(ServerCharacter serverCharacter) { - Cancel(parent); + Cancel(serverCharacter); } /// /// This will get called when the Action gets canceled. The Action should clean up any ongoing effects at this point. /// (e.g. an Action that involves moving should cancel the current active move). /// - public virtual void Cancel(ServerCharacter parent) { } + public virtual void Cancel(ServerCharacter serverCharacter) { } /// /// Called *AFTER* End(). At this point, the Action has ended, meaning its Update() etc. functions will never be @@ -144,8 +143,9 @@ public virtual void Cancel(ServerCharacter parent) { } /// /// Called on the active ("blocking") Action when this character collides with another. /// + /// /// - public virtual void CollisionEntered(ServerCharacter parent, Collision collision) { } + public virtual void CollisionEntered(ServerCharacter serverCharacter, Collision collision) { } public enum BuffableValue { @@ -198,9 +198,9 @@ public enum GameplayActivity /// /// When a GameplayActivity of AttackedByEnemy or Healed happens, OnGameplayAction() is called BEFORE BuffValue() is called. /// - /// + /// /// - public virtual void OnGameplayActivity(ServerCharacter parent, GameplayActivity activityType) { } + public virtual void OnGameplayActivity(ServerCharacter serverCharacter, GameplayActivity activityType) { } @@ -216,14 +216,14 @@ public virtual void OnGameplayActivity(ServerCharacter parent, GameplayActivity /// Derived class should be sure to call base.OnStart() in their implementation, but note that this resets "Anticipated" to false. /// /// true to play, false to be immediately cleaned up. - public virtual bool OnStartClient(ClientCharacterVisualization parent) + public virtual bool OnStartClient(ClientCharacter clientCharacter) { AnticipatedClient = false; //once you start for real you are no longer an anticipated action. TimeStarted = UnityEngine.Time.time; return true; } - public virtual bool OnUpdateClient(ClientCharacterVisualization parent) + public virtual bool OnUpdateClient(ClientCharacter clientCharacter) { return ActionConclusion.Continue; } @@ -233,9 +233,9 @@ public virtual bool OnUpdateClient(ClientCharacterVisualization parent) /// classes should aren't required to call base.End(); by default, the method just calls 'Cancel', to handle the /// common case where Cancel and End do the same thing. /// - public virtual void EndClient(ClientCharacterVisualization parent) + public virtual void EndClient(ClientCharacter clientCharacter) { - CancelClient(parent); + CancelClient(clientCharacter); } /// @@ -244,17 +244,17 @@ public virtual void EndClient(ClientCharacterVisualization parent) /// completing. For example, a "ChargeShot" action might want to emit a projectile object in its End method, but /// instead play a "Stagger" animation in its Cancel method. /// - public virtual void CancelClient(ClientCharacterVisualization parent) { } + public virtual void CancelClient(ClientCharacter clientCharacter) { } /// /// Should this ActionFX be created anticipatively on the owning client? /// - /// The ActionVisualization that would be playing this ActionFX. + /// The ActionVisualization that would be playing this ActionFX. /// The request being sent to the server /// If true ActionVisualization should pre-emptively create the ActionFX on the owning client, before hearing back from the server. - public static bool ShouldClientAnticipate(ClientCharacterVisualization parent, ref ActionRequestData data) + public static bool ShouldClientAnticipate(ClientCharacter clientCharacter, ref ActionRequestData data) { - if (!parent.CanPerformActions) { return false; } + if (!clientCharacter.CanPerformActions) { return false; } var actionDescription = GameDataSource.Instance.GetActionPrototypeByID(data.ActionID).Config; @@ -267,7 +267,7 @@ public static bool ShouldClientAnticipate(ClientCharacterVisualization parent, r if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(targetId, out NetworkObject networkObject)) { float rangeSquared = actionDescription.Range * actionDescription.Range; - isTargetEligible = (networkObject.transform.position - parent.transform.position).sqrMagnitude < rangeSquared; + isTargetEligible = (networkObject.transform.position - clientCharacter.transform.position).sqrMagnitude < rangeSquared; } } @@ -279,14 +279,14 @@ public static bool ShouldClientAnticipate(ClientCharacterVisualization parent, r /// /// Called when the visualization receives an animation event. /// - public virtual void OnAnimEventClient(ClientCharacterVisualization parent, string id) { } + public virtual void OnAnimEventClient(ClientCharacter clientCharacter, string id) { } /// /// Called when this action has finished "charging up". (Which is only meaningful for a /// few types of actions -- it is not called for other actions.) /// /// - public virtual void OnStoppedChargingUpClient(ClientCharacterVisualization parent, float finalChargeUpPercentage) { } + public virtual void OnStoppedChargingUpClient(ClientCharacter clientCharacter, float finalChargeUpPercentage) { } /// /// Utility function that instantiates all the graphics in the Spawns list. @@ -324,14 +324,14 @@ protected SpecialFXGraphic InstantiateSpecialFXGraphic(GameObject prefab, Transf /// you get this call immediately on the client, before the server round-trip. /// Overriders should always call the base class in their implementation! /// - public virtual void AnticipateActionClient(ClientCharacterVisualization parent) + public virtual void AnticipateActionClient(ClientCharacter clientCharacter) { AnticipatedClient = true; TimeStarted = UnityEngine.Time.time; if (!string.IsNullOrEmpty(Config.AnimAnticipation)) { - parent.OurAnimator.SetTrigger(Config.AnimAnticipation); + clientCharacter.OurAnimator.SetTrigger(Config.AnimAnticipation); } } diff --git a/Assets/Scripts/Gameplay/Action/BaseTypes/Action.cs.meta b/Assets/Scripts/Gameplay/Action/Action.cs.meta similarity index 100% rename from Assets/Scripts/Gameplay/Action/BaseTypes/Action.cs.meta rename to Assets/Scripts/Gameplay/Action/Action.cs.meta diff --git a/Assets/Scripts/Gameplay/Action/BaseTypes/ActionConfig.cs b/Assets/Scripts/Gameplay/Action/ActionConfig.cs similarity index 97% rename from Assets/Scripts/Gameplay/Action/BaseTypes/ActionConfig.cs rename to Assets/Scripts/Gameplay/Action/ActionConfig.cs index e6a57b0ab..1258688dd 100644 --- a/Assets/Scripts/Gameplay/Action/BaseTypes/ActionConfig.cs +++ b/Assets/Scripts/Gameplay/Action/ActionConfig.cs @@ -1,9 +1,8 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Actions; using System.Collections.Generic; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { [Serializable] public class ActionConfig diff --git a/Assets/Scripts/Gameplay/Action/BaseTypes/ActionConfig.cs.meta b/Assets/Scripts/Gameplay/Action/ActionConfig.cs.meta similarity index 100% rename from Assets/Scripts/Gameplay/Action/BaseTypes/ActionConfig.cs.meta rename to Assets/Scripts/Gameplay/Action/ActionConfig.cs.meta diff --git a/Assets/Scripts/Gameplay/Action/BaseTypes/ActionFactory.cs b/Assets/Scripts/Gameplay/Action/ActionFactory.cs similarity index 95% rename from Assets/Scripts/Gameplay/Action/BaseTypes/ActionFactory.cs rename to Assets/Scripts/Gameplay/Action/ActionFactory.cs index bf25bc8e7..09880430a 100644 --- a/Assets/Scripts/Gameplay/Action/BaseTypes/ActionFactory.cs +++ b/Assets/Scripts/Gameplay/Action/ActionFactory.cs @@ -1,9 +1,10 @@ using System; using System.Collections.Generic; +using Unity.BossRoom.Gameplay.GameplayObjects; using UnityEngine.Pool; using Object = UnityEngine.Object; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { public static class ActionFactory { diff --git a/Assets/Scripts/Gameplay/Action/BaseTypes/ActionFactory.cs.meta b/Assets/Scripts/Gameplay/Action/ActionFactory.cs.meta similarity index 100% rename from Assets/Scripts/Gameplay/Action/BaseTypes/ActionFactory.cs.meta rename to Assets/Scripts/Gameplay/Action/ActionFactory.cs.meta diff --git a/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/ActionID.cs b/Assets/Scripts/Gameplay/Action/ActionID.cs similarity index 96% rename from Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/ActionID.cs rename to Assets/Scripts/Gameplay/Action/ActionID.cs index bd7d368f5..0c8b01f7d 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/ActionID.cs +++ b/Assets/Scripts/Gameplay/Action/ActionID.cs @@ -1,7 +1,7 @@ using System; using Unity.Netcode; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.Actions { /// /// This struct is used by Action system (and GameDataSource) to refer to a specific action in runtime. diff --git a/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/ActionID.cs.meta b/Assets/Scripts/Gameplay/Action/ActionID.cs.meta similarity index 100% rename from Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/ActionID.cs.meta rename to Assets/Scripts/Gameplay/Action/ActionID.cs.meta diff --git a/Assets/Scripts/Gameplay/Action/ActionPlayers/ClientActionPlayer.cs b/Assets/Scripts/Gameplay/Action/ActionPlayers/ClientActionPlayer.cs index 93a1b84a5..eb25ea78a 100644 --- a/Assets/Scripts/Gameplay/Action/ActionPlayers/ClientActionPlayer.cs +++ b/Assets/Scripts/Gameplay/Action/ActionPlayers/ClientActionPlayer.cs @@ -1,10 +1,10 @@ using System.Collections.Generic; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { /// - /// This is a companion class to ClientCharacterVisualization that is specifically responsible for visualizing Actions. Action visualizations have lifetimes + /// This is a companion class to ClientCharacter that is specifically responsible for visualizing Actions. Action visualizations have lifetimes /// and ongoing state, making this class closely analogous in spirit to the Unity.Multiplayer.Samples.BossRoom.Actions.ServerActionPlayer class. /// public sealed class ClientActionPlayer @@ -17,11 +17,11 @@ public sealed class ClientActionPlayer /// private const float k_AnticipationTimeoutSeconds = 1; - public ClientCharacterVisualization CharacterVisualization { get; private set; } + public ClientCharacter ClientCharacter { get; private set; } - public ClientActionPlayer(ClientCharacterVisualization characterVisualization) + public ClientActionPlayer(ClientCharacter clientCharacter) { - CharacterVisualization = characterVisualization; + ClientCharacter = clientCharacter; } public void OnUpdate() @@ -30,14 +30,14 @@ public void OnUpdate() for (int i = m_PlayingActions.Count - 1; i >= 0; --i) { var action = m_PlayingActions[i]; - bool keepGoing = action.AnticipatedClient || action.OnUpdateClient(CharacterVisualization); // only call OnUpdate() on actions that are past anticipation + bool keepGoing = action.AnticipatedClient || action.OnUpdateClient(ClientCharacter); // only call OnUpdate() on actions that are past anticipation bool expirable = action.Config.DurationSeconds > 0f; //non-positive value is a sentinel indicating the duration is indefinite. bool timeExpired = expirable && action.TimeRunning >= action.Config.DurationSeconds; bool timedOut = action.AnticipatedClient && action.TimeRunning >= k_AnticipationTimeoutSeconds; if (!keepGoing || timeExpired || timedOut) { - if (timedOut) { action.CancelClient(CharacterVisualization); } //an anticipated action that timed out shouldn't get its End called. It is canceled instead. - else { action.EndClient(CharacterVisualization); } + if (timedOut) { action.CancelClient(ClientCharacter); } //an anticipated action that timed out shouldn't get its End called. It is canceled instead. + else { action.EndClient(ClientCharacter); } m_PlayingActions.RemoveAt(i); ActionFactory.ReturnAction(action); @@ -55,7 +55,7 @@ public void OnAnimEvent(string id) { foreach (var actionFX in m_PlayingActions) { - actionFX.OnAnimEventClient(CharacterVisualization, id); + actionFX.OnAnimEventClient(ClientCharacter, id); } } @@ -63,7 +63,7 @@ public void OnStoppedChargingUp(float finalChargeUpPercentage) { foreach (var actionFX in m_PlayingActions) { - actionFX.OnStoppedChargingUpClient(CharacterVisualization, finalChargeUpPercentage); + actionFX.OnStoppedChargingUpClient(ClientCharacter, finalChargeUpPercentage); } } @@ -103,10 +103,10 @@ public void OnStoppedChargingUp(float finalChargeUpPercentage) /// The Action that is being requested. public void AnticipateAction(ref ActionRequestData data) { - if (!CharacterVisualization.IsAnimating() && Action.ShouldClientAnticipate(CharacterVisualization, ref data)) + if (!ClientCharacter.IsAnimating() && Action.ShouldClientAnticipate(ClientCharacter, ref data)) { var actionFX = ActionFactory.CreateActionFromData(ref data); - actionFX.AnticipateActionClient(CharacterVisualization); + actionFX.AnticipateActionClient(ClientCharacter); m_PlayingActions.Add(actionFX); } } @@ -116,7 +116,7 @@ public void PlayAction(ref ActionRequestData data) var anticipatedActionIndex = FindAction(data.ActionID, true); var actionFX = anticipatedActionIndex >= 0 ? m_PlayingActions[anticipatedActionIndex] : ActionFactory.CreateActionFromData(ref data); - if (actionFX.OnStartClient(CharacterVisualization)) + if (actionFX.OnStartClient(ClientCharacter)) { if (anticipatedActionIndex < 0) { @@ -139,7 +139,7 @@ public void CancelAllActions() { foreach (var action in m_PlayingActions) { - action.CancelClient(CharacterVisualization); + action.CancelClient(ClientCharacter); ActionFactory.ReturnAction(action); } m_PlayingActions.Clear(); @@ -152,7 +152,7 @@ public void CancelAllActionsWithSamePrototypeID(ActionID actionID) if (m_PlayingActions[i].ActionID == actionID) { var action = m_PlayingActions[i]; - action.CancelClient(CharacterVisualization); + action.CancelClient(ClientCharacter); m_PlayingActions.RemoveAt(i); ActionFactory.ReturnAction(action); } diff --git a/Assets/Scripts/Gameplay/Action/ActionPlayers/ServerActionPlayer.cs b/Assets/Scripts/Gameplay/Action/ActionPlayers/ServerActionPlayer.cs index f1c8e905a..8350c660e 100644 --- a/Assets/Scripts/Gameplay/Action/ActionPlayers/ServerActionPlayer.cs +++ b/Assets/Scripts/Gameplay/Action/ActionPlayers/ServerActionPlayer.cs @@ -1,9 +1,10 @@ using System.Collections.Generic; -using Unity.Multiplayer.Samples.BossRoom.Server; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using UnityEngine; using UnityEngine.Pool; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { /// /// Class responsible for playing back action inputs from user. @@ -252,7 +253,7 @@ private int SynthesizeTargetIfNecessary(int baseIndex) if (targets != null && targets.Length == 1 && - targets[0] != m_ServerCharacter.NetState.TargetId.Value) + targets[0] != m_ServerCharacter.TargetId.Value) { //if this is a targeted skill (with a single requested target), and it is different from our //active target, then we synthesize a TargetAction to change our target over. diff --git a/Assets/Scripts/Gameplay/Action/ActionUtils.cs b/Assets/Scripts/Gameplay/Action/ActionUtils.cs index d637ac55f..19ed37412 100644 --- a/Assets/Scripts/Gameplay/Action/ActionUtils.cs +++ b/Assets/Scripts/Gameplay/Action/ActionUtils.cs @@ -1,8 +1,9 @@ using System.Collections.Generic; +using Unity.BossRoom.Gameplay.GameplayObjects; using Unity.Netcode; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { public static class ActionUtils { diff --git a/Assets/Scripts/Gameplay/Action/BaseTypes.meta b/Assets/Scripts/Gameplay/Action/BaseTypes.meta deleted file mode 100644 index 78791def1..000000000 --- a/Assets/Scripts/Gameplay/Action/BaseTypes.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: ada6a825492041199c579780017258f0 -timeCreated: 1658754048 \ No newline at end of file diff --git a/Assets/Scripts/Gameplay/Action/BaseTypes/BlockingModeType.cs b/Assets/Scripts/Gameplay/Action/BlockingModeType.cs similarity index 72% rename from Assets/Scripts/Gameplay/Action/BaseTypes/BlockingModeType.cs rename to Assets/Scripts/Gameplay/Action/BlockingModeType.cs index 0a5acd131..84d3b0658 100644 --- a/Assets/Scripts/Gameplay/Action/BaseTypes/BlockingModeType.cs +++ b/Assets/Scripts/Gameplay/Action/BlockingModeType.cs @@ -1,6 +1,6 @@ using System; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { [System.Serializable] public enum BlockingModeType diff --git a/Assets/Scripts/Gameplay/Action/BaseTypes/BlockingModeType.cs.meta b/Assets/Scripts/Gameplay/Action/BlockingModeType.cs.meta similarity index 100% rename from Assets/Scripts/Gameplay/Action/BaseTypes/BlockingModeType.cs.meta rename to Assets/Scripts/Gameplay/Action/BlockingModeType.cs.meta diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/AOEAction.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/AOEAction.cs index 910787daf..e01564ef6 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/AOEAction.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/AOEAction.cs @@ -1,9 +1,9 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Server; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { /// /// Area-of-effect attack Action. The attack is centered on a point provided by the client. @@ -21,9 +21,9 @@ public class AOEAction : Action bool m_DidAoE; - public override bool OnStart(ServerCharacter parent) + public override bool OnStart(ServerCharacter serverCharacter) { - float distanceAway = Vector3.Distance(parent.physicsWrapper.Transform.position, Data.Position); + float distanceAway = Vector3.Distance(serverCharacter.physicsWrapper.Transform.position, Data.Position); if (distanceAway > Config.Range + k_MaxDistanceDivergence) { // Due to latency, it's possible for the client side click check to be out of date with the server driven position. Doing a final check server side to make sure. @@ -34,8 +34,8 @@ public override bool OnStart(ServerCharacter parent) // We don't know our actual targets for this attack until it triggers, so the client can't use the TargetIds list (and we clear it out for clarity). // This means we are responsible for triggering reaction-anims ourselves, which we do in PerformAoe() Data.TargetIds = new ulong[0]; - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); - parent.NetState.RecvDoActionClientRPC(Data); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); + serverCharacter.clientCharacter.RecvDoActionClientRPC(Data); return ActionConclusion.Continue; } @@ -45,13 +45,13 @@ public override void Reset() m_DidAoE = false; } - public override bool OnUpdate(ServerCharacter parent) + public override bool OnUpdate(ServerCharacter clientCharacter) { if (TimeRunning >= Config.ExecTimeSeconds && !m_DidAoE) { // actually perform the AoE attack m_DidAoE = true; - PerformAoE(parent); + PerformAoE(clientCharacter); } return ActionConclusion.Continue; @@ -74,14 +74,14 @@ private void PerformAoE(ServerCharacter parent) } } - public override bool OnStartClient(ClientCharacterVisualization parent) + public override bool OnStartClient(ClientCharacter clientCharacter) { - base.OnStartClient(parent); + base.OnStartClient(clientCharacter); GameObject.Instantiate(Config.Spawns[0], Data.Position, Quaternion.identity); return ActionConclusion.Stop; } - public override bool OnUpdateClient(ClientCharacterVisualization clientParent) + public override bool OnUpdateClient(ClientCharacter clientCharacter) { throw new Exception("This should not execute"); } diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/ChargedLaunchProjectileAction.Client.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/ChargedLaunchProjectileAction.Client.cs index 722f69b3a..86509ea8c 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/ChargedLaunchProjectileAction.Client.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/ChargedLaunchProjectileAction.Client.cs @@ -1,7 +1,9 @@ +using System; using System.Collections.Generic; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.VisualEffects; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { public partial class ChargedLaunchProjectileAction { @@ -17,20 +19,20 @@ public partial class ChargedLaunchProjectileAction private bool m_ChargeEnded; - public override bool OnStartClient(ClientCharacterVisualization parent) + public override bool OnStartClient(ClientCharacter clientCharacter) { - base.OnStartClient(parent); + base.OnStartClient(clientCharacter); - m_Graphics = InstantiateSpecialFXGraphics(parent.transform, true); + m_Graphics = InstantiateSpecialFXGraphics(clientCharacter.transform, true); return true; } - public override bool OnUpdateClient(ClientCharacterVisualization parent) + public override bool OnUpdateClient(ClientCharacter clientCharacter) { return !m_ChargeEnded; } - public override void CancelClient(ClientCharacterVisualization parent) + public override void CancelClient(ClientCharacter clientCharacter) { if (!m_ChargeEnded) { @@ -44,7 +46,7 @@ public override void CancelClient(ClientCharacterVisualization parent) } } - public override void OnStoppedChargingUpClient(ClientCharacterVisualization parent, float finalChargeUpPercentage) + public override void OnStoppedChargingUpClient(ClientCharacter clientCharacter, float finalChargeUpPercentage) { m_ChargeEnded = true; foreach (var graphic in m_Graphics) diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/ChargedLaunchProjectileAction.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/ChargedLaunchProjectileAction.cs index a8bcd4c5d..e23f5895f 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/ChargedLaunchProjectileAction.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/ChargedLaunchProjectileAction.cs @@ -1,11 +1,9 @@ using System; -using System.Collections.Generic; -using Unity.Multiplayer.Samples.BossRoom.Server; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.Netcode; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { /// /// A version of LaunchProjectileAction that can be "powered up" by holding down the attack key. @@ -38,7 +36,7 @@ public partial class ChargedLaunchProjectileAction : LaunchProjectileAction /// private bool m_HitByAttack = false; - public override bool OnStart(ServerCharacter parent) + public override bool OnStart(ServerCharacter serverCharacter) { // if we have an explicit target, make sure we're aimed at them. // (But if the player just clicked on an attack button, there won't be an explicit target, so we should stay facing however we're facing.) @@ -48,14 +46,14 @@ public override bool OnStart(ServerCharacter parent) if (initialTarget) { // face our target - parent.physicsWrapper.Transform.LookAt(initialTarget.transform.position); + serverCharacter.physicsWrapper.Transform.LookAt(initialTarget.transform.position); } } - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); // start the "charging up" ActionFX - parent.NetState.RecvDoActionClientRPC(Data); + serverCharacter.clientCharacter.RecvDoActionClientRPC(Data); // sanity-check our data a bit Debug.Assert(Config.Projectiles.Length > 1, $"Action {name} has {Config.Projectiles.Length} Projectiles. Expected at least 2!"); @@ -77,40 +75,40 @@ public override void Reset() m_Graphics.Clear(); } - public override bool OnUpdate(ServerCharacter parent) + public override bool OnUpdate(ServerCharacter clientCharacter) { if (m_StoppedChargingUpTime == 0 && GetPercentChargedUp() >= 1) { // we haven't explicitly stopped charging up... but we've reached max charge, so that implicitly stops us - StopChargingUp(parent); + StopChargingUp(clientCharacter); } // we end as soon as we've stopped charging up (and have fired the projectile) return m_StoppedChargingUpTime == 0; } - public override void OnGameplayActivity(ServerCharacter parent, GameplayActivity activityType) + public override void OnGameplayActivity(ServerCharacter serverCharacter, GameplayActivity activityType) { if (activityType == GameplayActivity.AttackedByEnemy) { // if we get attacked while charging up, we don't actually get to shoot! m_HitByAttack = true; - StopChargingUp(parent); + StopChargingUp(serverCharacter); } else if (activityType == GameplayActivity.StoppedChargingUp) { - StopChargingUp(parent); + StopChargingUp(serverCharacter); } } - public override void Cancel(ServerCharacter parent) + public override void Cancel(ServerCharacter serverCharacter) { - StopChargingUp(parent); + StopChargingUp(serverCharacter); } - public override void End(ServerCharacter parent) + public override void End(ServerCharacter serverCharacter) { - StopChargingUp(parent); + StopChargingUp(serverCharacter); } private void StopChargingUp(ServerCharacter parent) @@ -124,7 +122,7 @@ private void StopChargingUp(ServerCharacter parent) parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim2); } - parent.NetState.RecvStopChargingUpClientRpc(GetPercentChargedUp()); + parent.clientCharacter.RecvStopChargingUpClientRpc(GetPercentChargedUp()); if (!m_HitByAttack) { LaunchProjectile(parent); diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/ChargedShieldAction.Client.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/ChargedShieldAction.Client.cs index 54ad44d31..d42237c7d 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/ChargedShieldAction.Client.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/ChargedShieldAction.Client.cs @@ -1,7 +1,9 @@ -using Unity.Multiplayer.Samples.BossRoom.Visual; +using System; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.VisualEffects; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { public partial class ChargedShieldAction { @@ -15,12 +17,12 @@ public partial class ChargedShieldAction /// SpecialFXGraphic m_ShieldGraphics; - public override bool OnUpdateClient(ClientCharacterVisualization parent) + public override bool OnUpdateClient(ClientCharacter clientCharacter) { return IsChargingUp() || (Time.time - m_StoppedChargingUpTime) < Config.EffectDurationSeconds; } - public override void CancelClient(ClientCharacterVisualization parent) + public override void CancelClient(ClientCharacter clientCharacter) { if (IsChargingUp()) { @@ -37,7 +39,7 @@ public override void CancelClient(ClientCharacterVisualization parent) } } - public override void OnStoppedChargingUpClient(ClientCharacterVisualization parent, float finalChargeUpPercentage) + public override void OnStoppedChargingUpClient(ClientCharacter clientCharacter, float finalChargeUpPercentage) { if (!IsChargingUp()) { return; } @@ -51,18 +53,18 @@ public override void OnStoppedChargingUpClient(ClientCharacterVisualization pare // if fully charged, we show a special graphic if (Mathf.Approximately(finalChargeUpPercentage, 1)) { - m_ShieldGraphics = InstantiateSpecialFXGraphic(Config.Spawns[1], parent.transform, true); + m_ShieldGraphics = InstantiateSpecialFXGraphic(Config.Spawns[1], clientCharacter.transform, true); } } - public override void AnticipateActionClient(ClientCharacterVisualization parent) + public override void AnticipateActionClient(ClientCharacter clientCharacter) { // because this action can be visually started and stopped as often and as quickly as the player wants, it's possible // for several copies of this action to be playing at once. This can lead to situations where several // dying versions of the action raise the end-trigger, but the animator only lowers it once, leaving the trigger // in a raised state. So we'll make sure that our end-trigger isn't raised yet. (Generally a good idea anyway.) - parent.OurAnimator.ResetTrigger(Config.Anim2); - base.AnticipateActionClient(parent); + clientCharacter.OurAnimator.ResetTrigger(Config.Anim2); + base.AnticipateActionClient(clientCharacter); } } } diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/ChargedShieldAction.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/ChargedShieldAction.cs index b7624eafa..a4d3ad69e 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/ChargedShieldAction.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/ChargedShieldAction.cs @@ -1,11 +1,10 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Server; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.Netcode; using UnityEngine; using UnityEngine.Assertions; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { /// /// A defensive action where the character becomes resistant to damage. @@ -32,7 +31,7 @@ public partial class ChargedShieldAction : Action /// private float m_StoppedChargingUpTime = 0; - public override bool OnStart(ServerCharacter parent) + public override bool OnStart(ServerCharacter serverCharacter) { if (m_Data.TargetIds != null && m_Data.TargetIds.Length > 0) { @@ -40,7 +39,7 @@ public override bool OnStart(ServerCharacter parent) if (initialTarget) { // face our target, if we had one - parent.physicsWrapper.Transform.LookAt(initialTarget.transform.position); + serverCharacter.physicsWrapper.Transform.LookAt(initialTarget.transform.position); } } @@ -48,12 +47,12 @@ public override bool OnStart(ServerCharacter parent) // for several copies of this action to be playing at once. This can lead to situations where several // dying versions of the action raise the end-trigger, but the animator only lowers it once, leaving the trigger // in a raised state. So we'll make sure that our end-trigger isn't raised yet. (Generally a good idea anyway.) - parent.serverAnimationHandler.NetworkAnimator.ResetTrigger(Config.Anim2); + serverCharacter.serverAnimationHandler.NetworkAnimator.ResetTrigger(Config.Anim2); // raise the start trigger to start the animation loop! - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); - parent.NetState.RecvDoActionClientRPC(Data); + serverCharacter.clientCharacter.RecvDoActionClientRPC(Data); return true; } @@ -70,14 +69,14 @@ private bool IsChargingUp() return m_StoppedChargingUpTime == 0; } - public override bool OnUpdate(ServerCharacter parent) + public override bool OnUpdate(ServerCharacter clientCharacter) { if (m_StoppedChargingUpTime == 0) { // we haven't explicitly stopped charging up... but if we've reached max charge, that implicitly stops us if (TimeRunning >= Config.ExecTimeSeconds) { - StopChargingUp(parent); + StopChargingUp(clientCharacter); } } @@ -120,24 +119,24 @@ public override void BuffValue(BuffableValue buffType, ref float buffedValue) } } - public override void OnGameplayActivity(ServerCharacter parent, GameplayActivity activityType) + public override void OnGameplayActivity(ServerCharacter serverCharacter, GameplayActivity activityType) { // for this particular type of Action, being attacked immediately causes you to stop charging up if (activityType == GameplayActivity.AttackedByEnemy || activityType == GameplayActivity.StoppedChargingUp) { - StopChargingUp(parent); + StopChargingUp(serverCharacter); } } - public override void Cancel(ServerCharacter parent) + public override void Cancel(ServerCharacter serverCharacter) { - StopChargingUp(parent); + StopChargingUp(serverCharacter); // if stepped into invincibility, decrement invincibility counter if (Mathf.Approximately(GetPercentChargedUp(), 1f)) { - parent.serverAnimationHandler.NetworkAnimator.Animator.SetInteger(Config.OtherAnimatorVariable, - parent.serverAnimationHandler.NetworkAnimator.Animator.GetInteger(Config.OtherAnimatorVariable) - 1); + serverCharacter.serverAnimationHandler.NetworkAnimator.Animator.SetInteger(Config.OtherAnimatorVariable, + serverCharacter.serverAnimationHandler.NetworkAnimator.Animator.GetInteger(Config.OtherAnimatorVariable) - 1); } } @@ -146,7 +145,7 @@ private void StopChargingUp(ServerCharacter parent) if (IsChargingUp()) { m_StoppedChargingUpTime = Time.time; - parent.NetState.RecvStopChargingUpClientRpc(GetPercentChargedUp()); + parent.clientCharacter.RecvStopChargingUpClientRpc(GetPercentChargedUp()); parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim2); @@ -163,12 +162,12 @@ private void StopChargingUp(ServerCharacter parent) } } - public override bool OnStartClient(ClientCharacterVisualization parent) + public override bool OnStartClient(ClientCharacter clientCharacter) { Assert.IsTrue(Config.Spawns.Length == 2, $"Found {Config.Spawns.Length} spawns for action {name}. Should be exactly 2: a charge-up particle and a fully-charged particle"); - base.OnStartClient(parent); - m_ChargeGraphics = InstantiateSpecialFXGraphic(Config.Spawns[0], parent.transform, true); + base.OnStartClient(clientCharacter); + m_ChargeGraphics = InstantiateSpecialFXGraphic(Config.Spawns[0], clientCharacter.transform, true); return true; } } diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/ChaseAction.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/ChaseAction.cs index 5a8d15b62..4970a3731 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/ChaseAction.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/ChaseAction.cs @@ -1,10 +1,9 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Server; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.Netcode; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { [CreateAssetMenu(menuName = "BossRoom/Actions/Chase Action")] public class ChaseAction : Action @@ -17,7 +16,7 @@ public class ChaseAction : Action /// Called when the Action starts actually playing (which may be after it is created, because of queueing). /// /// false if the action decided it doesn't want to run after all, true otherwise. - public override bool OnStart(ServerCharacter parent) + public override bool OnStart(ServerCharacter serverCharacter) { if (!HasValidTarget()) { @@ -38,15 +37,15 @@ public override bool OnStart(ServerCharacter parent) Vector3 currentTargetPos = m_TargetTransform.position; - if (StopIfDone(parent)) + if (StopIfDone(serverCharacter)) { - parent.physicsWrapper.Transform.LookAt(currentTargetPos); //even if we didn't move, snap to face the target! + serverCharacter.physicsWrapper.Transform.LookAt(currentTargetPos); //even if we didn't move, snap to face the target! return ActionConclusion.Stop; } - if (!parent.Movement.IsPerformingForcedMovement()) + if (!serverCharacter.Movement.IsPerformingForcedMovement()) { - parent.Movement.FollowTransform(m_TargetTransform); + serverCharacter.Movement.FollowTransform(m_TargetTransform); } return ActionConclusion.Continue; } @@ -96,29 +95,29 @@ private bool StopIfDone(ServerCharacter parent) /// Called each frame while the action is running. /// /// true to keep running, false to stop. The Action will stop by default when its duration expires, if it has a duration set. - public override bool OnUpdate(ServerCharacter parent) + public override bool OnUpdate(ServerCharacter clientCharacter) { - if (StopIfDone(parent)) { return ActionConclusion.Stop; } + if (StopIfDone(clientCharacter)) { return ActionConclusion.Stop; } // Keep re-assigning our chase target whenever possible. // This way, if we get Knocked Back mid-chase, we pick right back up and continue the chase. - if (!parent.Movement.IsPerformingForcedMovement()) + if (!clientCharacter.Movement.IsPerformingForcedMovement()) { - parent.Movement.FollowTransform(m_TargetTransform); + clientCharacter.Movement.FollowTransform(m_TargetTransform); } return ActionConclusion.Continue; } - public override void Cancel(ServerCharacter parent) + public override void Cancel(ServerCharacter serverCharacter) { - if (parent.Movement && !parent.Movement.IsPerformingForcedMovement()) + if (serverCharacter.Movement && !serverCharacter.Movement.IsPerformingForcedMovement()) { - parent.Movement.CancelMove(); + serverCharacter.Movement.CancelMove(); } } - public override bool OnUpdateClient(ClientCharacterVisualization clientParent) + public override bool OnUpdateClient(ClientCharacter clientCharacter) { return ActionConclusion.Continue; } diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/DashAttackAction.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/DashAttackAction.cs index 07bc3a327..8a1b56549 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/DashAttackAction.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/DashAttackAction.cs @@ -1,10 +1,9 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Server; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using UnityEngine; -using UnityEngine.Assertions; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { /// /// Causes the attacker to teleport near a target spot, then perform a melee attack. The client @@ -28,18 +27,18 @@ public class DashAttackAction : Action private bool m_Dashed; - public override bool OnStart(ServerCharacter parent) + public override bool OnStart(ServerCharacter serverCharacter) { // remember the exact spot we'll stop. - m_TargetSpot = ActionUtils.GetDashDestination(parent.physicsWrapper.Transform, Data.Position, true, Config.Range, Config.Range); + m_TargetSpot = ActionUtils.GetDashDestination(serverCharacter.physicsWrapper.Transform, Data.Position, true, Config.Range, Config.Range); // snap to face our destination. This ensures the client visualization faces the right way while "pretending" to dash - parent.physicsWrapper.Transform.LookAt(m_TargetSpot); + serverCharacter.physicsWrapper.Transform.LookAt(m_TargetSpot); - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); // tell clients to visualize this action - parent.NetState.RecvDoActionClientRPC(Data); + serverCharacter.clientCharacter.RecvDoActionClientRPC(Data); return ActionConclusion.Continue; } @@ -51,37 +50,37 @@ public override void Reset() m_Dashed = false; } - public override bool OnUpdate(ServerCharacter parent) + public override bool OnUpdate(ServerCharacter clientCharacter) { return ActionConclusion.Continue; } - public override void End(ServerCharacter parent) + public override void End(ServerCharacter serverCharacter) { // Anim2 contains the name of the end-loop-sequence trigger if (!string.IsNullOrEmpty(Config.Anim2)) { - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim2); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim2); } // we're done, time to teleport! - parent.Movement.Teleport(m_TargetSpot); + serverCharacter.Movement.Teleport(m_TargetSpot); // and then swing! - PerformMeleeAttack(parent); + PerformMeleeAttack(serverCharacter); } - public override void Cancel(ServerCharacter parent) + public override void Cancel(ServerCharacter serverCharacter) { // OtherAnimatorVariable contains the name of the cancellation trigger if (!string.IsNullOrEmpty(Config.OtherAnimatorVariable)) { - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.OtherAnimatorVariable); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.OtherAnimatorVariable); } // because the client-side visualization of the action moves the character visualization around, // we need to explicitly end the client-side visuals when we abort - parent.NetState.RecvCancelActionsByPrototypeIDClientRpc(ActionID); + serverCharacter.clientCharacter.RecvCancelActionsByPrototypeIDClientRpc(ActionID); } @@ -108,7 +107,7 @@ private void PerformMeleeAttack(ServerCharacter parent) } } - public override bool OnUpdateClient(ClientCharacterVisualization parent) + public override bool OnUpdateClient(ClientCharacter clientCharacter) { if (m_Dashed) { return ActionConclusion.Stop; } // we're done! diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/DropAction.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/DropAction.cs index 2043509da..a2ecbc660 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/DropAction.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/DropAction.cs @@ -1,10 +1,9 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Actions; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.Netcode; using UnityEngine; -using Action = Unity.Multiplayer.Samples.BossRoom.Actions.Action; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.Actions { /// /// Action for dropping "Heavy" items. @@ -16,13 +15,13 @@ public class DropAction : Action NetworkObject m_HeldNetworkObject; - public override bool OnStart(ServerCharacter parent) + public override bool OnStart(ServerCharacter serverCharacter) { m_ActionStartTime = Time.time; // play animation of dropping a heavy object, if one is already held if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue( - parent.NetState.heldNetworkObject.Value, out var heldObject)) + serverCharacter.HeldNetworkObject.Value, out var heldObject)) { m_HeldNetworkObject = heldObject; @@ -30,7 +29,7 @@ public override bool OnStart(ServerCharacter parent) if (!string.IsNullOrEmpty(Config.Anim)) { - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); } } @@ -44,13 +43,13 @@ public override void Reset() m_HeldNetworkObject = null; } - public override bool OnUpdate(ServerCharacter parent) + public override bool OnUpdate(ServerCharacter clientCharacter) { if (Time.time > m_ActionStartTime + Config.ExecTimeSeconds) { // drop the pot in space m_HeldNetworkObject.transform.SetParent(null); - parent.NetState.heldNetworkObject.Value = 0; + clientCharacter.HeldNetworkObject.Value = 0; return ActionConclusion.Stop; } diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/EmoteAction.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/EmoteAction.cs index d356aa741..a41c52755 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/EmoteAction.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/EmoteAction.cs @@ -1,34 +1,33 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Server; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { [CreateAssetMenu(menuName = "BossRoom/Actions/Emote Action")] public class EmoteAction : Action { - public override bool OnStart(ServerCharacter parent) + public override bool OnStart(ServerCharacter serverCharacter) { - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); return false; } - public override bool OnUpdate(ServerCharacter parent) + public override bool OnUpdate(ServerCharacter clientCharacter) { // since we return false at Start(), this method should not execute throw new InvalidOperationException("No logic defined."); } - public override void Cancel(ServerCharacter parent) + public override void Cancel(ServerCharacter serverCharacter) { if (!string.IsNullOrEmpty(Config.Anim2)) { - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim2); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim2); } } - public override bool OnUpdateClient(ClientCharacterVisualization parent) + public override bool OnUpdateClient(ClientCharacter clientCharacter) { return ActionConclusion.Continue; } diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/FXProjectileTargetedAction.Client.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/FXProjectileTargetedAction.Client.cs index 62b5c2889..568de1415 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/FXProjectileTargetedAction.Client.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/FXProjectileTargetedAction.Client.cs @@ -1,9 +1,11 @@ -using Unity.Multiplayer.Samples.BossRoom.Client; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using System; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.Netcode; using UnityEngine; +using Object = UnityEngine.Object; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { public partial class FXProjectileTargetedAction { @@ -17,10 +19,10 @@ public partial class FXProjectileTargetedAction private NetworkObject m_Target; Transform m_TargetTransform; - public override bool OnStartClient(ClientCharacterVisualization parent) + public override bool OnStartClient(ClientCharacter clientCharacter) { - base.OnStartClient(parent); - m_Target = GetTarget(parent); + base.OnStartClient(clientCharacter); + m_Target = GetTarget(clientCharacter); if (m_Target && PhysicsWrapper.TryGetPhysicsWrapper(m_Target.NetworkObjectId, out var physicsWrapper)) { @@ -33,24 +35,24 @@ public override bool OnStartClient(ClientCharacterVisualization parent) return true; } - public override bool OnUpdateClient(ClientCharacterVisualization parent) + public override bool OnUpdateClient(ClientCharacter clientCharacter) { if (TimeRunning >= Config.ExecTimeSeconds && m_Projectile == null) { // figure out how long the pretend-projectile will be flying to the target var targetPos = m_TargetTransform ? m_TargetTransform.position : Data.Position; - var initialDistance = Vector3.Distance(targetPos, parent.transform.position); + var initialDistance = Vector3.Distance(targetPos, clientCharacter.transform.position); m_ProjectileDuration = initialDistance / Config.Projectiles[0].Speed_m_s; // create the projectile. It will control itself from here on out - m_Projectile = SpawnAndInitializeProjectile(parent); + m_Projectile = SpawnAndInitializeProjectile(clientCharacter); } // we keep going until the projectile's duration ends return TimeRunning <= m_ProjectileDuration + Config.ExecTimeSeconds; } - public override void CancelClient(ClientCharacterVisualization parent) + public override void CancelClient(ClientCharacter clientCharacter) { if (m_Projectile) { @@ -59,7 +61,7 @@ public override void CancelClient(ClientCharacterVisualization parent) } } - public override void EndClient(ClientCharacterVisualization parent) + public override void EndClient(ClientCharacter clientCharacter) { PlayHitReact(); } @@ -75,14 +77,14 @@ void PlayHitReact() return; } - if (m_Target && m_Target.TryGetComponent(out Client.ClientCharacter clientCharacter) && clientCharacter.ChildVizObject != null) + if (m_Target && m_Target.TryGetComponent(out ServerCharacter clientCharacter) && clientCharacter.clientCharacter != null) { var hitReact = !string.IsNullOrEmpty(Config.ReactAnim) ? Config.ReactAnim : k_DefaultHitReact; - clientCharacter.ChildVizObject.OurAnimator.SetTrigger(hitReact); + clientCharacter.clientCharacter.OurAnimator.SetTrigger(hitReact); } } - NetworkObject GetTarget(ClientCharacterVisualization parent) + NetworkObject GetTarget(ClientCharacter parent) { if (Data.TargetIds == null || Data.TargetIds.Length == 0) { @@ -93,7 +95,7 @@ NetworkObject GetTarget(ClientCharacterVisualization parent) { // make sure this isn't a friend (or if it is, make sure this is a friendly-fire action) var targetable = targetObject.GetComponent(); - if (targetable != null && targetable.IsNpc == (Config.IsFriendly ^ parent.NetState.IsNpc)) + if (targetable != null && targetable.IsNpc == (Config.IsFriendly ^ parent.serverCharacter.IsNpc)) { // not a valid target return null; @@ -109,7 +111,7 @@ NetworkObject GetTarget(ClientCharacterVisualization parent) } } - FXProjectile SpawnAndInitializeProjectile(ClientCharacterVisualization parent) + FXProjectile SpawnAndInitializeProjectile(ClientCharacter parent) { var projectileGO = Object.Instantiate(Config.Projectiles[0].ProjectilePrefab, parent.transform.position, parent.transform.rotation, null); @@ -124,9 +126,9 @@ FXProjectile SpawnAndInitializeProjectile(ClientCharacterVisualization parent) return projectile; } - public override void AnticipateActionClient(ClientCharacterVisualization parent) + public override void AnticipateActionClient(ClientCharacter clientCharacter) { - base.AnticipateActionClient(parent); + base.AnticipateActionClient(clientCharacter); // see if this is going to be a "miss" because the player tried to click through a wall. If so, // we change our data in the same way that the server will (changing our target point to the spot on the wall) @@ -140,7 +142,7 @@ public override void AnticipateActionClient(ClientCharacterVisualization parent) } } - if (!ActionUtils.HasLineOfSight(parent.transform.position, targetSpot, out Vector3 collidePos)) + if (!ActionUtils.HasLineOfSight(clientCharacter.transform.position, targetSpot, out Vector3 collidePos)) { // we do not have line of sight to the target point. So our target instead becomes the obstruction point Data.TargetIds = null; diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/FXProjectileTargetedAction.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/FXProjectileTargetedAction.cs index 73e73570f..84a1cbbb7 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/FXProjectileTargetedAction.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/FXProjectileTargetedAction.cs @@ -1,12 +1,10 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Client; -using Unity.Multiplayer.Samples.BossRoom.Server; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.Netcode; using UnityEngine; -using Object = UnityEngine.Object; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { /// /// Action that represents an always-hit raybeam-style ranged attack. A particle is shown from caster to target, and then the @@ -23,15 +21,15 @@ public partial class FXProjectileTargetedAction : Action private float m_TimeUntilImpact; private IDamageable m_DamageableTarget; - public override bool OnStart(ServerCharacter parent) + public override bool OnStart(ServerCharacter serverCharacter) { - m_DamageableTarget = GetDamageableTarget(parent); + m_DamageableTarget = GetDamageableTarget(serverCharacter); // figure out where the player wants us to aim at... Vector3 targetPos = m_DamageableTarget != null ? m_DamageableTarget.transform.position : m_Data.Position; // then make sure we can actually see that point! - if (!ActionUtils.HasLineOfSight(parent.physicsWrapper.Transform.position, targetPos, out Vector3 collidePos)) + if (!ActionUtils.HasLineOfSight(serverCharacter.physicsWrapper.Transform.position, targetPos, out Vector3 collidePos)) { // we do not have line of sight to the target point. So our target instead becomes the obstruction point m_DamageableTarget = null; @@ -43,15 +41,15 @@ public override bool OnStart(ServerCharacter parent) } // turn to face our target! - parent.physicsWrapper.Transform.LookAt(targetPos); + serverCharacter.physicsWrapper.Transform.LookAt(targetPos); // figure out how long the pretend-projectile will be flying to the target - float distanceToTargetPos = Vector3.Distance(targetPos, parent.physicsWrapper.Transform.position); + float distanceToTargetPos = Vector3.Distance(targetPos, serverCharacter.physicsWrapper.Transform.position); m_TimeUntilImpact = Config.ExecTimeSeconds + (distanceToTargetPos / Config.Projectiles[0].Speed_m_s); - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); // tell clients to visualize this action - parent.NetState.RecvDoActionClientRPC(Data); + serverCharacter.clientCharacter.RecvDoActionClientRPC(Data); return true; } @@ -69,24 +67,24 @@ public override void Reset() m_TargetTransform = null; } - public override bool OnUpdate(ServerCharacter parent) + public override bool OnUpdate(ServerCharacter clientCharacter) { if (!m_ImpactedTarget && m_TimeUntilImpact <= TimeRunning) { m_ImpactedTarget = true; if (m_DamageableTarget != null) { - m_DamageableTarget.ReceiveHP(parent, -Config.Projectiles[0].Damage); + m_DamageableTarget.ReceiveHP(clientCharacter, -Config.Projectiles[0].Damage); } } return true; } - public override void Cancel(ServerCharacter parent) + public override void Cancel(ServerCharacter serverCharacter) { if (!m_ImpactedTarget) { - parent.NetState.RecvCancelActionsByPrototypeIDClientRpc(ActionID); + serverCharacter.clientCharacter.RecvCancelActionsByPrototypeIDClientRpc(ActionID); } } diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/LaunchProjectileAction.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/LaunchProjectileAction.cs index c78ec035f..8b7e5fe3d 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/LaunchProjectileAction.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/LaunchProjectileAction.cs @@ -1,11 +1,11 @@ using System; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.Infrastructure; using Unity.Netcode; using UnityEngine; -using BossRoom.Scripts.Shared.Net.NetworkObjectPool; -using Unity.Multiplayer.Samples.BossRoom.Server; -using Unity.Multiplayer.Samples.BossRoom.Visual; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { /// /// Action responsible for creating a projectile object. @@ -15,13 +15,13 @@ public class LaunchProjectileAction : Action { private bool m_Launched = false; - public override bool OnStart(ServerCharacter parent) + public override bool OnStart(ServerCharacter serverCharacter) { //snap to face the direction we're firing, and then broadcast the animation, which we do immediately. - parent.physicsWrapper.Transform.forward = Data.Direction; + serverCharacter.physicsWrapper.Transform.forward = Data.Direction; - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); - parent.NetState.RecvDoActionClientRPC(Data); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); + serverCharacter.clientCharacter.RecvDoActionClientRPC(Data); return true; } @@ -31,11 +31,11 @@ public override void Reset() base.Reset(); } - public override bool OnUpdate(ServerCharacter parent) + public override bool OnUpdate(ServerCharacter clientCharacter) { if (TimeRunning >= Config.ExecTimeSeconds && !m_Launched) { - LaunchProjectile(parent); + LaunchProjectile(clientCharacter); } return true; @@ -50,7 +50,7 @@ protected virtual ProjectileInfo GetProjectileInfo() { foreach (var projectileInfo in Config.Projectiles) { - if (projectileInfo.ProjectilePrefab && projectileInfo.ProjectilePrefab.GetComponent()) + if (projectileInfo.ProjectilePrefab && projectileInfo.ProjectilePrefab.GetComponent()) return projectileInfo; } throw new System.Exception($"Action {name} has no usable Projectiles!"); @@ -78,27 +78,27 @@ protected void LaunchProjectile(ServerCharacter parent) //where it appears next to the player. no.transform.position = parent.physicsWrapper.Transform.localToWorldMatrix.MultiplyPoint(no.transform.position); - no.GetComponent().Initialize(parent.NetworkObjectId, projectileInfo); + no.GetComponent().Initialize(parent.NetworkObjectId, projectileInfo); no.Spawn(true); } } - public override void End(ServerCharacter parent) + public override void End(ServerCharacter serverCharacter) { //make sure this happens. - LaunchProjectile(parent); + LaunchProjectile(serverCharacter); } - public override void Cancel(ServerCharacter parent) + public override void Cancel(ServerCharacter serverCharacter) { if (!string.IsNullOrEmpty(Config.Anim2)) { - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim2); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim2); } } - public override bool OnUpdateClient(ClientCharacterVisualization parent) + public override bool OnUpdateClient(ClientCharacter clientCharacter) { return ActionConclusion.Continue; } diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/MeleeAction.Client.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/MeleeAction.Client.cs index 76fcd5de7..a593a0131 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/MeleeAction.Client.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/MeleeAction.Client.cs @@ -1,9 +1,11 @@ +using System; using System.Collections.Generic; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.VisualEffects; using Unity.Netcode; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { public partial class MeleeAction { @@ -20,9 +22,9 @@ public partial class MeleeAction /// private List m_SpawnedGraphics = null; - public override bool OnStartClient(ClientCharacterVisualization parent) + public override bool OnStartClient(ClientCharacter clientCharacter) { - base.OnStartClient(parent); + base.OnStartClient(clientCharacter); // we can optionally have special particles that should play on the target. If so, add them now. // (don't wait until impact, because the particles need to start sooner!) @@ -43,7 +45,7 @@ public override bool OnStartClient(ClientCharacterVisualization parent) targetPosition = targetNetworkObj.transform.position; } - if ((parent.transform.position - targetPosition).sqrMagnitude < (padRange * padRange)) + if ((clientCharacter.transform.position - targetPosition).sqrMagnitude < (padRange * padRange)) { // target is in range! Play the graphics m_SpawnedGraphics = InstantiateSpecialFXGraphics(physicsWrapper ? physicsWrapper.Transform : targetNetworkObj.transform, true); @@ -53,28 +55,28 @@ public override bool OnStartClient(ClientCharacterVisualization parent) return true; } - public override bool OnUpdateClient(ClientCharacterVisualization parent) + public override bool OnUpdateClient(ClientCharacter clientCharacter) { return ActionConclusion.Continue; } - public override void OnAnimEventClient(ClientCharacterVisualization parent, string id) + public override void OnAnimEventClient(ClientCharacter clientCharacter, string id) { if (id == "impact" && !m_ImpactPlayed) { - PlayHitReact(parent); + PlayHitReact(clientCharacter); } } - public override void EndClient(ClientCharacterVisualization parent) + public override void EndClient(ClientCharacter clientCharacter) { //if this didn't already happen, make sure it gets a chance to run. This could have failed to run because //our animationclip didn't have the "impact" event properly configured (as one possibility). - PlayHitReact(parent); - base.EndClient(parent); + PlayHitReact(clientCharacter); + base.EndClient(clientCharacter); } - public override void CancelClient(ClientCharacterVisualization parent) + public override void CancelClient(ClientCharacter clientCharacter) { // if we had any special target graphics, tell them we're done if (m_SpawnedGraphics != null) @@ -89,7 +91,7 @@ public override void CancelClient(ClientCharacterVisualization parent) } } - void PlayHitReact(ClientCharacterVisualization parent) + void PlayHitReact(ClientCharacter parent) { if (m_ImpactPlayed) { return; } @@ -125,10 +127,11 @@ void PlayHitReact(ClientCharacterVisualization parent) string hitAnim = Config.ReactAnim; if (string.IsNullOrEmpty(hitAnim)) { hitAnim = k_DefaultHitReact; } - var clientChar = targetNetworkObj.GetComponent(); - if (clientChar && clientChar.ChildVizObject && clientChar.ChildVizObject.OurAnimator) + if (targetNetworkObj.TryGetComponent(out var serverCharacter) + && serverCharacter.clientCharacter != null + && serverCharacter.clientCharacter.OurAnimator) { - clientChar.ChildVizObject.OurAnimator.SetTrigger(hitAnim); + serverCharacter.clientCharacter.OurAnimator.SetTrigger(hitAnim); } } } diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/MeleeAction.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/MeleeAction.cs index 4e5184f4c..c2e5e03c4 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/MeleeAction.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/MeleeAction.cs @@ -1,11 +1,9 @@ using System; -using System.Collections.Generic; -using Unity.Multiplayer.Samples.BossRoom.Server; -using Unity.Multiplayer.Samples.BossRoom.Visual; -using Unity.Netcode; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { /// /// Action that represents a swing of a melee weapon. It is not explicitly targeted, but rather detects the foe that was hit with a physics check. @@ -36,10 +34,10 @@ public partial class MeleeAction : Action private bool m_ExecutionFired; private ulong m_ProvisionalTarget; - public override bool OnStart(ServerCharacter parent) + public override bool OnStart(ServerCharacter serverCharacter) { - ulong target = (Data.TargetIds != null && Data.TargetIds.Length > 0) ? Data.TargetIds[0] : parent.NetState.TargetId.Value; - IDamageable foe = DetectFoe(parent, target); + ulong target = (Data.TargetIds != null && Data.TargetIds.Length > 0) ? Data.TargetIds[0] : serverCharacter.TargetId.Value; + IDamageable foe = DetectFoe(serverCharacter, target); if (foe != null) { m_ProvisionalTarget = foe.NetworkObjectId; @@ -49,11 +47,11 @@ public override bool OnStart(ServerCharacter parent) // snap to face the right direction if (Data.Direction != Vector3.zero) { - parent.physicsWrapper.Transform.forward = Data.Direction; + serverCharacter.physicsWrapper.Transform.forward = Data.Direction; } - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); - parent.NetState.RecvDoActionClientRPC(Data); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); + serverCharacter.clientCharacter.RecvDoActionClientRPC(Data); return true; } @@ -66,15 +64,15 @@ public override void Reset() m_SpawnedGraphics = null; } - public override bool OnUpdate(ServerCharacter parent) + public override bool OnUpdate(ServerCharacter clientCharacter) { if (!m_ExecutionFired && (Time.time - TimeStarted) >= Config.ExecTimeSeconds) { m_ExecutionFired = true; - var foe = DetectFoe(parent, m_ProvisionalTarget); + var foe = DetectFoe(clientCharacter, m_ProvisionalTarget); if (foe != null) { - foe.ReceiveHP(parent, -Config.Amount); + foe.ReceiveHP(clientCharacter, -Config.Amount); } } diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/PickUpAction.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/PickUpAction.cs index 20ba79791..ede2501cf 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/PickUpAction.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/PickUpAction.cs @@ -1,12 +1,11 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Actions; -using Unity.Multiplayer.Samples.BossRoom.Client; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.Netcode; using UnityEngine; using UnityEngine.Animations; -using Action = Unity.Multiplayer.Samples.BossRoom.Actions.Action; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.Actions { /// /// Action for picking up "Heavy" items. For simplicity, this class will perform both the pickup (reparenting) of a @@ -25,17 +24,17 @@ public class PickUpAction : Action float m_ActionStartTime; bool m_AttemptedPickup; - public override bool OnStart(ServerCharacter parent) + public override bool OnStart(ServerCharacter serverCharacter) { m_ActionStartTime = Time.time; // play pickup animation based if a heavy object is not already held if (!NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue( - parent.NetState.heldNetworkObject.Value, out var heldObject)) + serverCharacter.HeldNetworkObject.Value, out var heldObject)) { if (!string.IsNullOrEmpty(Config.Anim)) { - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); } } @@ -71,12 +70,12 @@ bool TryPickUp(ServerCharacter parent) return false; } - parent.NetState.heldNetworkObject.Value = heavyNetworkObject.NetworkObjectId; + parent.HeldNetworkObject.Value = heavyNetworkObject.NetworkObjectId; Data.TargetIds = new ulong[] { heavyNetworkObject.NetworkObjectId }; // clear current target on successful parenting attempt - parent.NetState.TargetId.Value = 0; + parent.TargetId.Value = 0; // snap to face the right direction if (Data.Direction != Vector3.zero) @@ -88,11 +87,11 @@ bool TryPickUp(ServerCharacter parent) var positionConstraint = heavyNetworkObject.GetComponent(); if (positionConstraint) { - if (parent.TryGetComponent(out ClientCharacter clientCharacter)) + if (parent.TryGetComponent(out ServerCharacter serverCharacter)) { var constraintSource = new ConstraintSource() { - sourceTransform = clientCharacter.ChildVizObject.CharacterSwap.CharacterModel.handSocket.transform, + sourceTransform = serverCharacter.clientCharacter.CharacterSwap.CharacterModel.handSocket.transform, weight = 1 }; positionConstraint.AddSource(constraintSource); @@ -103,12 +102,12 @@ bool TryPickUp(ServerCharacter parent) return true; } - public override bool OnUpdate(ServerCharacter parent) + public override bool OnUpdate(ServerCharacter clientCharacter) { if (!m_AttemptedPickup && Time.time > m_ActionStartTime + Config.ExecTimeSeconds) { m_AttemptedPickup = true; - if (!TryPickUp(parent)) + if (!TryPickUp(clientCharacter)) { // pickup attempt unsuccessful; action can be terminated return ActionConclusion.Stop; @@ -118,15 +117,15 @@ public override bool OnUpdate(ServerCharacter parent) return ActionConclusion.Continue; } - public override void Cancel(ServerCharacter parent) + public override void Cancel(ServerCharacter serverCharacter) { - if (parent.NetState.LifeState == LifeState.Fainted) + if (serverCharacter.LifeState == LifeState.Fainted) { - if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(parent.NetState.heldNetworkObject.Value, out var heavyNetworkObject)) + if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(serverCharacter.HeldNetworkObject.Value, out var heavyNetworkObject)) { heavyNetworkObject.transform.SetParent(null); } - parent.NetState.heldNetworkObject.Value = 0; + serverCharacter.HeldNetworkObject.Value = 0; } } } diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/ProjectileInfo.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/ProjectileInfo.cs index f225bbbf2..790544ad1 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/ProjectileInfo.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/ProjectileInfo.cs @@ -1,7 +1,7 @@ using System; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.Actions { [Serializable] public struct ProjectileInfo diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/ReviveAction.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/ReviveAction.cs index e2073e85d..e405d1854 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/ReviveAction.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/ReviveAction.cs @@ -1,10 +1,11 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Server; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.Netcode; using UnityEngine; using UnityEngine.Assertions; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { [CreateAssetMenu(menuName = "BossRoom/Actions/Revive Action")] public class ReviveAction : Action @@ -12,7 +13,7 @@ public class ReviveAction : Action private bool m_ExecFired; private ServerCharacter m_TargetCharacter; - public override bool OnStart(ServerCharacter parent) + public override bool OnStart(ServerCharacter serverCharacter) { if (m_Data.TargetIds == null || m_Data.TargetIds.Length == 0 || !NetworkManager.Singleton.SpawnManager.SpawnedObjects.ContainsKey(m_Data.TargetIds[0])) { @@ -23,7 +24,7 @@ public override bool OnStart(ServerCharacter parent) var targetNetworkObject = NetworkManager.Singleton.SpawnManager.SpawnedObjects[m_Data.TargetIds[0]]; m_TargetCharacter = targetNetworkObject.GetComponent(); - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); return true; } @@ -35,21 +36,21 @@ public override void Reset() m_TargetCharacter = null; } - public override bool OnUpdate(ServerCharacter parent) + public override bool OnUpdate(ServerCharacter clientCharacter) { if (!m_ExecFired && Time.time - TimeStarted >= Config.ExecTimeSeconds) { m_ExecFired = true; - if (m_TargetCharacter.NetState.LifeState == LifeState.Fainted) + if (m_TargetCharacter.LifeState == LifeState.Fainted) { Assert.IsTrue(Config.Amount > 0, "Revive amount must be greater than 0."); - m_TargetCharacter.Revive(parent, Config.Amount); + m_TargetCharacter.Revive(clientCharacter, Config.Amount); } else { //cancel the action if the target is alive! - Cancel(parent); + Cancel(clientCharacter); return false; } } @@ -57,11 +58,11 @@ public override bool OnUpdate(ServerCharacter parent) return true; } - public override void Cancel(ServerCharacter parent) + public override void Cancel(ServerCharacter serverCharacter) { if (!string.IsNullOrEmpty(Config.Anim2)) { - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim2); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim2); } } } diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/StealthModeAction.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/StealthModeAction.cs index 09f2a936e..6119beaf7 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/StealthModeAction.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/StealthModeAction.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; -using Unity.Multiplayer.Samples.BossRoom.Server; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.VisualEffects; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { /// /// Causes the character to become hidden to enemies and other players. Notes: @@ -24,11 +24,11 @@ public class StealthModeAction : Action /// private List m_SpawnedGraphics = null; - public override bool OnStart(ServerCharacter parent) + public override bool OnStart(ServerCharacter serverCharacter) { - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); - parent.NetState.RecvDoActionClientRPC(Data); + serverCharacter.clientCharacter.RecvDoActionClientRPC(Data); return true; } @@ -46,33 +46,33 @@ public override bool ShouldBecomeNonBlocking() return TimeRunning >= Config.ExecTimeSeconds; } - public override bool OnUpdate(ServerCharacter parent) + public override bool OnUpdate(ServerCharacter clientCharacter) { if (TimeRunning >= Config.ExecTimeSeconds && !m_IsStealthStarted && !m_IsStealthEnded) { // start actual stealth-mode... NOW! m_IsStealthStarted = true; - parent.NetState.IsStealthy.Value = true; + clientCharacter.IsStealthy.Value = true; } return !m_IsStealthEnded; } - public override void Cancel(ServerCharacter parent) + public override void Cancel(ServerCharacter serverCharacter) { if (!string.IsNullOrEmpty(Config.Anim2)) { - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim2); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim2); } - EndStealth(parent); + EndStealth(serverCharacter); } - public override void OnGameplayActivity(ServerCharacter parent, GameplayActivity activityType) + public override void OnGameplayActivity(ServerCharacter serverCharacter, GameplayActivity activityType) { // we break stealth after using an attack. (Or after being hit, which could happen during exec time before we're stealthed, or even afterwards, such as from an AoE attack) if (activityType == GameplayActivity.UsingAttackAction || activityType == GameplayActivity.AttackedByEnemy) { - EndStealth(parent); + EndStealth(serverCharacter); } } @@ -83,28 +83,28 @@ private void EndStealth(ServerCharacter parent) m_IsStealthEnded = true; if (m_IsStealthStarted) { - parent.NetState.IsStealthy.Value = false; + parent.IsStealthy.Value = false; } // note that we cancel the ActionFX here, and NOT in Cancel(). That's to handle the case where someone // presses the Stealth button twice in a row: "end this Stealth action and start a new one". If we cancelled // all actions of this type in Cancel(), we'd end up cancelling both the old AND the new one, because // the new one would already be in the clients' actionFX queue. - parent.NetState.RecvCancelActionsByPrototypeIDClientRpc(ActionID); + parent.clientCharacter.RecvCancelActionsByPrototypeIDClientRpc(ActionID); } } - public override bool OnUpdateClient(ClientCharacterVisualization parent) + public override bool OnUpdateClient(ClientCharacter clientCharacter) { - if (TimeRunning >= Config.ExecTimeSeconds && m_SpawnedGraphics == null && parent.IsOwner) + if (TimeRunning >= Config.ExecTimeSeconds && m_SpawnedGraphics == null && clientCharacter.IsOwner) { - m_SpawnedGraphics = InstantiateSpecialFXGraphics(parent.transform, true); + m_SpawnedGraphics = InstantiateSpecialFXGraphics(clientCharacter.transform, true); } return ActionConclusion.Continue; } - public override void CancelClient(ClientCharacterVisualization parent) + public override void CancelClient(ClientCharacter clientCharacter) { if (m_SpawnedGraphics != null) { diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/StunnedAction.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/StunnedAction.cs index 17657b0a0..2be227e26 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/StunnedAction.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/StunnedAction.cs @@ -1,9 +1,8 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Server; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { /// /// Action that plays while a character is Stunned. The character does nothing... just sits there. @@ -16,13 +15,13 @@ namespace Unity.Multiplayer.Samples.BossRoom.Actions [CreateAssetMenu(menuName = "BossRoom/Actions/Stunned Action")] public class StunnedAction : Action { - public override bool OnStart(ServerCharacter parent) + public override bool OnStart(ServerCharacter serverCharacter) { - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); return true; } - public override bool OnUpdate(ServerCharacter parent) + public override bool OnUpdate(ServerCharacter clientCharacter) { return true; } @@ -35,15 +34,15 @@ public override void BuffValue(BuffableValue buffType, ref float buffedValue) } } - public override void Cancel(ServerCharacter parent) + public override void Cancel(ServerCharacter serverCharacter) { if (!string.IsNullOrEmpty(Config.Anim2)) { - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim2); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim2); } } - public override bool OnUpdateClient(ClientCharacterVisualization parent) + public override bool OnUpdateClient(ClientCharacter clientCharacter) { return ActionConclusion.Continue; } diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/TargetAction.Client.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/TargetAction.Client.cs index e733139c8..be7c2a420 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/TargetAction.Client.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/TargetAction.Client.cs @@ -1,8 +1,12 @@ -using Unity.Multiplayer.Samples.BossRoom.Visual; +using System; +using Unity.BossRoom.Gameplay.UserInput; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.Netcode; using UnityEngine; +using Object = UnityEngine.Object; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { public partial class TargetAction { @@ -12,11 +16,11 @@ public partial class TargetAction private const float k_ReticuleGroundHeight = 0.2f; - public override bool OnStartClient(ClientCharacterVisualization parent) + public override bool OnStartClient(ClientCharacter clientCharacter) { - base.OnStartClient(parent); - parent.NetState.TargetId.OnValueChanged += OnTargetChanged; - parent.NetState.GetComponent().ActionInputEvent += OnActionInput; + base.OnStartClient(clientCharacter); + clientCharacter.serverCharacter.TargetId.OnValueChanged += OnTargetChanged; + clientCharacter.serverCharacter.GetComponent().ActionInputEvent += OnActionInput; return true; } @@ -26,7 +30,7 @@ private void OnTargetChanged(ulong oldTarget, ulong newTarget) m_NewTarget = newTarget; } - public override bool OnUpdateClient(ClientCharacterVisualization parent) + public override bool OnUpdateClient(ClientCharacter clientCharacter) { if (m_CurrentTarget != m_NewTarget) { @@ -37,14 +41,14 @@ public override bool OnUpdateClient(ClientCharacterVisualization parent) var targetEntity = targetObject != null ? targetObject.GetComponent() : null; if (targetEntity != null) { - ValidateReticule(parent, targetObject); + ValidateReticule(clientCharacter, targetObject); m_TargetReticule.SetActive(true); var parentTransform = targetObject.transform; - if (targetObject.TryGetComponent(out Client.ClientCharacter clientCharacter) && clientCharacter.ChildVizObject) + if (targetObject.TryGetComponent(out ServerCharacter serverCharacter) && serverCharacter.clientCharacter) { //for characters, attach the reticule to the child graphics object. - parentTransform = clientCharacter.ChildVizObject.transform; + parentTransform = serverCharacter.clientCharacter.transform; } m_TargetReticule.transform.parent = parentTransform; @@ -69,7 +73,7 @@ public override bool OnUpdateClient(ClientCharacterVisualization parent) /// Ensures that the TargetReticule GameObject exists. This must be done prior to enabling it because it can be destroyed /// "accidentally" if its parent is destroyed while it is detached. /// - void ValidateReticule(ClientCharacterVisualization parent, NetworkObject targetObject) + void ValidateReticule(ClientCharacter parent, NetworkObject targetObject) { if (m_TargetReticule == null) { @@ -77,18 +81,18 @@ void ValidateReticule(ClientCharacterVisualization parent, NetworkObject targetO } bool target_isnpc = targetObject.GetComponent().IsNpc; - bool myself_isnpc = parent.NetState.CharacterClass.IsNpc; + bool myself_isnpc = parent.serverCharacter.CharacterClass.IsNpc; bool hostile = target_isnpc != myself_isnpc; m_TargetReticule.GetComponent().material = hostile ? parent.ReticuleHostileMat : parent.ReticuleFriendlyMat; } - public override void CancelClient(ClientCharacterVisualization parent) + public override void CancelClient(ClientCharacter clientCharacter) { GameObject.Destroy(m_TargetReticule); - parent.NetState.TargetId.OnValueChanged -= OnTargetChanged; - if (parent.TryGetComponent(out Client.ClientInputSender inputSender)) + clientCharacter.serverCharacter.TargetId.OnValueChanged -= OnTargetChanged; + if (clientCharacter.TryGetComponent(out ClientInputSender inputSender)) { inputSender.ActionInputEvent -= OnActionInput; } diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/TargetAction.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/TargetAction.cs index 24aa6ba50..63e9a55aa 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/TargetAction.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/TargetAction.cs @@ -1,11 +1,9 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Server; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.Netcode; using UnityEngine; -using Object = UnityEngine.Object; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { /// /// The "Target" Action is not a skill, but rather the result of a user left-clicking an enemy. This @@ -16,20 +14,20 @@ namespace Unity.Multiplayer.Samples.BossRoom.Actions [CreateAssetMenu(menuName = "BossRoom/Actions/Target Action")] public partial class TargetAction : Action { - public override bool OnStart(ServerCharacter parent) + public override bool OnStart(ServerCharacter serverCharacter) { //we must always clear the existing target, even if we don't run. This is how targets get cleared--running a TargetAction //with no target selected. - parent.NetState.TargetId.Value = 0; + serverCharacter.TargetId.Value = 0; //there can only be one TargetAction at a time! - parent.ActionPlayer.CancelRunningActionsByLogic(ActionLogic.Target, true, this); + serverCharacter.ActionPlayer.CancelRunningActionsByLogic(ActionLogic.Target, true, this); if (Data.TargetIds == null || Data.TargetIds.Length == 0) { return false; } - parent.NetState.TargetId.Value = TargetId; + serverCharacter.TargetId.Value = TargetId; - FaceTarget(parent, TargetId); + FaceTarget(serverCharacter, TargetId); return true; } @@ -42,24 +40,24 @@ public override void Reset() m_NewTarget = 0; } - public override bool OnUpdate(ServerCharacter parent) + public override bool OnUpdate(ServerCharacter clientCharacter) { bool isValid = ActionUtils.IsValidTarget(TargetId); - if (parent.ActionPlayer.RunningActionCount == 1 && !parent.Movement.IsMoving() && isValid) + if (clientCharacter.ActionPlayer.RunningActionCount == 1 && !clientCharacter.Movement.IsMoving() && isValid) { //we're the only action running, and we're not moving, so let's swivel to face our target, just to be cool! - FaceTarget(parent, TargetId); + FaceTarget(clientCharacter, TargetId); } return isValid; } - public override void Cancel(ServerCharacter parent) + public override void Cancel(ServerCharacter serverCharacter) { - if (parent.NetState.TargetId.Value == TargetId) + if (serverCharacter.TargetId.Value == TargetId) { - parent.NetState.TargetId.Value = 0; + serverCharacter.TargetId.Value = 0; } } diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/TossAction.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/TossAction.cs index 7ae2dd104..a3a9a8675 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/TossAction.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/TossAction.cs @@ -1,12 +1,11 @@ using System; -using UnityEngine; -using BossRoom.Scripts.Shared.Net.NetworkObjectPool; -using Unity.Multiplayer.Samples.BossRoom.Server; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.Infrastructure; using Unity.Netcode; +using UnityEngine; using Random = UnityEngine.Random; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { /// /// Action responsible for creating a physics-based thrown object. @@ -16,7 +15,7 @@ public class TossAction : Action { bool m_Launched; - public override bool OnStart(ServerCharacter parent) + public override bool OnStart(ServerCharacter serverCharacter) { // snap to face the direction we're firing @@ -36,12 +35,12 @@ public override bool OnStart(ServerCharacter parent) } // snap to face our target! This is the direction we'll attack in - parent.physicsWrapper.Transform.LookAt(lookAtPosition); + serverCharacter.physicsWrapper.Transform.LookAt(lookAtPosition); } } - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); - parent.NetState.RecvDoActionClientRPC(Data); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); + serverCharacter.clientCharacter.RecvDoActionClientRPC(Data); return true; } @@ -51,11 +50,11 @@ public override void Reset() m_Launched = false; } - public override bool OnUpdate(ServerCharacter parent) + public override bool OnUpdate(ServerCharacter clientCharacter) { if (TimeRunning >= Config.ExecTimeSeconds && !m_Launched) { - Throw(parent); + Throw(clientCharacter); } return true; diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/TrampleAction.Client.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/TrampleAction.Client.cs index 5aad74b49..b5c10e927 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/TrampleAction.Client.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/TrampleAction.Client.cs @@ -1,8 +1,10 @@ +using System; using System.Collections.Generic; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.VisualEffects; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { public partial class TrampleAction { @@ -22,18 +24,18 @@ public partial class TrampleAction /// private List m_SpawnedGraphics = null; - public override bool OnUpdateClient(ClientCharacterVisualization parent) + public override bool OnUpdateClient(ClientCharacter clientCharacter) { float age = Time.time - TimeStarted; if (age > k_GraphicsSpawnDelay && m_SpawnedGraphics == null) { - m_SpawnedGraphics = InstantiateSpecialFXGraphics(parent.transform, false); + m_SpawnedGraphics = InstantiateSpecialFXGraphics(clientCharacter.transform, false); } return true; } - public override void CancelClient(ClientCharacterVisualization parent) + public override void CancelClient(ClientCharacter clientCharacter) { // we've been aborted -- destroy the "cue graphics" if (m_SpawnedGraphics != null) diff --git a/Assets/Scripts/Gameplay/Action/ConcreteActions/TrampleAction.cs b/Assets/Scripts/Gameplay/Action/ConcreteActions/TrampleAction.cs index 01bd078c8..5d180289c 100644 --- a/Assets/Scripts/Gameplay/Action/ConcreteActions/TrampleAction.cs +++ b/Assets/Scripts/Gameplay/Action/ConcreteActions/TrampleAction.cs @@ -1,12 +1,12 @@ using System; using System.Collections.Generic; -using Unity.Multiplayer.Samples.BossRoom.Server; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.Netcode; using UnityEngine; using Random = UnityEngine.Random; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { /// /// This represents a "charge-across-the-screen" attack. The character deals damage to every enemy hit. @@ -50,7 +50,7 @@ private enum ActionStage /// private bool m_WasStunned; - public override bool OnStart(ServerCharacter parent) + public override bool OnStart(ServerCharacter serverCharacter) { m_PreviousStage = ActionStage.Windup; @@ -70,22 +70,22 @@ public override bool OnStart(ServerCharacter parent) } // snap to face our target! This is the direction we'll attack in - parent.physicsWrapper.Transform.LookAt(lookAtPosition); + serverCharacter.physicsWrapper.Transform.LookAt(lookAtPosition); } } // reset our "stop" trigger (in case the previous run of the trample action was aborted due to e.g. being stunned) if (!string.IsNullOrEmpty(Config.Anim2)) { - parent.serverAnimationHandler.NetworkAnimator.ResetTrigger(Config.Anim2); + serverCharacter.serverAnimationHandler.NetworkAnimator.ResetTrigger(Config.Anim2); } // start the animation sequence! if (!string.IsNullOrEmpty(Config.Anim)) { - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim); } - parent.NetState.RecvDoActionClientRPC(Data); + serverCharacter.clientCharacter.RecvDoActionClientRPC(Data); return true; } @@ -112,14 +112,14 @@ private ActionStage GetCurrentStage() return ActionStage.Complete; } - public override bool OnUpdate(ServerCharacter parent) + public override bool OnUpdate(ServerCharacter clientCharacter) { ActionStage newState = GetCurrentStage(); if (newState != m_PreviousStage && newState == ActionStage.Charging) { // we've just started to charge across the screen! Anyone currently touching us gets hit - SimulateCollisionWithNearbyFoes(parent); - parent.Movement.StartForwardCharge(Config.MoveSpeed, Config.DurationSeconds - Config.ExecTimeSeconds); + SimulateCollisionWithNearbyFoes(clientCharacter); + clientCharacter.Movement.StartForwardCharge(Config.MoveSpeed, Config.DurationSeconds - Config.ExecTimeSeconds); } m_PreviousStage = newState; @@ -181,13 +181,13 @@ private void CollideWithVictim(ServerCharacter parent, ServerCharacter victim) } // called by owning class when parent's Collider collides with stuff - public override void CollisionEntered(ServerCharacter parent, Collision collision) + public override void CollisionEntered(ServerCharacter serverCharacter, Collision collision) { // we only detect other possible victims when we start charging if (GetCurrentStage() != ActionStage.Charging) return; - Collide(parent, collision.collider); + Collide(serverCharacter, collision.collider); } // here we handle colliding with anything (whether a victim or not) @@ -238,7 +238,7 @@ private void StunSelf(ServerCharacter parent) if (!m_WasStunned) { parent.Movement.CancelMove(); - parent.NetState.RecvCancelAllActionsClientRpc(); + parent.clientCharacter.RecvCancelAllActionsClientRpc(); } m_WasStunned = true; } @@ -254,11 +254,11 @@ public override bool ChainIntoNewAction(ref ActionRequestData newAction) return false; } - public override void Cancel(ServerCharacter parent) + public override void Cancel(ServerCharacter serverCharacter) { if (!string.IsNullOrEmpty(Config.Anim2)) { - parent.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim2); + serverCharacter.serverAnimationHandler.NetworkAnimator.SetTrigger(Config.Anim2); } } } diff --git a/Assets/Scripts/Gameplay/Action/Input/ActionLogic.cs b/Assets/Scripts/Gameplay/Action/Input/ActionLogic.cs index 38deab043..deeaed6bf 100644 --- a/Assets/Scripts/Gameplay/Action/Input/ActionLogic.cs +++ b/Assets/Scripts/Gameplay/Action/Input/ActionLogic.cs @@ -1,6 +1,6 @@ using System; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { /// /// List of all Types of Actions. There is a many-to-one mapping of Actions to ActionLogics. diff --git a/Assets/Scripts/Gameplay/Action/Input/ActionRequestData.cs b/Assets/Scripts/Gameplay/Action/Input/ActionRequestData.cs index 2c997aaa7..7aa8f6939 100644 --- a/Assets/Scripts/Gameplay/Action/Input/ActionRequestData.cs +++ b/Assets/Scripts/Gameplay/Action/Input/ActionRequestData.cs @@ -2,7 +2,7 @@ using Unity.Netcode; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { /// /// Comprehensive class that contains information needed to play back any action on the server. This is what gets sent client->server when diff --git a/Assets/Scripts/Gameplay/Action/Input/AoeActionInput.cs b/Assets/Scripts/Gameplay/Action/Input/AoeActionInput.cs index 466bc37f3..68a6ee1db 100644 --- a/Assets/Scripts/Gameplay/Action/Input/AoeActionInput.cs +++ b/Assets/Scripts/Gameplay/Action/Input/AoeActionInput.cs @@ -1,7 +1,8 @@ +using Unity.BossRoom.Gameplay.GameplayObjects; using UnityEngine; using UnityEngine.AI; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { /// /// This class is the first step in AoE ability. It will update the initial input visuals' position and will be in charge diff --git a/Assets/Scripts/Gameplay/Action/Input/BaseActionInput.cs b/Assets/Scripts/Gameplay/Action/Input/BaseActionInput.cs index 4bbc2d76f..ee8706c6b 100644 --- a/Assets/Scripts/Gameplay/Action/Input/BaseActionInput.cs +++ b/Assets/Scripts/Gameplay/Action/Input/BaseActionInput.cs @@ -1,17 +1,18 @@ using System; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { public abstract class BaseActionInput : MonoBehaviour { - protected NetworkCharacterState m_PlayerOwner; + protected ServerCharacter m_PlayerOwner; protected Vector3 m_Origin; protected ActionID m_ActionPrototypeID; protected Action m_SendInput; System.Action m_OnFinished; - public void Initiate(NetworkCharacterState playerOwner, Vector3 origin, ActionID actionPrototypeID, Action onSendInput, System.Action onFinished) + public void Initiate(ServerCharacter playerOwner, Vector3 origin, ActionID actionPrototypeID, Action onSendInput, System.Action onFinished) { m_PlayerOwner = playerOwner; m_Origin = origin; diff --git a/Assets/Scripts/Gameplay/Action/Input/ChargedActionInput.cs b/Assets/Scripts/Gameplay/Action/Input/ChargedActionInput.cs index a8a7d9dd3..8183b1cdf 100644 --- a/Assets/Scripts/Gameplay/Action/Input/ChargedActionInput.cs +++ b/Assets/Scripts/Gameplay/Action/Input/ChargedActionInput.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Actions +namespace Unity.BossRoom.Gameplay.Actions { public class ChargedActionInput : BaseActionInput { diff --git a/Assets/Scripts/Gameplay/Configuration/Avatar.cs b/Assets/Scripts/Gameplay/Configuration/Avatar.cs index e43a4df46..db9447bad 100644 --- a/Assets/Scripts/Gameplay/Configuration/Avatar.cs +++ b/Assets/Scripts/Gameplay/Configuration/Avatar.cs @@ -1,7 +1,8 @@ using System; +using Unity.BossRoom.Infrastructure; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.Configuration { /// /// This ScriptableObject defines a Player Character for BossRoom. It defines its CharacterClass field for @@ -9,7 +10,7 @@ namespace Unity.Multiplayer.Samples.BossRoom /// [CreateAssetMenu] [Serializable] - public class Avatar : GuidScriptableObject + public sealed class Avatar : GuidScriptableObject { public CharacterClass CharacterClass; diff --git a/Assets/Scripts/Gameplay/Configuration/AvatarRegistry.cs b/Assets/Scripts/Gameplay/Configuration/AvatarRegistry.cs index d2df4174e..1089dfa70 100644 --- a/Assets/Scripts/Gameplay/Configuration/AvatarRegistry.cs +++ b/Assets/Scripts/Gameplay/Configuration/AvatarRegistry.cs @@ -1,14 +1,14 @@ using System; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.Configuration { /// /// This ScriptableObject will be the container for all possible Avatars inside BossRoom. /// /// [CreateAssetMenu] - public class AvatarRegistry : ScriptableObject + public sealed class AvatarRegistry : ScriptableObject { [SerializeField] Avatar[] m_Avatars; diff --git a/Assets/Scripts/Gameplay/Configuration/CharacterClass.cs b/Assets/Scripts/Gameplay/Configuration/CharacterClass.cs index 3a2d4d1c3..ea0e15dbe 100644 --- a/Assets/Scripts/Gameplay/Configuration/CharacterClass.cs +++ b/Assets/Scripts/Gameplay/Configuration/CharacterClass.cs @@ -1,7 +1,10 @@ -using Unity.Multiplayer.Samples.BossRoom.Actions; +using System; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.Infrastructure; using UnityEngine; +using Action = Unity.BossRoom.Gameplay.Actions.Action; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.Configuration { /// /// Data representation of a Character, containing such things as its starting HP and Mana, and what attacks it can do. diff --git a/Assets/Scripts/Gameplay/Configuration/NameGenerationData.cs b/Assets/Scripts/Gameplay/Configuration/NameGenerationData.cs index 356312d43..141ba1817 100644 --- a/Assets/Scripts/Gameplay/Configuration/NameGenerationData.cs +++ b/Assets/Scripts/Gameplay/Configuration/NameGenerationData.cs @@ -1,6 +1,8 @@ +using System; using UnityEngine; +using Random = UnityEngine.Random; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.Configuration { /// /// Data storage of all the valid strings used to create a player's name. diff --git a/Assets/Scripts/Gameplay/Configuration/VisualizationConfiguration.cs b/Assets/Scripts/Gameplay/Configuration/VisualizationConfiguration.cs index 47663be74..26b20bdfd 100644 --- a/Assets/Scripts/Gameplay/Configuration/VisualizationConfiguration.cs +++ b/Assets/Scripts/Gameplay/Configuration/VisualizationConfiguration.cs @@ -1,6 +1,7 @@ +using System; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.Configuration { /// /// Describes how a specific character visualization should be animated. diff --git a/Assets/Scripts/Gameplay/DebugCheats/DebugCheatsManager.cs b/Assets/Scripts/Gameplay/DebugCheats/DebugCheatsManager.cs index 7c5b8d7be..3fc874f39 100644 --- a/Assets/Scripts/Gameplay/DebugCheats/DebugCheatsManager.cs +++ b/Assets/Scripts/Gameplay/DebugCheats/DebugCheatsManager.cs @@ -1,12 +1,16 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Server; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; +using Unity.BossRoom.ConnectionManagement; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.Gameplay.Messages; +using Unity.BossRoom.Infrastructure; +using Unity.Multiplayer.Samples.BossRoom; using Unity.Multiplayer.Samples.Utilities; using Unity.Netcode; using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Game.Cheats +namespace Unity.BossRoom.DebugCheats { /// /// Handles debug cheat events, applies them on the server and logs them on all clients. This class is only @@ -29,17 +33,17 @@ public class DebugCheatsManager : NetworkBehaviour [SerializeField] KeyCode m_OpenWindowKeyCode = KeyCode.Slash; - ServerSwitchedDoor m_ServerSwitchedDoor; + SwitchedDoor m_SwitchedDoor; - ServerSwitchedDoor ServerSwitchedDoor + SwitchedDoor SwitchedDoor { get { - if (m_ServerSwitchedDoor == null) + if (m_SwitchedDoor == null) { - m_ServerSwitchedDoor = FindObjectOfType(); + m_SwitchedDoor = FindObjectOfType(); } - return m_ServerSwitchedDoor; + return m_SwitchedDoor; } } @@ -149,7 +153,7 @@ void KillTargetServerRpc(ServerRpcParams serverRpcParams = default) var playerServerCharacter = PlayerServerCharacter.GetPlayerServerCharacter(clientId); if (playerServerCharacter != null) { - var targetId = playerServerCharacter.NetState.TargetId.Value; + var targetId = playerServerCharacter.TargetId.Value; if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(targetId, out NetworkObject obj)) { var damageable = obj.GetComponent(); @@ -172,11 +176,11 @@ void KillAllEnemiesServerRpc(ServerRpcParams serverRpcParams = default) { foreach (var serverCharacter in FindObjectsOfType()) { - if (serverCharacter.IsNpc && serverCharacter.NetState.LifeState == LifeState.Alive) + if (serverCharacter.IsNpc && serverCharacter.LifeState == LifeState.Alive) { if (serverCharacter.gameObject.TryGetComponent(out IDamageable damageable)) { - damageable.ReceiveHP(null, -serverCharacter.NetState.HitPoints); + damageable.ReceiveHP(null, -serverCharacter.HitPoints); } } } @@ -190,7 +194,7 @@ void ToggleGodModeServerRpc(ServerRpcParams serverRpcParams = default) var playerServerCharacter = PlayerServerCharacter.GetPlayerServerCharacter(clientId); if (playerServerCharacter != null) { - playerServerCharacter.NetState.NetworkLifeState.IsGodMode.Value = !playerServerCharacter.NetState.NetworkLifeState.IsGodMode.Value; + playerServerCharacter.NetLifeState.IsGodMode.Value = !playerServerCharacter.NetLifeState.IsGodMode.Value; PublishCheatUsedMessage(clientId, "ToggleGodMode"); } } @@ -202,8 +206,8 @@ void HealPlayerServerRpc(ServerRpcParams serverRpcParams = default) var playerServerCharacter = PlayerServerCharacter.GetPlayerServerCharacter(clientId); if (playerServerCharacter != null) { - var baseHp = playerServerCharacter.NetState.CharacterClass.BaseHP.Value; - if (playerServerCharacter.NetState.LifeState == LifeState.Fainted) + var baseHp = playerServerCharacter.CharacterClass.BaseHP.Value; + if (playerServerCharacter.LifeState == LifeState.Fainted) { playerServerCharacter.Revive(null, baseHp); } @@ -251,9 +255,9 @@ void ToggleTeleportModeServerRpc(ServerRpcParams serverRpcParams = default) [ServerRpc(RequireOwnership = false)] void ToggleDoorServerRpc(ServerRpcParams serverRpcParams = default) { - if (ServerSwitchedDoor != null) + if (SwitchedDoor != null) { - ServerSwitchedDoor.ForceOpen = !ServerSwitchedDoor.ForceOpen; + SwitchedDoor.ForceOpen = !SwitchedDoor.ForceOpen; PublishCheatUsedMessage(serverRpcParams.Receive.SenderClientId, "ToggleDoor"); } else @@ -265,7 +269,7 @@ void ToggleDoorServerRpc(ServerRpcParams serverRpcParams = default) [ServerRpc(RequireOwnership = false)] void TogglePortalsServerRpc(ServerRpcParams serverRpcParams = default) { - foreach (var portal in FindObjectsOfType()) + foreach (var portal in FindObjectsOfType()) { if (m_DestroyPortalsOnNextToggle) { diff --git a/Assets/Scripts/Gameplay/GameState/ClientCharSelectState.cs b/Assets/Scripts/Gameplay/GameState/ClientCharSelectState.cs index ca2130da8..07e810ea4 100644 --- a/Assets/Scripts/Gameplay/GameState/ClientCharSelectState.cs +++ b/Assets/Scripts/Gameplay/GameState/ClientCharSelectState.cs @@ -1,12 +1,15 @@ using System; using System.Collections.Generic; -using UnityEngine; +using Unity.BossRoom.Gameplay.UI; using TMPro; +using Unity.BossRoom.ConnectionManagement; using Unity.Multiplayer.Samples.Utilities; using Unity.Netcode; +using UnityEngine; using VContainer; +using Avatar = Unity.BossRoom.Gameplay.Configuration.Avatar; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.GameState { /// /// Client specialization of the Character Select game state. Mainly controls the UI during character-select. @@ -23,7 +26,7 @@ public class ClientCharSelectState : GameStateBehaviour NetcodeHooks m_NetcodeHooks; public override GameState ActiveState { get { return GameState.CharSelect; } } - public CharSelectData CharSelectData { get; private set; } + public NetworkCharSelection networkCharSelection { get; private set; } [SerializeField] [Tooltip("This is triggered when the player chooses a character")] @@ -115,7 +118,7 @@ protected override void Awake() // TODO inject or find another way to find CharSelectData // TODO CharSelectData should directly be in ServerCharSelectState - CharSelectData = FindObjectOfType(); + networkCharSelection = FindObjectOfType(); m_NetcodeHooks.OnNetworkSpawnHook += OnNetworkSpawn; m_NetcodeHooks.OnNetworkDespawnHook += OnNetworkDespawn; @@ -147,15 +150,15 @@ protected override void Start() } ConfigureUIForLobbyMode(LobbyMode.ChooseSeat); - UpdateCharacterSelection(CharSelectData.SeatState.Inactive); + UpdateCharacterSelection(NetworkCharSelection.SeatState.Inactive); } void OnNetworkDespawn() { - if (CharSelectData) + if (networkCharSelection) { - CharSelectData.IsLobbyClosed.OnValueChanged -= OnLobbyClosedChanged; - CharSelectData.LobbyPlayers.OnListChanged -= OnLobbyPlayerStateChanged; + networkCharSelection.IsLobbyClosed.OnValueChanged -= OnLobbyClosedChanged; + networkCharSelection.LobbyPlayers.OnListChanged -= OnLobbyPlayerStateChanged; } } @@ -167,8 +170,8 @@ void OnNetworkSpawn() } else { - CharSelectData.IsLobbyClosed.OnValueChanged += OnLobbyClosedChanged; - CharSelectData.LobbyPlayers.OnListChanged += OnLobbyPlayerStateChanged; + networkCharSelection.IsLobbyClosed.OnValueChanged += OnLobbyClosedChanged; + networkCharSelection.LobbyPlayers.OnListChanged += OnLobbyPlayerStateChanged; } } @@ -183,7 +186,7 @@ void OnAssignedPlayerNumber(int playerNum) void UpdatePlayerCount() { - int count = CharSelectData.LobbyPlayers.Count; + int count = networkCharSelection.LobbyPlayers.Count; var pstr = (count > 1) ? "players" : "player"; m_NumPlayersText.text = "" + count + " " + pstr + " connected"; } @@ -191,16 +194,16 @@ void UpdatePlayerCount() /// /// Called by the server when any of the seats in the lobby have changed. (Including ours!) /// - void OnLobbyPlayerStateChanged(NetworkListEvent changeEvent) + void OnLobbyPlayerStateChanged(NetworkListEvent changeEvent) { UpdateSeats(); UpdatePlayerCount(); // now let's find our local player in the list and update the character/info box appropriately int localPlayerIdx = -1; - for (int i = 0; i < CharSelectData.LobbyPlayers.Count; ++i) + for (int i = 0; i < networkCharSelection.LobbyPlayers.Count; ++i) { - if (CharSelectData.LobbyPlayers[i].ClientId == NetworkManager.Singleton.LocalClientId) + if (networkCharSelection.LobbyPlayers[i].ClientId == NetworkManager.Singleton.LocalClientId) { localPlayerIdx = i; break; @@ -211,19 +214,19 @@ void OnLobbyPlayerStateChanged(NetworkListEvent { // we aren't currently participating in the lobby! // this can happen for various reasons, such as the lobby being full and us not getting a seat. - UpdateCharacterSelection(CharSelectData.SeatState.Inactive); + UpdateCharacterSelection(NetworkCharSelection.SeatState.Inactive); } - else if (CharSelectData.LobbyPlayers[localPlayerIdx].SeatState == CharSelectData.SeatState.Inactive) + else if (networkCharSelection.LobbyPlayers[localPlayerIdx].SeatState == NetworkCharSelection.SeatState.Inactive) { // we haven't chosen a seat yet (or were kicked out of our seat by someone else) - UpdateCharacterSelection(CharSelectData.SeatState.Inactive); + UpdateCharacterSelection(NetworkCharSelection.SeatState.Inactive); // make sure our player num is properly set in Lobby UI - OnAssignedPlayerNumber(CharSelectData.LobbyPlayers[localPlayerIdx].PlayerNumber); + OnAssignedPlayerNumber(networkCharSelection.LobbyPlayers[localPlayerIdx].PlayerNumber); } else { // we have a seat! Note that if our seat is LockedIn, this function will also switch the lobby mode - UpdateCharacterSelection(CharSelectData.LobbyPlayers[localPlayerIdx].SeatState, CharSelectData.LobbyPlayers[localPlayerIdx].SeatIdx); + UpdateCharacterSelection(networkCharSelection.LobbyPlayers[localPlayerIdx].SeatState, networkCharSelection.LobbyPlayers[localPlayerIdx].SeatIdx); } } @@ -234,12 +237,12 @@ void OnLobbyPlayerStateChanged(NetworkListEvent /// /// Our current seat state /// Which seat we're sitting in, or -1 if SeatState is Inactive - void UpdateCharacterSelection(CharSelectData.SeatState state, int seatIdx = -1) + void UpdateCharacterSelection(NetworkCharSelection.SeatState state, int seatIdx = -1) { bool isNewSeat = m_LastSeatSelected != seatIdx; m_LastSeatSelected = seatIdx; - if (state == CharSelectData.SeatState.Inactive) + if (state == NetworkCharSelection.SeatState.Inactive) { if (m_CurrentCharacterGraphics) { @@ -255,7 +258,7 @@ void UpdateCharacterSelection(CharSelectData.SeatState state, int seatIdx = -1) // change character preview when selecting a new seat if (isNewSeat) { - var selectedCharacterGraphics = GetCharacterGraphics(CharSelectData.AvatarConfiguration[seatIdx]); + var selectedCharacterGraphics = GetCharacterGraphics(networkCharSelection.AvatarConfiguration[seatIdx]); if (m_CurrentCharacterGraphics) { @@ -266,18 +269,18 @@ void UpdateCharacterSelection(CharSelectData.SeatState state, int seatIdx = -1) m_CurrentCharacterGraphics = selectedCharacterGraphics; m_CurrentCharacterGraphicsAnimator = m_CurrentCharacterGraphics.GetComponent(); - m_ClassInfoBox.ConfigureForClass(CharSelectData.AvatarConfiguration[seatIdx].CharacterClass); + m_ClassInfoBox.ConfigureForClass(networkCharSelection.AvatarConfiguration[seatIdx].CharacterClass); } } - if (state == CharSelectData.SeatState.LockedIn && !m_HasLocalPlayerLockedIn) + if (state == NetworkCharSelection.SeatState.LockedIn && !m_HasLocalPlayerLockedIn) { // the local player has locked in their seat choice! Rearrange the UI appropriately // the character should act excited m_CurrentCharacterGraphicsAnimator.SetTrigger(m_AnimationTriggerOnCharChosen); - ConfigureUIForLobbyMode(CharSelectData.IsLobbyClosed.Value ? LobbyMode.LobbyEnding : LobbyMode.SeatChosen); + ConfigureUIForLobbyMode(networkCharSelection.IsLobbyClosed.Value ? LobbyMode.LobbyEnding : LobbyMode.SeatChosen); m_HasLocalPlayerLockedIn = true; } - else if (m_HasLocalPlayerLockedIn && state == CharSelectData.SeatState.Active) + else if (m_HasLocalPlayerLockedIn && state == NetworkCharSelection.SeatState.Active) { // reset character seats if locked in choice was unselected if (m_HasLocalPlayerLockedIn) @@ -287,7 +290,7 @@ void UpdateCharacterSelection(CharSelectData.SeatState state, int seatIdx = -1) m_HasLocalPlayerLockedIn = false; } } - else if (state == CharSelectData.SeatState.Active && isNewSeat) + else if (state == NetworkCharSelection.SeatState.Active && isNewSeat) { m_CurrentCharacterGraphicsAnimator.SetTrigger(m_AnimationTriggerOnCharSelect); } @@ -303,13 +306,13 @@ void UpdateSeats() // Once they have chosen their class (by "locking in" their seat), other players in that seat are kicked out. // But until a seat is locked in, we need to display each seat as being used by the latest player to choose it. // So we go through all players and figure out who should visually be shown as sitting in that seat. - CharSelectData.LobbyPlayerState[] curSeats = new CharSelectData.LobbyPlayerState[m_PlayerSeats.Count]; - foreach (CharSelectData.LobbyPlayerState playerState in CharSelectData.LobbyPlayers) + NetworkCharSelection.LobbyPlayerState[] curSeats = new NetworkCharSelection.LobbyPlayerState[m_PlayerSeats.Count]; + foreach (NetworkCharSelection.LobbyPlayerState playerState in networkCharSelection.LobbyPlayers) { - if (playerState.SeatIdx == -1 || playerState.SeatState == CharSelectData.SeatState.Inactive) + if (playerState.SeatIdx == -1 || playerState.SeatState == NetworkCharSelection.SeatState.Inactive) continue; // this player isn't seated at all! - if (curSeats[playerState.SeatIdx].SeatState == CharSelectData.SeatState.Inactive - || (curSeats[playerState.SeatIdx].SeatState == CharSelectData.SeatState.Active && curSeats[playerState.SeatIdx].LastChangeTime < playerState.LastChangeTime)) + if (curSeats[playerState.SeatIdx].SeatState == NetworkCharSelection.SeatState.Inactive + || (curSeats[playerState.SeatIdx].SeatState == NetworkCharSelection.SeatState.Active && curSeats[playerState.SeatIdx].LastChangeTime < playerState.LastChangeTime)) { // this is the best candidate to be displayed in this seat (so far) curSeats[playerState.SeatIdx] = playerState; @@ -341,7 +344,7 @@ void OnLobbyClosedChanged(bool wasLobbyClosed, bool isLobbyClosed) else { ConfigureUIForLobbyMode(LobbyMode.SeatChosen); - m_ClassInfoBox.ConfigureForClass(CharSelectData.AvatarConfiguration[m_LastSeatSelected].CharacterClass); + m_ClassInfoBox.ConfigureForClass(networkCharSelection.AvatarConfiguration[m_LastSeatSelected].CharacterClass); } } } @@ -412,9 +415,9 @@ void ConfigureUIForLobbyMode(LobbyMode mode) /// public void OnPlayerClickedSeat(int seatIdx) { - if (CharSelectData.IsSpawned) + if (networkCharSelection.IsSpawned) { - CharSelectData.ChangeSeatServerRpc(NetworkManager.Singleton.LocalClientId, seatIdx, false); + networkCharSelection.ChangeSeatServerRpc(NetworkManager.Singleton.LocalClientId, seatIdx, false); } } @@ -423,10 +426,10 @@ public void OnPlayerClickedSeat(int seatIdx) /// public void OnPlayerClickedReady() { - if (CharSelectData.IsSpawned) + if (networkCharSelection.IsSpawned) { // request to lock in or unlock if already locked in - CharSelectData.ChangeSeatServerRpc(NetworkManager.Singleton.LocalClientId, m_LastSeatSelected, !m_HasLocalPlayerLockedIn); + networkCharSelection.ChangeSeatServerRpc(NetworkManager.Singleton.LocalClientId, m_LastSeatSelected, !m_HasLocalPlayerLockedIn); } } diff --git a/Assets/Scripts/Gameplay/GameState/ClientMainMenuState.cs b/Assets/Scripts/Gameplay/GameState/ClientMainMenuState.cs index 561fa455b..c1b2a691f 100644 --- a/Assets/Scripts/Gameplay/GameState/ClientMainMenuState.cs +++ b/Assets/Scripts/Gameplay/GameState/ClientMainMenuState.cs @@ -1,8 +1,9 @@ using System; -using BossRoom.Scripts.Shared.Net.UnityServices.Auth; -using Unity.Multiplayer.Samples.BossRoom.Shared; -using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using Unity.BossRoom.Gameplay.Configuration; +using Unity.BossRoom.Gameplay.UI; +using Unity.BossRoom.UnityServices.Auth; +using Unity.BossRoom.UnityServices.Lobbies; +using Unity.BossRoom.Utils; using Unity.Services.Authentication; using Unity.Services.Core; using UnityEngine; @@ -10,7 +11,7 @@ using VContainer; using VContainer.Unity; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.GameState { /// /// Game Logic that runs when sitting at the MainMenu. This is likely to be "nothing", as no game has been started. But it is diff --git a/Assets/Scripts/Gameplay/GameState/GameStateBehaviour.cs b/Assets/Scripts/Gameplay/GameState/GameStateBehaviour.cs index a3244a25f..c371fbe52 100644 --- a/Assets/Scripts/Gameplay/GameState/GameStateBehaviour.cs +++ b/Assets/Scripts/Gameplay/GameState/GameStateBehaviour.cs @@ -1,11 +1,8 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; -using Unity.Netcode; using UnityEngine; -using VContainer; using VContainer.Unity; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.GameState { public enum GameState { diff --git a/Assets/Scripts/Gameplay/GameState/CharSelectData.cs b/Assets/Scripts/Gameplay/GameState/NetworkCharSelection.cs similarity index 95% rename from Assets/Scripts/Gameplay/GameState/CharSelectData.cs rename to Assets/Scripts/Gameplay/GameState/NetworkCharSelection.cs index 256944822..5d0d17ad3 100644 --- a/Assets/Scripts/Gameplay/GameState/CharSelectData.cs +++ b/Assets/Scripts/Gameplay/GameState/NetworkCharSelection.cs @@ -1,12 +1,14 @@ using System; +using Unity.BossRoom.Gameplay.Configuration; +using Unity.BossRoom.Utils; using Unity.Netcode; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.GameState { /// /// Common data and RPCs for the CharSelect stage. /// - public class CharSelectData : NetworkBehaviour + public class NetworkCharSelection : NetworkBehaviour { public enum SeatState : byte { diff --git a/Assets/Scripts/Gameplay/GameState/CharSelectData.cs.meta b/Assets/Scripts/Gameplay/GameState/NetworkCharSelection.cs.meta similarity index 100% rename from Assets/Scripts/Gameplay/GameState/CharSelectData.cs.meta rename to Assets/Scripts/Gameplay/GameState/NetworkCharSelection.cs.meta diff --git a/Assets/Scripts/Gameplay/GameState/PostGameStateData.cs b/Assets/Scripts/Gameplay/GameState/NetworkPostGame.cs similarity index 79% rename from Assets/Scripts/Gameplay/GameState/PostGameStateData.cs rename to Assets/Scripts/Gameplay/GameState/NetworkPostGame.cs index 33b0e3238..643808414 100644 --- a/Assets/Scripts/Gameplay/GameState/PostGameStateData.cs +++ b/Assets/Scripts/Gameplay/GameState/NetworkPostGame.cs @@ -2,9 +2,9 @@ using Unity.Netcode; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.GameState { - public class PostGameStateData : NetworkBehaviour + public class NetworkPostGame : NetworkBehaviour { public NetworkVariable WinState = new NetworkVariable(); diff --git a/Assets/Scripts/Gameplay/GameState/PostGameStateData.cs.meta b/Assets/Scripts/Gameplay/GameState/NetworkPostGame.cs.meta similarity index 100% rename from Assets/Scripts/Gameplay/GameState/PostGameStateData.cs.meta rename to Assets/Scripts/Gameplay/GameState/NetworkPostGame.cs.meta diff --git a/Assets/Scripts/Gameplay/GameState/PersistentGameState.cs b/Assets/Scripts/Gameplay/GameState/PersistentGameState.cs index 24decde1c..0f48b7801 100644 --- a/Assets/Scripts/Gameplay/GameState/PersistentGameState.cs +++ b/Assets/Scripts/Gameplay/GameState/PersistentGameState.cs @@ -1,8 +1,7 @@ using System; -using Unity.Netcode; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.GameState { public enum WinState { diff --git a/Assets/Scripts/Gameplay/GameState/ServerBossRoomState.cs b/Assets/Scripts/Gameplay/GameState/ServerBossRoomState.cs index ec55d6a8c..662360093 100644 --- a/Assets/Scripts/Gameplay/GameState/ServerBossRoomState.cs +++ b/Assets/Scripts/Gameplay/GameState/ServerBossRoomState.cs @@ -1,7 +1,13 @@ using System; using System.Collections; using System.Collections.Generic; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; +using Unity.BossRoom.ConnectionManagement; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.Gameplay.Messages; +using Unity.BossRoom.Infrastructure; +using Unity.BossRoom.Utils; +using Unity.Multiplayer.Samples.BossRoom; using Unity.Multiplayer.Samples.Utilities; using Unity.Netcode; using UnityEngine; @@ -11,7 +17,7 @@ using VContainer; using Random = UnityEngine.Random; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.GameState { /// /// Server specialization of core BossRoom game logic. @@ -239,7 +245,7 @@ void CheckForGameOver() foreach (var serverCharacter in PlayerServerCharacter.GetPlayerServerCharacters()) { // if any player is alive just return - if (serverCharacter.NetState && serverCharacter.NetState.LifeState == LifeState.Alive) + if (serverCharacter && serverCharacter.LifeState == LifeState.Alive) { return; } diff --git a/Assets/Scripts/Gameplay/GameState/ServerCharSelectState.cs b/Assets/Scripts/Gameplay/GameState/ServerCharSelectState.cs index 1e999d2ec..3d7847167 100644 --- a/Assets/Scripts/Gameplay/GameState/ServerCharSelectState.cs +++ b/Assets/Scripts/Gameplay/GameState/ServerCharSelectState.cs @@ -1,23 +1,27 @@ using System; using System.Collections; +using Unity.BossRoom.ConnectionManagement; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Infrastructure; +using Unity.Multiplayer.Samples.BossRoom; using Unity.Multiplayer.Samples.Utilities; using Unity.Netcode; using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.GameState { /// /// Server specialization of Character Select game state. /// - [RequireComponent(typeof(NetcodeHooks), typeof(CharSelectData))] + [RequireComponent(typeof(NetcodeHooks), typeof(NetworkCharSelection))] public class ServerCharSelectState : GameStateBehaviour { [SerializeField] NetcodeHooks m_NetcodeHooks; public override GameState ActiveState => GameState.CharSelect; - public CharSelectData CharSelectData { get; private set; } + public NetworkCharSelection networkCharSelection { get; private set; } Coroutine m_WaitToEndLobbyCoroutine; @@ -27,7 +31,7 @@ public class ServerCharSelectState : GameStateBehaviour protected override void Awake() { base.Awake(); - CharSelectData = GetComponent(); + networkCharSelection = GetComponent(); m_NetcodeHooks.OnNetworkSpawnHook += OnNetworkSpawn; m_NetcodeHooks.OnNetworkDespawnHook += OnNetworkDespawn; @@ -52,7 +56,7 @@ void OnClientChangedSeat(ulong clientId, int newSeatIdx, bool lockedIn) throw new Exception($"OnClientChangedSeat: client ID {clientId} is not a lobby player and cannot change seats! Shouldn't be here!"); } - if (CharSelectData.IsLobbyClosed.Value) + if (networkCharSelection.IsLobbyClosed.Value) { // The user tried to change their class after everything was locked in... too late! Discard this choice return; @@ -66,16 +70,16 @@ void OnClientChangedSeat(ulong clientId, int newSeatIdx, bool lockedIn) else { // see if someone has already locked-in that seat! If so, too late... discard this choice - foreach (CharSelectData.LobbyPlayerState playerInfo in CharSelectData.LobbyPlayers) + foreach (NetworkCharSelection.LobbyPlayerState playerInfo in networkCharSelection.LobbyPlayers) { - if (playerInfo.ClientId != clientId && playerInfo.SeatIdx == newSeatIdx && playerInfo.SeatState == CharSelectData.SeatState.LockedIn) + if (playerInfo.ClientId != clientId && playerInfo.SeatIdx == newSeatIdx && playerInfo.SeatState == NetworkCharSelection.SeatState.LockedIn) { // somebody already locked this choice in. Stop! // Instead of granting lock request, change this player to Inactive state. - CharSelectData.LobbyPlayers[idx] = new CharSelectData.LobbyPlayerState(clientId, - CharSelectData.LobbyPlayers[idx].PlayerName, - CharSelectData.LobbyPlayers[idx].PlayerNumber, - CharSelectData.SeatState.Inactive); + networkCharSelection.LobbyPlayers[idx] = new NetworkCharSelection.LobbyPlayerState(clientId, + networkCharSelection.LobbyPlayers[idx].PlayerName, + networkCharSelection.LobbyPlayers[idx].PlayerNumber, + NetworkCharSelection.SeatState.Inactive); // then early out return; @@ -83,10 +87,10 @@ void OnClientChangedSeat(ulong clientId, int newSeatIdx, bool lockedIn) } } - CharSelectData.LobbyPlayers[idx] = new CharSelectData.LobbyPlayerState(clientId, - CharSelectData.LobbyPlayers[idx].PlayerName, - CharSelectData.LobbyPlayers[idx].PlayerNumber, - lockedIn ? CharSelectData.SeatState.LockedIn : CharSelectData.SeatState.Active, + networkCharSelection.LobbyPlayers[idx] = new NetworkCharSelection.LobbyPlayerState(clientId, + networkCharSelection.LobbyPlayers[idx].PlayerName, + networkCharSelection.LobbyPlayers[idx].PlayerNumber, + lockedIn ? NetworkCharSelection.SeatState.LockedIn : NetworkCharSelection.SeatState.Active, newSeatIdx, Time.time); @@ -94,16 +98,16 @@ void OnClientChangedSeat(ulong clientId, int newSeatIdx, bool lockedIn) { // to help the clients visually keep track of who's in what seat, we'll "kick out" any other players // who were also in that seat. (Those players didn't click "Ready!" fast enough, somebody else took their seat!) - for (int i = 0; i < CharSelectData.LobbyPlayers.Count; ++i) + for (int i = 0; i < networkCharSelection.LobbyPlayers.Count; ++i) { - if (CharSelectData.LobbyPlayers[i].SeatIdx == newSeatIdx && i != idx) + if (networkCharSelection.LobbyPlayers[i].SeatIdx == newSeatIdx && i != idx) { // change this player to Inactive state. - CharSelectData.LobbyPlayers[i] = new CharSelectData.LobbyPlayerState( - CharSelectData.LobbyPlayers[i].ClientId, - CharSelectData.LobbyPlayers[i].PlayerName, - CharSelectData.LobbyPlayers[i].PlayerNumber, - CharSelectData.SeatState.Inactive); + networkCharSelection.LobbyPlayers[i] = new NetworkCharSelection.LobbyPlayerState( + networkCharSelection.LobbyPlayers[i].ClientId, + networkCharSelection.LobbyPlayers[i].PlayerName, + networkCharSelection.LobbyPlayers[i].PlayerNumber, + NetworkCharSelection.SeatState.Inactive); } } } @@ -116,9 +120,9 @@ void OnClientChangedSeat(ulong clientId, int newSeatIdx, bool lockedIn) /// int FindLobbyPlayerIdx(ulong clientId) { - for (int i = 0; i < CharSelectData.LobbyPlayers.Count; ++i) + for (int i = 0; i < networkCharSelection.LobbyPlayers.Count; ++i) { - if (CharSelectData.LobbyPlayers[i].ClientId == clientId) + if (networkCharSelection.LobbyPlayers[i].ClientId == clientId) return i; } return -1; @@ -130,14 +134,14 @@ int FindLobbyPlayerIdx(ulong clientId) /// void CloseLobbyIfReady() { - foreach (CharSelectData.LobbyPlayerState playerInfo in CharSelectData.LobbyPlayers) + foreach (NetworkCharSelection.LobbyPlayerState playerInfo in networkCharSelection.LobbyPlayers) { - if (playerInfo.SeatState != CharSelectData.SeatState.LockedIn) + if (playerInfo.SeatState != NetworkCharSelection.SeatState.LockedIn) return; // nope, at least one player isn't locked in yet! } // everybody's ready at the same time! Lock it down! - CharSelectData.IsLobbyClosed.Value = true; + networkCharSelection.IsLobbyClosed.Value = true; // remember our choices so the next scene can use the info SaveLobbyResults(); @@ -155,12 +159,12 @@ void CancelCloseLobby() { StopCoroutine(m_WaitToEndLobbyCoroutine); } - CharSelectData.IsLobbyClosed.Value = false; + networkCharSelection.IsLobbyClosed.Value = false; } void SaveLobbyResults() { - foreach (CharSelectData.LobbyPlayerState playerInfo in CharSelectData.LobbyPlayers) + foreach (NetworkCharSelection.LobbyPlayerState playerInfo in networkCharSelection.LobbyPlayers) { var playerNetworkObject = NetworkManager.Singleton.SpawnManager.GetPlayerNetworkObject(playerInfo.ClientId); @@ -169,7 +173,7 @@ void SaveLobbyResults() // pass avatar GUID to PersistentPlayer // it'd be great to simplify this with something like a NetworkScriptableObjects :( persistentPlayer.NetworkAvatarGuidState.AvatarGuid.Value = - CharSelectData.AvatarConfiguration[playerInfo.SeatIdx].Guid.ToNetworkGuid(); + networkCharSelection.AvatarConfiguration[playerInfo.SeatIdx].Guid.ToNetworkGuid(); } } } @@ -187,9 +191,9 @@ public void OnNetworkDespawn() NetworkManager.Singleton.OnClientDisconnectCallback -= OnClientDisconnectCallback; NetworkManager.Singleton.SceneManager.OnSceneEvent -= OnSceneEvent; } - if (CharSelectData) + if (networkCharSelection) { - CharSelectData.OnClientChangedSeat -= OnClientChangedSeat; + networkCharSelection.OnClientChangedSeat -= OnClientChangedSeat; } } @@ -202,7 +206,7 @@ public void OnNetworkSpawn() else { NetworkManager.Singleton.OnClientDisconnectCallback += OnClientDisconnectCallback; - CharSelectData.OnClientChangedSeat += OnClientChangedSeat; + networkCharSelection.OnClientChangedSeat += OnClientChangedSeat; NetworkManager.Singleton.SceneManager.OnSceneEvent += OnSceneEvent; } @@ -232,7 +236,7 @@ int GetAvailablePlayerNumber() bool IsPlayerNumberAvailable(int playerNumber) { bool found = false; - foreach (CharSelectData.LobbyPlayerState playerState in CharSelectData.LobbyPlayers) + foreach (NetworkCharSelection.LobbyPlayerState playerState in networkCharSelection.LobbyPlayers) { if (playerState.PlayerNumber == playerNumber) { @@ -247,7 +251,7 @@ bool IsPlayerNumberAvailable(int playerNumber) void SeatNewPlayer(ulong clientId) { // If lobby is closing and waiting to start the game, cancel to allow that new player to select a character - if (CharSelectData.IsLobbyClosed.Value) + if (networkCharSelection.IsLobbyClosed.Value) { CancelCloseLobby(); } @@ -267,7 +271,7 @@ void SeatNewPlayer(ulong clientId) throw new Exception($"we shouldn't be here, connection approval should have refused this connection already for client ID {clientId} and player num {playerData.PlayerNumber}"); } - CharSelectData.LobbyPlayers.Add(new CharSelectData.LobbyPlayerState(clientId, playerData.PlayerName, playerData.PlayerNumber, CharSelectData.SeatState.Inactive)); + networkCharSelection.LobbyPlayers.Add(new NetworkCharSelection.LobbyPlayerState(clientId, playerData.PlayerName, playerData.PlayerNumber, NetworkCharSelection.SeatState.Inactive)); SessionManager.Instance.SetPlayerData(clientId, playerData); } } @@ -275,16 +279,16 @@ void SeatNewPlayer(ulong clientId) void OnClientDisconnectCallback(ulong clientId) { // clear this client's PlayerNumber and any associated visuals (so other players know they're gone). - for (int i = 0; i < CharSelectData.LobbyPlayers.Count; ++i) + for (int i = 0; i < networkCharSelection.LobbyPlayers.Count; ++i) { - if (CharSelectData.LobbyPlayers[i].ClientId == clientId) + if (networkCharSelection.LobbyPlayers[i].ClientId == clientId) { - CharSelectData.LobbyPlayers.RemoveAt(i); + networkCharSelection.LobbyPlayers.RemoveAt(i); break; } } - if (!CharSelectData.IsLobbyClosed.Value) + if (!networkCharSelection.IsLobbyClosed.Value) { // If the lobby is not already closing, close if the remaining players are all ready CloseLobbyIfReady(); diff --git a/Assets/Scripts/Gameplay/GameState/ServerPostGameState.cs b/Assets/Scripts/Gameplay/GameState/ServerPostGameState.cs index cb74f4bf1..9f2c47c8f 100644 --- a/Assets/Scripts/Gameplay/GameState/ServerPostGameState.cs +++ b/Assets/Scripts/Gameplay/GameState/ServerPostGameState.cs @@ -1,11 +1,14 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Actions; +using Unity.BossRoom.ConnectionManagement; +using Unity.BossRoom.Gameplay.Actions; +using Unity.Multiplayer.Samples.BossRoom; using Unity.Multiplayer.Samples.Utilities; using Unity.Netcode; using UnityEngine; +using UnityEngine.Serialization; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.GameState { [RequireComponent(typeof(NetcodeHooks))] public class ServerPostGameState : GameStateBehaviour @@ -13,9 +16,10 @@ public class ServerPostGameState : GameStateBehaviour [SerializeField] NetcodeHooks m_NetcodeHooks; + [FormerlySerializedAs("synchronizedStateData")] [SerializeField] - PostGameStateData synchronizedStateData; - public PostGameStateData SynchronizedStateData => synchronizedStateData; + NetworkPostGame networkPostGame; + public NetworkPostGame NetworkPostGame => networkPostGame; public override GameState ActiveState { get { return GameState.PostGame; } } @@ -41,7 +45,7 @@ void OnNetworkSpawn() else { SessionManager.Instance.OnSessionEnded(); - synchronizedStateData.WinState.Value = m_PersistentGameState.WinState; + networkPostGame.WinState.Value = m_PersistentGameState.WinState; } } diff --git a/Assets/Scripts/Gameplay/GameplayObjects/AnimationCallbacks/AnimatorFootstepSounds.cs b/Assets/Scripts/Gameplay/GameplayObjects/AnimationCallbacks/AnimatorFootstepSounds.cs index 812d3b2f1..73aeb1974 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/AnimationCallbacks/AnimatorFootstepSounds.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/AnimationCallbacks/AnimatorFootstepSounds.cs @@ -2,7 +2,7 @@ using UnityEngine; using UnityEngine.Assertions; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.GameplayObjects.AnimationCallbacks { /// /// Plays one of a few sound effects, on a loop, based on a variable in an Animator. diff --git a/Assets/Scripts/Gameplay/GameplayObjects/AnimationCallbacks/AnimatorNodeHook.cs b/Assets/Scripts/Gameplay/GameplayObjects/AnimationCallbacks/AnimatorNodeHook.cs index fff810c94..5f54462ac 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/AnimationCallbacks/AnimatorNodeHook.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/AnimationCallbacks/AnimatorNodeHook.cs @@ -1,6 +1,7 @@ +using System; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.GameplayObjects.AnimationCallbacks { /// /// This is attached to each layer in the animator's state machines that needs to be able @@ -21,7 +22,7 @@ namespace Unity.Multiplayer.Samples.BossRoom.Visual public class AnimatorNodeHook : StateMachineBehaviour { private AnimatorTriggeredSpecialFX[] m_CachedTriggerRefs; - // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state + override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (m_CachedTriggerRefs == null) @@ -35,13 +36,6 @@ override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo } } - // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks - //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) - //{ - // - //} - - // OnStateExit is called when a transition ends and the state machine finishes evaluating this state override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (m_CachedTriggerRefs == null) diff --git a/Assets/Scripts/Gameplay/GameplayObjects/AnimationCallbacks/AnimatorTriggeredSpecialFX.cs b/Assets/Scripts/Gameplay/GameplayObjects/AnimationCallbacks/AnimatorTriggeredSpecialFX.cs index a0888026e..36e64fdd3 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/AnimationCallbacks/AnimatorTriggeredSpecialFX.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/AnimationCallbacks/AnimatorTriggeredSpecialFX.cs @@ -1,14 +1,17 @@ using System; using System.Collections; using System.Collections.Generic; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.VisualEffects; using UnityEngine; +using UnityEngine.Serialization; #if UNITY_EDITOR using UnityEditor; using UnityEditor.Animations; #endif -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.GameplayObjects.AnimationCallbacks { /// /// Instantiates and maintains graphics prefabs and sound effects. They're triggered by entering @@ -77,18 +80,19 @@ internal class AnimatorNodeEntryEvent /// private HashSet m_ActiveNodes = new HashSet(); + [FormerlySerializedAs("m_ClientCharacterVisualization")] [SerializeField] - ClientCharacterVisualization m_ClientCharacterVisualization; + ClientCharacter m_ClientCharacter; private void Awake() { Debug.Assert(m_AudioSources != null && m_AudioSources.Length > 0, "No AudioSource plugged into AnimatorTriggeredSpecialFX!", gameObject); - if (!m_ClientCharacterVisualization) + if (!m_ClientCharacter) { - m_ClientCharacterVisualization = GetComponentInParent(); + m_ClientCharacter = GetComponentInParent(); - m_Animator = m_ClientCharacterVisualization.OurAnimator; + m_Animator = m_ClientCharacter.OurAnimator; } } @@ -124,7 +128,7 @@ private IEnumerator CoroPlayStateEnterFX(AnimatorNodeEntryEvent eventInfo) if (!m_ActiveNodes.Contains(eventInfo.m_AnimatorNodeNameHash)) yield break; - Transform parent = eventInfo.m_PrefabParent != null ? eventInfo.m_PrefabParent : m_ClientCharacterVisualization.transform; + Transform parent = eventInfo.m_PrefabParent != null ? eventInfo.m_PrefabParent : m_ClientCharacter.transform; var instantiatedFX = Instantiate(eventInfo.m_Prefab, parent); instantiatedFX.transform.localPosition += eventInfo.m_PrefabParentOffset; diff --git a/Assets/Scripts/Gameplay/GameplayObjects/AnimationCallbacks/BossDeathHelmetHandler.cs b/Assets/Scripts/Gameplay/GameplayObjects/AnimationCallbacks/BossDeathHelmetHandler.cs index d53b2372f..e0920d2f0 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/AnimationCallbacks/BossDeathHelmetHandler.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/AnimationCallbacks/BossDeathHelmetHandler.cs @@ -1,6 +1,7 @@ +using System; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.GameplayObjects.AnimationCallbacks { /// /// De-parents the boss's helmet when he is defeated. This prevents the helmet from jittering during the diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Audio/BossMusicStarter.cs b/Assets/Scripts/Gameplay/GameplayObjects/Audio/BossMusicStarter.cs index 642ec3637..4f1523be8 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Audio/BossMusicStarter.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Audio/BossMusicStarter.cs @@ -1,7 +1,10 @@ +using System; +using Unity.BossRoom.Audio; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using UnityEngine; using UnityEngine.Assertions; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.GameplayObjects.Audio { /// /// Simple class to restart game theme on main menu load @@ -28,13 +31,13 @@ void Start() void OnDestroy() { - var netState = GetComponent(); - if (netState != null) + var serverCharacter = GetComponent(); + if (serverCharacter != null) { - netState.NetworkLifeState.LifeState.OnValueChanged -= OnLifeStateChanged; - if (netState.HealthState != null) + serverCharacter.NetLifeState.LifeState.OnValueChanged -= OnLifeStateChanged; + if (serverCharacter.NetHealthState != null) { - netState.HealthState.HitPoints.OnValueChanged -= OnHealthChanged; + serverCharacter.NetHealthState.HitPoints.OnValueChanged -= OnHealthChanged; } } } diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Audio/MainMenuMusicStarter.cs b/Assets/Scripts/Gameplay/GameplayObjects/Audio/MainMenuMusicStarter.cs index 8705d304a..967e30c93 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Audio/MainMenuMusicStarter.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Audio/MainMenuMusicStarter.cs @@ -1,7 +1,8 @@ +using System; +using Unity.BossRoom.Audio; using UnityEngine; - -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.GameplayObjects.Audio { /// /// Simple class to play game theme on scene load diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Breakable.cs b/Assets/Scripts/Gameplay/GameplayObjects/Breakable.cs new file mode 100644 index 000000000..2edb3ace1 --- /dev/null +++ b/Assets/Scripts/Gameplay/GameplayObjects/Breakable.cs @@ -0,0 +1,206 @@ +using System; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.Infrastructure; +using Unity.Netcode; +using UnityEngine; +using UnityEngine.Assertions; + +namespace Unity.BossRoom.Gameplay.GameplayObjects +{ + /// + /// This script handles the logic for a simple "single-shot" breakable object like a pot, or + /// other stationary items with arbitrary amounts of HP, like spawner-portal crystals. + /// Visualization for these objects works by swapping a "broken" prefab at the moment of breakage. The broken prefab + /// then handles the pesky details of actually falling apart. + /// + public class Breakable : NetworkBehaviour, IDamageable, ITargetable + { + [Header("Server Logic")] + [SerializeField] + [Tooltip("If left blank, this breakable effectively has 1 hit point")] + IntVariable m_MaxHealth; + + [SerializeField] + [Tooltip("If this breakable will have hit points, add a NetworkHealthState component to this GameObject")] + NetworkHealthState m_NetworkHealthState; + + [SerializeField] + Collider m_Collider; + + [SerializeField] + [Tooltip("Indicate which special interaction behaviors are needed for this breakable")] + IDamageable.SpecialDamageFlags m_SpecialDamageFlags; + + [Header("Visualization")] + [SerializeField] + private GameObject m_BrokenPrefab; + + [SerializeField] + [Tooltip("If set, will be used instead of BrokenPrefab when new players join, skipping transition effects.")] + private GameObject m_PrebrokenPrefab; + + [SerializeField] + [Tooltip("We use this transform's position and rotation when creating the prefab. (Defaults to self)")] + private Transform m_BrokenPrefabPos; + + [SerializeField] + private GameObject[] m_UnbrokenGameObjects; + + + /// + /// Is the item broken or not? + /// + public NetworkVariable IsBroken; + + public bool IsNpc { get { return true; } } + + public bool IsValidTarget { get { return !IsBroken.Value; } } + + private GameObject m_CurrentBrokenVisualization; + + public override void OnNetworkSpawn() + { + if (IsServer) + { + if (m_MaxHealth && m_NetworkHealthState) + { + m_NetworkHealthState.HitPoints.Value = m_MaxHealth.Value; + } + } + + if (IsClient) + { + IsBroken.OnValueChanged += OnBreakableStateChanged; + + if (IsBroken.Value == true) + { + PerformBreakVisualization(true); + } + } + } + + public override void OnNetworkDespawn() + { + if (IsClient) + { + IsBroken.OnValueChanged -= OnBreakableStateChanged; + } + } + + public void ReceiveHP(ServerCharacter inflicter, int HP) + { + if (HP < 0) + { + if (inflicter && !inflicter.IsNpc) + { + bool isNotDamagedByPlayers = (GetSpecialDamageFlags() & IDamageable.SpecialDamageFlags.NotDamagedByPlayers) == IDamageable.SpecialDamageFlags.NotDamagedByPlayers; + if (isNotDamagedByPlayers) + { + // a player tried to damage us, but we are immune to player damage! + return; + } + } + + if (m_NetworkHealthState) + { + m_NetworkHealthState.HitPoints.Value = + Mathf.Clamp(m_NetworkHealthState.HitPoints.Value + HP, 0, m_MaxHealth.Value); + if (m_NetworkHealthState.HitPoints.Value <= 0) + { + Break(); + } + } + else + { + //any damage at all is enough to slay me. + Break(); + } + } + } + + private void Break() + { + IsBroken.Value = true; + if (m_Collider) + m_Collider.enabled = false; + } + + public void Unbreak() + { + IsBroken.Value = false; + if (m_Collider) + m_Collider.enabled = true; + if (m_MaxHealth && m_NetworkHealthState) + m_NetworkHealthState.HitPoints.Value = m_MaxHealth.Value; + } + + public IDamageable.SpecialDamageFlags GetSpecialDamageFlags() + { + return m_SpecialDamageFlags; + } + + public bool IsDamageable() + { + // you can damage this breakable until it's broken! + return !IsBroken.Value; + } + + private void OnBreakableStateChanged(bool wasBroken, bool isBroken) + { + if (!wasBroken && isBroken) + { + PerformBreakVisualization(false); + } + else if (wasBroken && !isBroken) + { + PerformUnbreakVisualization(); + } + } + + private void PerformBreakVisualization(bool onStart) + { + foreach (var gameObject in m_UnbrokenGameObjects) + { + if (gameObject) + gameObject.SetActive(false); + } + + if (m_CurrentBrokenVisualization) + Destroy(m_CurrentBrokenVisualization); // just a safety check, should be null when we get here + + GameObject brokenPrefab = (onStart && m_PrebrokenPrefab != null) ? m_PrebrokenPrefab : m_BrokenPrefab; + if (brokenPrefab) + { + m_CurrentBrokenVisualization = Instantiate(brokenPrefab, m_BrokenPrefabPos.position, m_BrokenPrefabPos.rotation, transform); + } + } + + private void PerformUnbreakVisualization() + { + if (m_CurrentBrokenVisualization) + { + Destroy(m_CurrentBrokenVisualization); + } + foreach (var gameObject in m_UnbrokenGameObjects) + { + if (gameObject) + gameObject.SetActive(true); + } + } + +#if UNITY_EDITOR + private void OnValidate() + { + if (!m_Collider) + m_Collider = GetComponent(); + if (!m_NetworkHealthState) + m_NetworkHealthState = GetComponent(); + if (!m_BrokenPrefabPos) + m_BrokenPrefabPos = transform; + } +#endif + } + + +} + diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ServerBreakableLogic.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/Breakable.cs.meta similarity index 100% rename from Assets/Scripts/Gameplay/GameplayObjects/ServerBreakableLogic.cs.meta rename to Assets/Scripts/Gameplay/GameplayObjects/Breakable.cs.meta diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/AI/AIBrain.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/AI/AIBrain.cs index 2a1e8f276..4570636d0 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/AI/AIBrain.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/AI/AIBrain.cs @@ -1,9 +1,10 @@ using System; using System.Collections.Generic; -using Unity.Multiplayer.Samples.BossRoom.Actions; +using Unity.BossRoom.Gameplay.Configuration; +using Unity.BossRoom.Gameplay.Actions; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.GameplayObjects.Character.AI { /// /// Handles enemy AI. Contains AIStateLogics that handle some of the details, @@ -97,8 +98,8 @@ public bool IsAppropriateFoe(ServerCharacter potentialFoe) { if (potentialFoe == null || potentialFoe.IsNpc || - potentialFoe.NetState.LifeState != LifeState.Alive || - potentialFoe.NetState.IsStealthy.Value) + potentialFoe.LifeState != LifeState.Alive || + potentialFoe.IsStealthy.Value) { return false; } @@ -151,7 +152,7 @@ public CharacterClass CharacterData { get { - return GameDataSource.Instance.CharacterDataByType[m_ServerCharacter.NetState.CharacterType]; + return GameDataSource.Instance.CharacterDataByType[m_ServerCharacter.CharacterType]; } } diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/AI/AIState.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/AI/AIState.cs index 4d6a7d2d5..f4b75eff0 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/AI/AIState.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/AI/AIState.cs @@ -1,4 +1,6 @@ -namespace Unity.Multiplayer.Samples.BossRoom.Server +using System; + +namespace Unity.BossRoom.Gameplay.GameplayObjects.Character.AI { /// diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/AI/AttackAIState.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/AI/AttackAIState.cs index 9d014042d..e8a395f1b 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/AI/AttackAIState.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/AI/AttackAIState.cs @@ -1,8 +1,11 @@ +using System; using System.Collections.Generic; -using Unity.Multiplayer.Samples.BossRoom.Actions; +using Unity.BossRoom.Gameplay.Actions; using UnityEngine; +using Action = Unity.BossRoom.Gameplay.Actions.Action; +using Random = UnityEngine.Random; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.GameplayObjects.Character.AI { public class AttackAIState : AIState { diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/AI/IdleAIState.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/AI/IdleAIState.cs index 4a21e92d2..7d87da56b 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/AI/IdleAIState.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/AI/IdleAIState.cs @@ -1,6 +1,7 @@ +using System; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.GameplayObjects.Character.AI { public class IdleAIState : AIState { diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/CharacterSwap.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/CharacterSwap.cs index a7e826a46..c0e73fc62 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/CharacterSwap.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/CharacterSwap.cs @@ -1,9 +1,9 @@ using System; -using UnityEngine; using System.Collections.Generic; -using Unity.Multiplayer.Samples.BossRoom.Visual; +using Unity.BossRoom.Gameplay.GameplayObjects.AnimationCallbacks; +using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.GameplayObjects.Character { /// /// Responsible for storing of all of the pieces of a character, and swapping the pieces out en masse when asked to. @@ -26,7 +26,7 @@ public class CharacterModelSet public GameObject shoulderRight; public GameObject shoulderLeft; public GameObject handSocket; - public Visual.AnimatorTriggeredSpecialFX specialFx; // should be a component on the same GameObject as the Animator! + public AnimatorTriggeredSpecialFX specialFx; public AnimatorOverrideController animatorOverrides; // references a separate stand-alone object in the project private List m_CachedRenderers; @@ -115,12 +115,12 @@ public enum SpecialMaterialMode /// private Dictionary m_OriginalMaterials = new Dictionary(); - ClientCharacterVisualization m_ClientCharacterVisualization; + ClientCharacter m_ClientCharacter; void Awake() { - m_ClientCharacterVisualization = GetComponentInParent(); - m_Animator = m_ClientCharacterVisualization.OurAnimator; + m_ClientCharacter = GetComponentInParent(); + m_Animator = m_ClientCharacter.OurAnimator; m_OriginalController = m_Animator.runtimeAnimatorController; } diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/CharacterTypeEnum.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/CharacterTypeEnum.cs index d2d99eea0..f52f4075e 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/CharacterTypeEnum.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/CharacterTypeEnum.cs @@ -1,4 +1,6 @@ -namespace Unity.Multiplayer.Samples.BossRoom +using System; + +namespace Unity.BossRoom.Gameplay.GameplayObjects.Character { /// /// This corresponds to a CharacterClass ScriptableObject data object, containing the core gameplay data for diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientAvatarGuidHandler.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientAvatarGuidHandler.cs index ed4e5cc45..a3d76552f 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientAvatarGuidHandler.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientAvatarGuidHandler.cs @@ -2,7 +2,7 @@ using Unity.Netcode; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.GameplayObjects.Character { /// /// Client-side component that awaits a state change on an avatar's Guid, and fetches matching Avatar from the @@ -23,8 +23,10 @@ public class ClientAvatarGuidHandler : NetworkBehaviour public override void OnNetworkSpawn() { - base.OnNetworkSpawn(); - InstantiateAvatar(); + if (IsClient) + { + InstantiateAvatar(); + } } void InstantiateAvatar() diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientCharacter.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientCharacter.cs index 7d0e49957..d3cf2f067 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientCharacter.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientCharacter.cs @@ -1,27 +1,325 @@ +using System; +using Unity.BossRoom.CameraUtils; +using Unity.BossRoom.Gameplay.UserInput; +using Unity.BossRoom.Gameplay.Configuration; +using Unity.BossRoom.Gameplay.Actions; +using Unity.BossRoom.Utils; using Unity.Netcode; using UnityEngine; -using Unity.Multiplayer.Samples.BossRoom.Visual; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.GameplayObjects.Character { - [RequireComponent(typeof(NetworkCharacterState))] + /// + /// is responsible for displaying a character on the client's screen based on state information sent by the server. + /// public class ClientCharacter : NetworkBehaviour { [SerializeField] - ClientCharacterVisualization m_ClientCharacterVisualization; + Animator m_ClientVisualsAnimator; + + [SerializeField] + VisualizationConfiguration m_VisualizationConfiguration; + + /// + /// Returns a reference to the active Animator for this visualization + /// + public Animator OurAnimator => m_ClientVisualsAnimator; + + /// + /// Returns the targeting-reticule prefab for this character visualization + /// + public GameObject TargetReticulePrefab => m_VisualizationConfiguration.TargetReticule; /// - /// The Visualization GameObject isn't in the same transform hierarchy as the object, but it registers itself here - /// so that the visual GameObject can be found from a NetworkObjectId. + /// Returns the Material to plug into the reticule when the selected entity is hostile /// - public ClientCharacterVisualization ChildVizObject => m_ClientCharacterVisualization; + public Material ReticuleHostileMat => m_VisualizationConfiguration.ReticuleHostileMat; + + /// + /// Returns the Material to plug into the reticule when the selected entity is friendly + /// + public Material ReticuleFriendlyMat => m_VisualizationConfiguration.ReticuleFriendlyMat; + + + CharacterSwap m_CharacterSwapper; + + public CharacterSwap CharacterSwap => m_CharacterSwapper; + + public bool CanPerformActions => m_ServerCharacter.CanPerformActions; + + ServerCharacter m_ServerCharacter; + + public ServerCharacter serverCharacter => m_ServerCharacter; + + ClientActionPlayer m_ClientActionViz; + + PositionLerper m_PositionLerper; + + RotationLerper m_RotationLerper; + + PhysicsWrapper m_PhysicsWrapper; + + // this value suffices for both positional and rotational interpolations; one may have a constant value for each + const float k_LerpTime = 0.08f; + + Vector3 m_LerpedPosition; + + Quaternion m_LerpedRotation; + + bool m_IsHost; + + float m_CurrentSpeed; + + /// + /// /// Server to Client RPC that broadcasts this action play to all clients. + /// + /// Data about which action to play and its associated details. + [ClientRpc] + public void RecvDoActionClientRPC(ActionRequestData data) + { + ActionRequestData data1 = data; + m_ClientActionViz.PlayAction(ref data1); + } + + /// + /// This RPC is invoked on the client when the active action FXs need to be cancelled (e.g. when the character has been stunned) + /// + [ClientRpc] + public void RecvCancelAllActionsClientRpc() + { + m_ClientActionViz.CancelAllActions(); + } + + /// + /// This RPC is invoked on the client when active action FXs of a certain type need to be cancelled (e.g. when the Stealth action ends) + /// + [ClientRpc] + public void RecvCancelActionsByPrototypeIDClientRpc(ActionID actionPrototypeID) + { + m_ClientActionViz.CancelAllActionsWithSamePrototypeID(actionPrototypeID); + } + + /// + /// Called on all clients when this character has stopped "charging up" an attack. + /// Provides a value between 0 and 1 inclusive which indicates how "charged up" the attack ended up being. + /// + [ClientRpc] + public void RecvStopChargingUpClientRpc(float percentCharged) + { + m_ClientActionViz.OnStoppedChargingUp(percentCharged); + } + + void Awake() + { + enabled = false; + } public override void OnNetworkSpawn() { - if (!IsClient) + if (!IsClient || transform.parent == null) + { + return; + } + + enabled = true; + + m_IsHost = IsHost; + + m_ClientActionViz = new ClientActionPlayer(this); + + m_ServerCharacter = GetComponentInParent(); + + m_PhysicsWrapper = m_ServerCharacter.GetComponent(); + + m_ServerCharacter.IsStealthy.OnValueChanged += OnStealthyChanged; + m_ServerCharacter.MovementStatus.OnValueChanged += OnMovementStatusChanged; + OnMovementStatusChanged(MovementStatus.Normal, m_ServerCharacter.MovementStatus.Value); + + // sync our visualization position & rotation to the most up to date version received from server + transform.SetPositionAndRotation(m_PhysicsWrapper.Transform.position, m_PhysicsWrapper.Transform.rotation); + m_LerpedPosition = transform.position; + m_LerpedRotation = transform.rotation; + + // similarly, initialize start position and rotation for smooth lerping purposes + m_PositionLerper = new PositionLerper(m_PhysicsWrapper.Transform.position, k_LerpTime); + m_RotationLerper = new RotationLerper(m_PhysicsWrapper.Transform.rotation, k_LerpTime); + + if (!m_ServerCharacter.IsNpc) + { + name = "AvatarGraphics" + m_ServerCharacter.OwnerClientId; + + if (m_ServerCharacter.TryGetComponent(out ClientAvatarGuidHandler clientAvatarGuidHandler)) + { + m_ClientVisualsAnimator = clientAvatarGuidHandler.graphicsAnimator; + } + + m_CharacterSwapper = GetComponentInChildren(); + + // ...and visualize the current char-select value that we know about + SetAppearanceSwap(); + + if (m_ServerCharacter.IsOwner) + { + ActionRequestData data = new ActionRequestData { ActionID = GameDataSource.Instance.GeneralTargetActionPrototype.ActionID }; + m_ClientActionViz.PlayAction(ref data); + gameObject.AddComponent(); + + if (m_ServerCharacter.TryGetComponent(out ClientInputSender inputSender)) + { + // TODO: revisit; anticipated actions would play twice on the host + if (!IsServer) + { + inputSender.ActionInputEvent += OnActionInput; + } + inputSender.ClientMoveEvent += OnMoveInput; + } + } + } + } + + public override void OnNetworkDespawn() + { + if (m_ServerCharacter) { - enabled = false; + //m_NetState.DoActionEventClient -= PerformActionFX; + //m_NetState.CancelAllActionsEventClient -= CancelAllActionFXs; + //m_NetState.CancelActionsByPrototypeIDEventClient -= CancelActionFXByPrototypeID; + //m_NetState.OnStopChargingUpClient -= OnStoppedChargingUpClient; + m_ServerCharacter.IsStealthy.OnValueChanged -= OnStealthyChanged; + + if (m_ServerCharacter.TryGetComponent(out ClientInputSender sender)) + { + sender.ActionInputEvent -= OnActionInput; + sender.ClientMoveEvent -= OnMoveInput; + } } + + enabled = false; + } + + void OnActionInput(ActionRequestData data) + { + m_ClientActionViz.AnticipateAction(ref data); + } + + void OnMoveInput(Vector3 position) + { + if (!IsAnimating()) + { + OurAnimator.SetTrigger(m_VisualizationConfiguration.AnticipateMoveTriggerID); + } + } + + void OnStealthyChanged(bool oldValue, bool newValue) + { + SetAppearanceSwap(); + } + + void SetAppearanceSwap() + { + if (m_CharacterSwapper) + { + var specialMaterialMode = CharacterSwap.SpecialMaterialMode.None; + if (m_ServerCharacter.IsStealthy.Value) + { + if (m_ServerCharacter.IsOwner) + { + specialMaterialMode = CharacterSwap.SpecialMaterialMode.StealthySelf; + } + else + { + specialMaterialMode = CharacterSwap.SpecialMaterialMode.StealthyOther; + } + } + + m_CharacterSwapper.SwapToModel(specialMaterialMode); + } + } + + /// + /// Returns the value we should set the Animator's "Speed" variable, given current gameplay conditions. + /// + float GetVisualMovementSpeed(MovementStatus movementStatus) + { + if (m_ServerCharacter.NetLifeState.LifeState.Value != LifeState.Alive) + { + return m_VisualizationConfiguration.SpeedDead; + } + + switch (movementStatus) + { + case MovementStatus.Idle: + return m_VisualizationConfiguration.SpeedIdle; + case MovementStatus.Normal: + return m_VisualizationConfiguration.SpeedNormal; + case MovementStatus.Uncontrolled: + return m_VisualizationConfiguration.SpeedUncontrolled; + case MovementStatus.Slowed: + return m_VisualizationConfiguration.SpeedSlowed; + case MovementStatus.Hasted: + return m_VisualizationConfiguration.SpeedHasted; + case MovementStatus.Walking: + return m_VisualizationConfiguration.SpeedWalking; + default: + throw new Exception($"Unknown MovementStatus {movementStatus}"); + } + } + + void OnMovementStatusChanged(MovementStatus previousValue, MovementStatus newValue) + { + m_CurrentSpeed = GetVisualMovementSpeed(newValue); + } + + void Update() + { + // On the host, Characters are translated via ServerCharacterMovement's FixedUpdate method. To ensure that + // the game camera tracks a GameObject moving in the Update loop and therefore eliminate any camera jitter, + // this graphics GameObject's position is smoothed over time on the host. Clients do not need to perform any + // positional smoothing since NetworkTransform will interpolate position updates on the root GameObject. + if (m_IsHost) + { + // Note: a cached position (m_LerpedPosition) and rotation (m_LerpedRotation) are created and used as + // the starting point for each interpolation since the root's position and rotation are modified in + // FixedUpdate, thus altering this transform (being a child) in the process. + m_LerpedPosition = m_PositionLerper.LerpPosition(m_LerpedPosition, + m_PhysicsWrapper.Transform.position); + m_LerpedRotation = m_RotationLerper.LerpRotation(m_LerpedRotation, + m_PhysicsWrapper.Transform.rotation); + transform.SetPositionAndRotation(m_LerpedPosition, m_LerpedRotation); + } + + if (m_ClientVisualsAnimator) + { + // set Animator variables here + OurAnimator.SetFloat(m_VisualizationConfiguration.SpeedVariableID, m_CurrentSpeed); + } + + m_ClientActionViz.OnUpdate(); + } + + void OnAnimEvent(string id) + { + //if you are trying to figure out who calls this method, it's "magic". The Unity Animation Event system takes method names as strings, + //and calls a method of the same name on a component on the same GameObject as the Animator. See the "attack1" Animation Clip as one + //example of where this is configured. + + m_ClientActionViz.OnAnimEvent(id); + } + + public bool IsAnimating() + { + if (OurAnimator.GetFloat(m_VisualizationConfiguration.SpeedVariableID) > 0.0) { return true; } + + for (int i = 0; i < OurAnimator.layerCount; i++) + { + if (OurAnimator.GetCurrentAnimatorStateInfo(i).tagHash != m_VisualizationConfiguration.BaseNodeTagID) + { + //we are in an active node, not the default "nothing" node. + return true; + } + } + + return false; } } } diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientCharacter.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientCharacter.cs.meta index 5b264afa8..941ca18b2 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientCharacter.cs.meta +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientCharacter.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ae9a06a3585027044ababe9f9cb7b8e6 +guid: 9520a47fc61d5ab4ca99cdac2d574909 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientCharacterVisualization.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientCharacterVisualization.cs deleted file mode 100644 index bd9c01e8e..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientCharacterVisualization.cs +++ /dev/null @@ -1,306 +0,0 @@ -using System; -using Unity.Multiplayer.Samples.BossRoom.Actions; -using Unity.Netcode; -using UnityEngine; -using Unity.Multiplayer.Samples.BossRoom.Client; - -namespace Unity.Multiplayer.Samples.BossRoom.Visual -{ - /// - /// is responsible for displaying a character on the client's screen based on state information sent by the server. - /// - public class ClientCharacterVisualization : NetworkBehaviour - { - [SerializeField] - Animator m_ClientVisualsAnimator; - - CharacterSwap m_CharacterSwapper; - - [SerializeField] - VisualizationConfiguration m_VisualizationConfiguration; - - /// - /// Returns a reference to the active Animator for this visualization - /// - public Animator OurAnimator => m_ClientVisualsAnimator; - - /// - /// Returns the targeting-reticule prefab for this character visualization - /// - public GameObject TargetReticulePrefab => m_VisualizationConfiguration.TargetReticule; - - /// - /// Returns the Material to plug into the reticule when the selected entity is hostile - /// - public Material ReticuleHostileMat => m_VisualizationConfiguration.ReticuleHostileMat; - - /// - /// Returns the Material to plug into the reticule when the selected entity is friendly - /// - public Material ReticuleFriendlyMat => m_VisualizationConfiguration.ReticuleFriendlyMat; - - public CharacterSwap CharacterSwap => m_CharacterSwapper; - - PhysicsWrapper m_PhysicsWrapper; - - public bool CanPerformActions => m_NetState.CanPerformActions; - - NetworkCharacterState m_NetState; - - public NetworkCharacterState NetState => m_NetState; - - ClientActionPlayer m_ClientActionViz; - - PositionLerper m_PositionLerper; - - RotationLerper m_RotationLerper; - - // this value suffices for both positional and rotational interpolations; one may have a constant value for each - const float k_LerpTime = 0.08f; - - Vector3 m_LerpedPosition; - - Quaternion m_LerpedRotation; - - bool m_IsHost; - - float m_CurrentSpeed; - - void Awake() - { - enabled = false; - } - - public override void OnNetworkSpawn() - { - if (!IsClient || transform.parent == null) - { - return; - } - - enabled = true; - - m_IsHost = IsHost; - - m_ClientActionViz = new ClientActionPlayer(this); - - m_NetState = GetComponentInParent(); - - m_PhysicsWrapper = m_NetState.GetComponent(); - - m_NetState.DoActionEventClient += PerformActionFX; - m_NetState.CancelAllActionsEventClient += CancelAllActionFXs; - m_NetState.CancelActionsByPrototypeIDEventClient += CancelActionFXByPrototypeID; - m_NetState.OnStopChargingUpClient += OnStoppedChargingUp; - m_NetState.IsStealthy.OnValueChanged += OnStealthyChanged; - m_NetState.MovementStatus.OnValueChanged += OnMovementStatusChanged; - OnMovementStatusChanged(MovementStatus.Normal, m_NetState.MovementStatus.Value); - - // sync our visualization position & rotation to the most up to date version received from server - transform.SetPositionAndRotation(m_PhysicsWrapper.Transform.position, m_PhysicsWrapper.Transform.rotation); - m_LerpedPosition = transform.position; - m_LerpedRotation = transform.rotation; - - // similarly, initialize start position and rotation for smooth lerping purposes - m_PositionLerper = new PositionLerper(m_PhysicsWrapper.Transform.position, k_LerpTime); - m_RotationLerper = new RotationLerper(m_PhysicsWrapper.Transform.rotation, k_LerpTime); - - if (!m_NetState.IsNpc) - { - name = "AvatarGraphics" + m_NetState.OwnerClientId; - - if (m_NetState.TryGetComponent(out ClientAvatarGuidHandler clientAvatarGuidHandler)) - { - m_ClientVisualsAnimator = clientAvatarGuidHandler.graphicsAnimator; - } - - m_CharacterSwapper = GetComponentInChildren(); - - // ...and visualize the current char-select value that we know about - SetAppearanceSwap(); - - if (m_NetState.IsOwner) - { - ActionRequestData data = new ActionRequestData { ActionID = GameDataSource.Instance.GeneralTargetActionPrototype.ActionID }; - m_ClientActionViz.PlayAction(ref data); - gameObject.AddComponent(); - - if (m_NetState.TryGetComponent(out ClientInputSender inputSender)) - { - // TODO: revisit; anticipated actions would play twice on the host - if (!IsServer) - { - inputSender.ActionInputEvent += OnActionInput; - } - inputSender.ClientMoveEvent += OnMoveInput; - } - } - } - } - - public override void OnNetworkDespawn() - { - if (m_NetState) - { - m_NetState.DoActionEventClient -= PerformActionFX; - m_NetState.CancelAllActionsEventClient -= CancelAllActionFXs; - m_NetState.CancelActionsByPrototypeIDEventClient -= CancelActionFXByPrototypeID; - m_NetState.OnStopChargingUpClient -= OnStoppedChargingUp; - m_NetState.IsStealthy.OnValueChanged -= OnStealthyChanged; - - if (m_NetState.TryGetComponent(out ClientInputSender sender)) - { - sender.ActionInputEvent -= OnActionInput; - sender.ClientMoveEvent -= OnMoveInput; - } - } - - enabled = false; - } - - void OnActionInput(ActionRequestData data) - { - m_ClientActionViz.AnticipateAction(ref data); - } - - void OnMoveInput(Vector3 position) - { - if (!IsAnimating()) - { - OurAnimator.SetTrigger(m_VisualizationConfiguration.AnticipateMoveTriggerID); - } - } - - void PerformActionFX(ActionRequestData data) - { - m_ClientActionViz.PlayAction(ref data); - } - - void CancelAllActionFXs() - { - m_ClientActionViz.CancelAllActions(); - } - - void CancelActionFXByPrototypeID(ActionID actionPrototypeID) - { - m_ClientActionViz.CancelAllActionsWithSamePrototypeID(actionPrototypeID); - } - - void OnStoppedChargingUp(float finalChargeUpPercentage) - { - m_ClientActionViz.OnStoppedChargingUp(finalChargeUpPercentage); - } - - void OnStealthyChanged(bool oldValue, bool newValue) - { - SetAppearanceSwap(); - } - - void SetAppearanceSwap() - { - if (m_CharacterSwapper) - { - var specialMaterialMode = CharacterSwap.SpecialMaterialMode.None; - if (m_NetState.IsStealthy.Value) - { - if (m_NetState.IsOwner) - { - specialMaterialMode = CharacterSwap.SpecialMaterialMode.StealthySelf; - } - else - { - specialMaterialMode = CharacterSwap.SpecialMaterialMode.StealthyOther; - } - } - - m_CharacterSwapper.SwapToModel(specialMaterialMode); - } - } - - /// - /// Returns the value we should set the Animator's "Speed" variable, given current gameplay conditions. - /// - float GetVisualMovementSpeed(MovementStatus movementStatus) - { - if (m_NetState.NetworkLifeState.LifeState.Value != LifeState.Alive) - { - return m_VisualizationConfiguration.SpeedDead; - } - - switch (movementStatus) - { - case MovementStatus.Idle: - return m_VisualizationConfiguration.SpeedIdle; - case MovementStatus.Normal: - return m_VisualizationConfiguration.SpeedNormal; - case MovementStatus.Uncontrolled: - return m_VisualizationConfiguration.SpeedUncontrolled; - case MovementStatus.Slowed: - return m_VisualizationConfiguration.SpeedSlowed; - case MovementStatus.Hasted: - return m_VisualizationConfiguration.SpeedHasted; - case MovementStatus.Walking: - return m_VisualizationConfiguration.SpeedWalking; - default: - throw new Exception($"Unknown MovementStatus {movementStatus}"); - } - } - - void OnMovementStatusChanged(MovementStatus previousValue, MovementStatus newValue) - { - m_CurrentSpeed = GetVisualMovementSpeed(newValue); - } - - void Update() - { - // On the host, Characters are translated via ServerCharacterMovement's FixedUpdate method. To ensure that - // the game camera tracks a GameObject moving in the Update loop and therefore eliminate any camera jitter, - // this graphics GameObject's position is smoothed over time on the host. Clients do not need to perform any - // positional smoothing since NetworkTransform will interpolate position updates on the root GameObject. - if (m_IsHost) - { - // Note: a cached position (m_LerpedPosition) and rotation (m_LerpedRotation) are created and used as - // the starting point for each interpolation since the root's position and rotation are modified in - // FixedUpdate, thus altering this transform (being a child) in the process. - m_LerpedPosition = m_PositionLerper.LerpPosition(m_LerpedPosition, - m_PhysicsWrapper.Transform.position); - m_LerpedRotation = m_RotationLerper.LerpRotation(m_LerpedRotation, - m_PhysicsWrapper.Transform.rotation); - transform.SetPositionAndRotation(m_LerpedPosition, m_LerpedRotation); - } - - if (m_ClientVisualsAnimator) - { - // set Animator variables here - OurAnimator.SetFloat(m_VisualizationConfiguration.SpeedVariableID, m_CurrentSpeed); - } - - m_ClientActionViz.OnUpdate(); - } - - void OnAnimEvent(string id) - { - //if you are trying to figure out who calls this method, it's "magic". The Unity Animation Event system takes method names as strings, - //and calls a method of the same name on a component on the same GameObject as the Animator. See the "attack1" Animation Clip as one - //example of where this is configured. - - m_ClientActionViz.OnAnimEvent(id); - } - - public bool IsAnimating() - { - if (OurAnimator.GetFloat(m_VisualizationConfiguration.SpeedVariableID) > 0.0) { return true; } - - for (int i = 0; i < OurAnimator.layerCount; i++) - { - if (OurAnimator.GetCurrentAnimatorStateInfo(i).tagHash != m_VisualizationConfiguration.BaseNodeTagID) - { - //we are in an active node, not the default "nothing" node. - return true; - } - } - - return false; - } - } -} diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientCharacterVisualization.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientCharacterVisualization.cs.meta deleted file mode 100644 index 941ca18b2..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientCharacterVisualization.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9520a47fc61d5ab4ca99cdac2d574909 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientGenericMovement.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientGenericMovement.cs deleted file mode 100644 index 68d2e10d1..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientGenericMovement.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Unity.Netcode; -using UnityEngine; - -namespace Unity.Multiplayer.Samples.BossRoom.Client -{ - /// - /// Generic movement object that updates transforms based on the state of an INetMovement source. - /// This is part of a temporary movement system that will be replaced once Netcode for GameObjects can drive - /// movement internally. - /// - public class ClientGenericMovement : NetworkBehaviour - { - private INetMovement m_MovementSource; - private Rigidbody m_Rigidbody; - private bool m_Initialized; - - - // Start is called before the first frame update - void Start() - { - m_MovementSource = GetComponent(); - m_Rigidbody = GetComponent(); //this may be null. - } - - public override void OnNetworkSpawn() - { - if (IsServer) - { - //this component is not needed on the host (or dedicated server), because ServerCharacterMovement will directly - //update the character's position. - this.enabled = false; - } - m_Initialized = true; - } - - // Update is called once per frame - void Update() - { - if (!m_Initialized) { return; } - - transform.position = m_MovementSource.NetworkPosition.Value; - transform.rotation = Quaternion.Euler(0, m_MovementSource.NetworkRotationY.Value, 0); - - if (m_Rigidbody != null) - { - m_Rigidbody.position = transform.position; - m_Rigidbody.rotation = transform.rotation; - } - } - } -} - diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientGenericMovement.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientGenericMovement.cs.meta deleted file mode 100644 index 5f62fe393..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientGenericMovement.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 797d92969c575574d868e069887e8486 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientPlayerAvatar.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientPlayerAvatar.cs index 6f85dbc49..ccf623cca 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientPlayerAvatar.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientPlayerAvatar.cs @@ -2,7 +2,7 @@ using Unity.Netcode; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.GameplayObjects.Character { public class ClientPlayerAvatar : NetworkBehaviour { diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/MovementStatus.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/MovementStatus.cs new file mode 100644 index 000000000..4f5171c83 --- /dev/null +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/MovementStatus.cs @@ -0,0 +1,20 @@ +using System; + +namespace Unity.BossRoom.Gameplay.GameplayObjects +{ + /// + /// Describes how the character's movement should be animated: as standing idle, running normally, + /// magically slowed, sped up, etc. (Not all statuses are currently used by game content, + /// but they are set up to be displayed correctly for future use.) + /// + [Serializable] + public enum MovementStatus + { + Idle, // not trying to move + Normal, // character is moving (normally) + Uncontrolled, // character is being moved by e.g. a knockback -- they are not in control! + Slowed, // character's movement is magically hindered + Hasted, // character's movement is magically enhanced + Walking, // character should appear to be "walking" rather than normal running (e.g. for cut-scenes) + } +} diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/MovementStatus.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/Character/MovementStatus.cs.meta new file mode 100644 index 000000000..2d88957c8 --- /dev/null +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/MovementStatus.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: aadf46e1502f4bd7aedbe077e9a4944f +timeCreated: 1662673589 \ No newline at end of file diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/NetworkAvatarGuidState.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/NetworkAvatarGuidState.cs index b2d2a23b5..6548f8937 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/NetworkAvatarGuidState.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/NetworkAvatarGuidState.cs @@ -1,9 +1,12 @@ using System; +using Unity.BossRoom.Gameplay.Configuration; +using Unity.BossRoom.Infrastructure; using Unity.Netcode; using UnityEngine; using UnityEngine.Serialization; +using Avatar = Unity.BossRoom.Gameplay.Configuration.Avatar; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.GameplayObjects.Character { /// /// NetworkBehaviour component to send/receive GUIDs from server to clients. @@ -14,8 +17,6 @@ public class NetworkAvatarGuidState : NetworkBehaviour [HideInInspector] public NetworkVariable AvatarGuid = new NetworkVariable(); - CharacterClassContainer m_CharacterClassContainer; - [SerializeField] AvatarRegistry m_AvatarRegistry; @@ -39,11 +40,6 @@ public void SetRandomAvatar() AvatarGuid.Value = m_AvatarRegistry.GetRandomAvatar().Guid.ToNetworkGuid(); } - void Awake() - { - m_CharacterClassContainer = GetComponent(); - } - void RegisterAvatar(Guid guid) { if (guid.Equals(Guid.Empty)) @@ -67,7 +63,10 @@ void RegisterAvatar(Guid guid) m_Avatar = avatar; - m_CharacterClassContainer.SetCharacterClass(avatar.CharacterClass); + if (TryGetComponent(out var serverCharacter)) + { + serverCharacter.CharacterClass = avatar.CharacterClass; + } } } } diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/NetworkCharacterTypeState.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/NetworkCharacterTypeState.cs deleted file mode 100644 index c1e4499b0..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/NetworkCharacterTypeState.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Unity.Netcode; -using UnityEngine; - -namespace Unity.Multiplayer.Samples.BossRoom -{ - /// - /// NetworkBehaviour containing only one NetworkVariable which represents this character's CharacterType. - /// - public class NetworkCharacterTypeState : NetworkBehaviour - { - [Tooltip("NPCs should set this value in their prefab. For players, this value is set at runtime.")] - public NetworkVariable CharacterType = new NetworkVariable(); - } -} diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/NetworkCharacterTypeState.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/Character/NetworkCharacterTypeState.cs.meta deleted file mode 100644 index 6b9bdfac6..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/NetworkCharacterTypeState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 082f826a48a1017479079f944dff718f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/PhysicsWrapper.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/PhysicsWrapper.cs index eb7ca6def..973fbd60a 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/PhysicsWrapper.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/PhysicsWrapper.cs @@ -3,7 +3,7 @@ using Unity.Netcode; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.GameplayObjects.Character { /// /// Wrapper class for direct references to components relevant to physics. diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/PlayerServerCharacter.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/PlayerServerCharacter.cs index 3910cd95e..3aed77deb 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/PlayerServerCharacter.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/PlayerServerCharacter.cs @@ -1,8 +1,11 @@ +using System; using System.Collections.Generic; +using Unity.BossRoom.ConnectionManagement; +using Unity.Multiplayer.Samples.BossRoom; using Unity.Netcode; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.GameplayObjects.Character { /// /// Attached to the player-characters' prefab, this maintains a list of active ServerCharacter objects for players. @@ -51,7 +54,7 @@ public override void OnNetworkDespawn() var playerData = sessionPlayerData.Value; playerData.PlayerPosition = movementTransform.position; playerData.PlayerRotation = movementTransform.rotation; - playerData.CurrentHitPoints = m_CachedServerCharacter.NetState.HitPoints; + playerData.CurrentHitPoints = m_CachedServerCharacter.HitPoints; playerData.HasCharacterSpawned = true; SessionManager.Instance.SetPlayerData(OwnerClientId, playerData); } diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerAnimationHandler.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerAnimationHandler.cs index 435fb9bb4..59e151550 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerAnimationHandler.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerAnimationHandler.cs @@ -1,10 +1,11 @@ using System; using System.Collections; +using Unity.BossRoom.Gameplay.Configuration; using Unity.Netcode; using Unity.Netcode.Components; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.GameplayObjects.Character { public class ServerAnimationHandler : NetworkBehaviour { diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerCharacter.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerCharacter.cs index f9a6ada0d..619ec9217 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerCharacter.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerCharacter.cs @@ -1,30 +1,111 @@ +using System; using System.Collections; -using Unity.Multiplayer.Samples.BossRoom.Actions; +using Unity.BossRoom.ConnectionManagement; +using Unity.BossRoom.Gameplay.Actions; +using Unity.BossRoom.Gameplay.Configuration; +using Unity.BossRoom.Gameplay.GameplayObjects.Character.AI; +using Unity.Multiplayer.Samples.BossRoom; using Unity.Netcode; using UnityEngine; +using UnityEngine.Serialization; +using Action = Unity.BossRoom.Gameplay.Actions.Action; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.GameplayObjects.Character { - public class ServerCharacter : NetworkBehaviour + /// + /// Contains all NetworkVariables, RPCs and server-side logic of a character. + /// This class was separated in two to keep client and server context self contained. This way you don't have to continuously ask yourself if code is running client or server side. + /// + [RequireComponent(typeof(NetworkHealthState), + typeof(NetworkLifeState), + typeof(NetworkAvatarGuidState))] + public class ServerCharacter : NetworkBehaviour, ITargetable { + [FormerlySerializedAs("m_ClientVisualization")] [SerializeField] - NetworkCharacterState m_NetworkCharacterState; + ClientCharacter m_ClientCharacter; - public NetworkCharacterState NetState => m_NetworkCharacterState; + public ClientCharacter clientCharacter => m_ClientCharacter; + + [SerializeField] + CharacterClass m_CharacterClass; + + public CharacterClass CharacterClass + { + get + { + if (m_CharacterClass == null) + { + m_CharacterClass = m_State.RegisteredAvatar.CharacterClass; + } + + return m_CharacterClass; + } + + set => m_CharacterClass = value; + } + + /// Indicates how the character's movement should be depicted. + public NetworkVariable MovementStatus { get; } = new NetworkVariable(); + + public NetworkVariable HeldNetworkObject { get; } = new NetworkVariable(); /// - /// Returns true if this Character is an NPC. + /// Indicates whether this character is in "stealth mode" (invisible to monsters and other players). /// - public bool IsNpc + public NetworkVariable IsStealthy { get; } = new NetworkVariable(); + + public NetworkHealthState NetHealthState { get; private set; } + + /// + /// The active target of this character. + /// + public NetworkVariable TargetId { get; } = new NetworkVariable(); + + /// + /// Current HP. This value is populated at startup time from CharacterClass data. + /// + public int HitPoints { - get { return NetState.IsNpc; } + get => NetHealthState.HitPoints.Value; + private set => NetHealthState.HitPoints.Value = value; } + public NetworkLifeState NetLifeState { get; private set; } + + /// + /// Current LifeState. Only Players should enter the FAINTED state. + /// + public LifeState LifeState + { + get => NetLifeState.LifeState.Value; + private set => NetLifeState.LifeState.Value = value; + } + + /// + /// Returns true if this Character is an NPC. + /// + public bool IsNpc => CharacterClass.IsNpc; + + public bool IsValidTarget => LifeState != LifeState.Dead; + + /// + /// Returns true if the Character is currently in a state where it can play actions, false otherwise. + /// + public bool CanPerformActions => LifeState == LifeState.Alive; + + /// + /// Character Type. This value is populated during character selection. + /// + public CharacterTypeEnum CharacterType => CharacterClass.CharacterType; + + private ServerActionPlayer m_ServerActionPlayer; + /// /// The Character's ActionPlayer. This is mainly exposed for use by other Actions. In particular, users are discouraged from /// calling 'PlayAction' directly on this, as the ServerCharacter has certain game-level checks it performs in its own wrapper. /// - public ServerActionPlayer ActionPlayer { get { return m_ServerActionPlayer; } } + public ServerActionPlayer ActionPlayer => m_ServerActionPlayer; [SerializeField] [Tooltip("If set to false, an NPC character will be denied its brain (won't attack or chase players)")] @@ -38,8 +119,6 @@ public bool IsNpc [Tooltip("If set, the ServerCharacter will automatically play the StartingAction when it is created. ")] private Action m_StartingAction; - private ServerActionPlayer m_ServerActionPlayer; - private AIBrain m_AIBrain; [SerializeField] DamageReceiver m_DamageReceiver; @@ -59,9 +138,15 @@ public bool IsNpc public ServerAnimationHandler serverAnimationHandler => m_ServerAnimationHandler; - private void Awake() + private AIBrain m_AIBrain; + NetworkAvatarGuidState m_State; + + void Awake() { m_ServerActionPlayer = new ServerActionPlayer(this); + NetLifeState = GetComponent(); + NetHealthState = GetComponent(); + m_State = GetComponent(); } public override void OnNetworkSpawn() @@ -69,14 +154,11 @@ public override void OnNetworkSpawn() if (!IsServer) { enabled = false; } else { - NetState.DoActionEventServer += OnActionPlayRequest; - NetState.ReceivedClientInput += OnClientMoveRequest; - NetState.OnStopChargingUpServer += OnStoppedChargingUp; - NetState.NetworkLifeState.LifeState.OnValueChanged += OnLifeStateChanged; - m_DamageReceiver.damageReceived += ReceiveHP; - m_DamageReceiver.collisionEntered += CollisionEntered; - - if (NetState.IsNpc) + NetLifeState.LifeState.OnValueChanged += OnLifeStateChanged; + m_DamageReceiver.DamageReceived += ReceiveHP; + m_DamageReceiver.CollisionEntered += CollisionEntered; + + if (IsNpc) { m_AIBrain = new AIBrain(this, m_ServerActionPlayer); } @@ -92,34 +174,82 @@ public override void OnNetworkSpawn() public override void OnNetworkDespawn() { - if (NetState) + NetLifeState.LifeState.OnValueChanged -= OnLifeStateChanged; + + if (m_DamageReceiver) { - NetState.DoActionEventServer -= OnActionPlayRequest; - NetState.ReceivedClientInput -= OnClientMoveRequest; - NetState.OnStopChargingUpServer -= OnStoppedChargingUp; - NetState.NetworkLifeState.LifeState.OnValueChanged -= OnLifeStateChanged; + m_DamageReceiver.DamageReceived -= ReceiveHP; + m_DamageReceiver.CollisionEntered -= CollisionEntered; } + } - if (m_DamageReceiver) + + /// + /// RPC to send inputs for this character from a client to a server. + /// + /// The position which this character should move towards. + [ServerRpc] + public void SendCharacterInputServerRpc(Vector3 movementTarget) + { + if (LifeState == LifeState.Alive && !m_Movement.IsPerformingForcedMovement()) + { + // if we're currently playing an interruptible action, interrupt it! + if (m_ServerActionPlayer.GetActiveActionInfo(out ActionRequestData data)) + { + if (GameDataSource.Instance.GetActionPrototypeByID(data.ActionID).Config.ActionInterruptible) + { + m_ServerActionPlayer.ClearActions(false); + } + } + + m_ServerActionPlayer.CancelRunningActionsByLogic(ActionLogic.Target, true); //clear target on move. + m_Movement.SetMovementTarget(movementTarget); + } + } + + // ACTION SYSTEM + + /// + /// Client->Server RPC that sends a request to play an action. + /// + /// Data about which action to play and its associated details. + [ServerRpc] + public void RecvDoActionServerRPC(ActionRequestData data) + { + ActionRequestData data1 = data; + if (!GameDataSource.Instance.GetActionPrototypeByID(data1.ActionID).Config.IsFriendly) { - m_DamageReceiver.damageReceived -= ReceiveHP; - m_DamageReceiver.collisionEntered -= CollisionEntered; + // notify running actions that we're using a new attack. (e.g. so Stealth can cancel itself) + ActionPlayer.OnGameplayActivity(Action.GameplayActivity.UsingAttackAction); } + + PlayAction(ref data1); + } + + // UTILITY AND SPECIAL-PURPOSE RPCs + + /// + /// Called on server when the character's client decides they have stopped "charging up" an attack. + /// + [ServerRpc] + public void RecvStopChargingUpServerRpc() + { + m_ServerActionPlayer.OnGameplayActivity(Action.GameplayActivity.StoppedChargingUp); } void InitializeHitPoints() { - NetState.HitPoints = NetState.CharacterClass.BaseHP.Value; + HitPoints = CharacterClass.BaseHP.Value; if (!IsNpc) { SessionPlayerData? sessionPlayerData = SessionManager.Instance.GetPlayerData(OwnerClientId); if (sessionPlayerData is { HasCharacterSpawned: true }) { - NetState.HitPoints = sessionPlayerData.Value.CurrentHitPoints; - if (NetState.HitPoints <= 0) + HitPoints = sessionPlayerData.Value.CurrentHitPoints; + if (HitPoints <= 0) { - NetState.LifeState = LifeState.Fainted; + LifeState = LifeState.Fainted; } } } @@ -131,7 +261,7 @@ void InitializeHitPoints() public void PlayAction(ref ActionRequestData action) { //the character needs to be alive in order to be able to play actions - if (NetState.LifeState == LifeState.Alive && !m_Movement.IsPerformingForcedMovement()) + if (LifeState == LifeState.Alive && !m_Movement.IsPerformingForcedMovement()) { if (action.CancelMovement) { @@ -142,25 +272,7 @@ public void PlayAction(ref ActionRequestData action) } } - private void OnClientMoveRequest(Vector3 targetPosition) - { - if (NetState.LifeState == LifeState.Alive && !m_Movement.IsPerformingForcedMovement()) - { - // if we're currently playing an interruptible action, interrupt it! - if (m_ServerActionPlayer.GetActiveActionInfo(out ActionRequestData data)) - { - if (GameDataSource.Instance.GetActionPrototypeByID(data.ActionID).Config.ActionInterruptible) - { - m_ServerActionPlayer.ClearActions(false); - } - } - - m_ServerActionPlayer.CancelRunningActionsByLogic(ActionLogic.Target, true); //clear target on move. - m_Movement.SetMovementTarget(targetPosition); - } - } - - private void OnLifeStateChanged(LifeState prevLifeState, LifeState lifeState) + void OnLifeStateChanged(LifeState prevLifeState, LifeState lifeState) { if (lifeState != LifeState.Alive) { @@ -169,17 +281,6 @@ private void OnLifeStateChanged(LifeState prevLifeState, LifeState lifeState) } } - private void OnActionPlayRequest(ActionRequestData data) - { - if (!GameDataSource.Instance.GetActionPrototypeByID(data.ActionID).Config.IsFriendly) - { - // notify running actions that we're using a new attack. (e.g. so Stealth can cancel itself) - ActionPlayer.OnGameplayActivity(Action.GameplayActivity.UsingAttackAction); - } - - PlayAction(ref data); - } - IEnumerator KilledDestroyProcess() { yield return new WaitForSeconds(m_KilledDestroyDelaySeconds); @@ -208,7 +309,7 @@ void ReceiveHP(ServerCharacter inflicter, int HP) { #if UNITY_EDITOR || DEVELOPMENT_BUILD // Don't apply damage if god mode is on - if (NetState.NetworkLifeState.IsGodMode.Value) + if (NetLifeState.IsGodMode.Value) { return; } @@ -221,7 +322,7 @@ void ReceiveHP(ServerCharacter inflicter, int HP) serverAnimationHandler.NetworkAnimator.SetTrigger("HitReact1"); } - NetState.HitPoints = Mathf.Clamp(NetState.HitPoints + HP, 0, NetState.CharacterClass.BaseHP.Value); + HitPoints = Mathf.Clamp(HitPoints + HP, 0, CharacterClass.BaseHP.Value); if (m_AIBrain != null) { @@ -231,20 +332,20 @@ void ReceiveHP(ServerCharacter inflicter, int HP) //we can't currently heal a dead character back to Alive state. //that's handled by a separate function. - if (NetState.HitPoints <= 0) + if (HitPoints <= 0) { if (IsNpc) { - if (m_KilledDestroyDelaySeconds >= 0.0f && NetState.LifeState != LifeState.Dead) + if (m_KilledDestroyDelaySeconds >= 0.0f && LifeState != LifeState.Dead) { StartCoroutine(KilledDestroyProcess()); } - NetState.LifeState = LifeState.Dead; + LifeState = LifeState.Dead; } else { - NetState.LifeState = LifeState.Fainted; + LifeState = LifeState.Fainted; } m_ServerActionPlayer.ClearActions(false); @@ -269,23 +370,23 @@ public float GetBuffedValue(Action.BuffableValue buffType) /// The HP to set to a newly revived character. public void Revive(ServerCharacter inflicter, int HP) { - if (NetState.LifeState == LifeState.Fainted) + if (LifeState == LifeState.Fainted) { - NetState.HitPoints = Mathf.Clamp(HP, 0, NetState.CharacterClass.BaseHP.Value); - NetState.NetworkLifeState.LifeState.Value = LifeState.Alive; + HitPoints = Mathf.Clamp(HP, 0, CharacterClass.BaseHP.Value); + NetLifeState.LifeState.Value = LifeState.Alive; } } void Update() { m_ServerActionPlayer.OnUpdate(); - if (m_AIBrain != null && NetState.LifeState == LifeState.Alive && m_BrainEnabled) + if (m_AIBrain != null && LifeState == LifeState.Alive && m_BrainEnabled) { m_AIBrain.Update(); } } - private void CollisionEntered(Collision collision) + void CollisionEntered(Collision collision) { if (m_ServerActionPlayer != null) { @@ -293,14 +394,10 @@ private void CollisionEntered(Collision collision) } } - private void OnStoppedChargingUp() - { - m_ServerActionPlayer.OnGameplayActivity(Action.GameplayActivity.StoppedChargingUp); - } - /// /// This character's AIBrain. Will be null if this is not an NPC. /// public AIBrain AIBrain { get { return m_AIBrain; } } + } } diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerCharacterMovement.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerCharacterMovement.cs index 844b0d26f..5fb40a57b 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerCharacterMovement.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerCharacterMovement.cs @@ -1,9 +1,12 @@ +using System; +using Unity.BossRoom.Gameplay.Configuration; +using Unity.BossRoom.Navigation; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Assertions; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.GameplayObjects.Character { public enum MovementState { @@ -25,9 +28,6 @@ public class ServerCharacterMovement : NetworkBehaviour [SerializeField] Rigidbody m_Rigidbody; - [SerializeField] - NetworkCharacterState m_NetworkCharacterState; - private NavigationSystem m_NavigationSystem; private DynamicNavPath m_NavPath; @@ -174,7 +174,7 @@ private void FixedUpdate() var currentState = GetMovementStatus(m_MovementState); if (m_PreviousState != currentState) { - m_NetworkCharacterState.MovementStatus.Value = currentState; + m_CharLogic.MovementStatus.Value = currentState; m_PreviousState = currentState; } } @@ -257,8 +257,8 @@ private float GetBaseMovementSpeed() return k_CheatSpeed; } #endif - CharacterClass characterClass = GameDataSource.Instance.CharacterDataByType[m_CharLogic.NetState.CharacterType]; - Assert.IsNotNull(characterClass, $"No CharacterClass data for character type {m_CharLogic.NetState.CharacterType}"); + CharacterClass characterClass = GameDataSource.Instance.CharacterDataByType[m_CharLogic.CharacterType]; + Assert.IsNotNull(characterClass, $"No CharacterClass data for character type {m_CharLogic.CharacterType}"); return characterClass.Speed; } diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ClientBreakableVisualization.cs b/Assets/Scripts/Gameplay/GameplayObjects/ClientBreakableVisualization.cs deleted file mode 100644 index 77bfb8c0b..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/ClientBreakableVisualization.cs +++ /dev/null @@ -1,110 +0,0 @@ -using Unity.Netcode; -using UnityEngine; - -namespace Unity.Multiplayer.Samples.BossRoom.Visual -{ - /// - /// Visualization class for Breakables. Breakables work by swapping a "broken" prefab at the moment of breakage. The broken prefab - /// then handles the pesky details of actually falling apart. - /// - public class ClientBreakableVisualization : NetworkBehaviour - { - [SerializeField] - private GameObject m_BrokenPrefab; - - [SerializeField] - [Tooltip("If set, will be used instead of BrokenPrefab when new players join, skipping transition effects.")] - private GameObject m_PrebrokenPrefab; - - [SerializeField] - [Tooltip("We use this transform's position and rotation when creating the prefab. (Defaults to self)")] - private Transform m_BrokenPrefabPos; - - [SerializeField] - private GameObject[] m_UnbrokenGameObjects; - - [SerializeField] - private NetworkBreakableState m_NetState; - - private GameObject m_CurrentBrokenVisualization; - - public override void OnNetworkSpawn() - { - if (!IsClient) - { - enabled = false; - } - else - { - m_NetState.IsBroken.OnValueChanged += OnBreakableStateChanged; - - if (m_NetState.IsBroken.Value == true) - { - PerformBreak(true); - } - - } - } - - private void OnBreakableStateChanged(bool wasBroken, bool isBroken) - { - if (!wasBroken && isBroken) - { - PerformBreak(false); - } - else if (wasBroken && !isBroken) - { - PerformUnbreak(); - } - } - - public override void OnNetworkDespawn() - { - if (m_NetState) - { - m_NetState.IsBroken.OnValueChanged -= OnBreakableStateChanged; - } - } - - private void PerformBreak(bool onStart) - { - foreach (var gameObject in m_UnbrokenGameObjects) - { - if (gameObject) - gameObject.SetActive(false); - } - - if (m_CurrentBrokenVisualization) - Destroy(m_CurrentBrokenVisualization); // just a safety check, should be null when we get here - - GameObject brokenPrefab = (onStart && m_PrebrokenPrefab != null) ? m_PrebrokenPrefab : m_BrokenPrefab; - if (brokenPrefab) - { - m_CurrentBrokenVisualization = Instantiate(brokenPrefab, m_BrokenPrefabPos.position, m_BrokenPrefabPos.rotation, transform); - } - } - - private void PerformUnbreak() - { - if (m_CurrentBrokenVisualization) - { - Destroy(m_CurrentBrokenVisualization); - } - foreach (var gameObject in m_UnbrokenGameObjects) - { - if (gameObject) - gameObject.SetActive(true); - } - } - -#if UNITY_EDITOR - private void OnValidate() - { - if (!m_NetState) - m_NetState = GetComponent(); - if (!m_BrokenPrefabPos) - m_BrokenPrefabPos = transform; - } -#endif - } -} diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ClientBreakableVisualization.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/ClientBreakableVisualization.cs.meta deleted file mode 100644 index a3c725f79..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/ClientBreakableVisualization.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 53ee998b78e989840b42284bf1b455ad -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ClientDoorVisualization.cs b/Assets/Scripts/Gameplay/GameplayObjects/ClientDoorVisualization.cs deleted file mode 100644 index 3d9ca33bc..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/ClientDoorVisualization.cs +++ /dev/null @@ -1,63 +0,0 @@ -using Unity.Multiplayer.Samples.BossRoom.Server; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; -using Unity.Netcode; -using UnityEngine; -using VContainer; - -namespace Unity.Multiplayer.Samples.BossRoom.Client -{ - /// - /// Represents a door in the client. The visuals of the door animate as - /// "opening" and "closing", but for physics purposes this is an illusion: - /// whenever the door is open on the server, the door's physics are disabled, - /// and vice versa. - /// - [RequireComponent(typeof(NetworkDoorState))] - public class ClientDoorVisualization : NetworkBehaviour - { - [SerializeField] - [Tooltip("This physics and navmesh obstacle is enabled when the door is closed.")] - GameObject m_PhysicsObject; - - [SerializeField] - NetworkDoorState m_DoorState; - - [Inject] - IPublisher m_Publisher; - - public override void OnNetworkSpawn() - { - if (!IsClient) - { - enabled = false; - } - else - { - m_DoorState.IsOpen.OnValueChanged += OnDoorStateChanged; - - // initialize visuals based on current server state (or else we default to "closed") - m_PhysicsObject.SetActive(!m_DoorState.IsOpen.Value); - - var gameState = FindObjectOfType(); - if (gameState != null) - { - gameState.Container.Inject(this); - } - } - } - - public override void OnNetworkDespawn() - { - if (m_DoorState) - { - m_DoorState.IsOpen.OnValueChanged -= OnDoorStateChanged; - } - } - - void OnDoorStateChanged(bool wasDoorOpen, bool isDoorOpen) - { - m_PhysicsObject.SetActive(!isDoorOpen); - m_Publisher?.Publish(new DoorStateChangedEventMessage() { IsDoorOpen = isDoorOpen }); - } - } -} diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ClientDoorVisualization.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/ClientDoorVisualization.cs.meta deleted file mode 100644 index 79bee5913..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/ClientDoorVisualization.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c9f71c13463198a4bb7ab269b0241148 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ClientProjectileVisualization.cs b/Assets/Scripts/Gameplay/GameplayObjects/ClientProjectileVisualization.cs deleted file mode 100644 index ce24d450b..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/ClientProjectileVisualization.cs +++ /dev/null @@ -1,95 +0,0 @@ -using Unity.Netcode; -using UnityEngine; - -namespace Unity.Multiplayer.Samples.BossRoom.Visual -{ - public class ClientProjectileVisualization : NetworkBehaviour - { - [SerializeField] - [Tooltip("Explosion prefab used when projectile hits enemy. This should have a fixed duration.")] - SpecialFXGraphic m_OnHitParticlePrefab; - - [SerializeField] - TrailRenderer m_TrailRenderer; - - NetworkProjectileState m_NetState; - - Transform m_Parent; - - const float k_LerpTime = 0.1f; - - PositionLerper m_PositionLerper; - - public override void OnNetworkSpawn() - { - if (!IsClient || transform.parent == null) - { - enabled = false; - return; - } - - m_TrailRenderer.Clear(); - - m_Parent = transform.parent; - transform.parent = null; - m_NetState = m_Parent.GetComponent(); - m_NetState.HitEnemyEvent += OnEnemyHit; - - m_PositionLerper = new PositionLerper(m_Parent.position, k_LerpTime); - transform.rotation = m_Parent.transform.rotation; - } - - public override void OnNetworkDespawn() - { - m_TrailRenderer.Clear(); - - if (m_NetState != null) - { - transform.parent = m_Parent; - m_NetState.HitEnemyEvent -= OnEnemyHit; - } - } - - void Update() - { - if (m_Parent == null) - { - Destroy(gameObject); - return; - } - - // One thing to note: this graphics GameObject is detached from its parent on OnNetworkSpawn. On the host, - // the m_Parent Transform is translated via ServerProjectileLogic's FixedUpdate method. On all other - // clients, m_Parent's NetworkTransform handles syncing and interpolating the m_Parent Transform. Thus, to - // eliminate any visual jitter on the host, this GameObject is positionally smoothed over time. On all other - // clients, no positional smoothing is required, since m_Parent's NetworkTransform will perform - // positional interpolation on its Update method, and so this position is simply matched 1:1 with m_Parent. - - if (IsHost) - { - transform.position = m_PositionLerper.LerpPosition(transform.position, - m_Parent.transform.position); - } - else - { - transform.position = m_Parent.position; - } - } - - void OnEnemyHit(ulong enemyId) - { - //in the future we could do quite fancy things, like deparenting the Graphics Arrow and parenting it to the target. - //For the moment we play some particles (optionally), and cause the target to animate a hit-react. - - NetworkObject targetNetObject; - if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(enemyId, out targetNetObject)) - { - if (m_OnHitParticlePrefab) - { - // show an impact graphic - Instantiate(m_OnHitParticlePrefab.gameObject, transform.position, transform.rotation); - } - } - } - } -} diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ClientProjectileVisualization.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/ClientProjectileVisualization.cs.meta deleted file mode 100644 index 19c1ba103..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/ClientProjectileVisualization.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a45006257d512344ba116bae366f7757 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ClientTossedItemVisualizer.cs b/Assets/Scripts/Gameplay/GameplayObjects/ClientTossedItemVisualizer.cs deleted file mode 100644 index 9db2e5a68..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/ClientTossedItemVisualizer.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using Unity.Netcode; -using UnityEngine; - -namespace Unity.Multiplayer.Samples.BossRoom.Client -{ - public class ClientTossedItemVisualizer : NetworkBehaviour - { - [SerializeField] - Transform m_TossedItemVisualTransform; - - const float k_DisplayHeight = 0.1f; - - readonly Quaternion k_TossAttackRadiusDisplayRotation = Quaternion.Euler(90f, 0f, 0f); - - [SerializeField] - GameObject m_TossedObjectGraphics; - - [SerializeField] - AudioSource m_FallingSound; - - void Awake() - { - enabled = false; - } - - public override void OnNetworkSpawn() - { - if (!IsClient) - { - return; - } - - enabled = true; - m_TossedItemVisualTransform.gameObject.SetActive(true); - m_TossedObjectGraphics.SetActive(true); - m_FallingSound.Play(); - } - - public override void OnNetworkDespawn() - { - m_TossedItemVisualTransform.gameObject.SetActive(false); - } - - void LateUpdate() - { - var tossedItemPosition = transform.position; - m_TossedItemVisualTransform.SetPositionAndRotation( - new Vector3(tossedItemPosition.x, k_DisplayHeight, tossedItemPosition.z), - k_TossAttackRadiusDisplayRotation); - } - } -} diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ClientTossedItemVisualizer.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/ClientTossedItemVisualizer.cs.meta deleted file mode 100644 index 104b3c034..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/ClientTossedItemVisualizer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2f9ce43d3a12cc143a792bd3006335bf -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/GameplayObjects/DamageReceiver.cs b/Assets/Scripts/Gameplay/GameplayObjects/DamageReceiver.cs index 4892c749a..cc4e95c6c 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/DamageReceiver.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/DamageReceiver.cs @@ -1,14 +1,15 @@ using System; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.Netcode; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.GameplayObjects { public class DamageReceiver : NetworkBehaviour, IDamageable { - public event Action damageReceived; + public event Action DamageReceived; - public event Action collisionEntered; + public event Action CollisionEntered; [SerializeField] NetworkLifeState m_NetworkLifeState; @@ -17,7 +18,7 @@ public void ReceiveHP(ServerCharacter inflicter, int HP) { if (IsDamageable()) { - damageReceived?.Invoke(inflicter, HP); + DamageReceived?.Invoke(inflicter, HP); } } @@ -33,7 +34,7 @@ public bool IsDamageable() void OnCollisionEnter(Collision other) { - collisionEntered?.Invoke(other); + CollisionEntered?.Invoke(other); } } } diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ServerEnemyPortal.cs b/Assets/Scripts/Gameplay/GameplayObjects/EnemyPortal.cs similarity index 86% rename from Assets/Scripts/Gameplay/GameplayObjects/ServerEnemyPortal.cs rename to Assets/Scripts/Gameplay/GameplayObjects/EnemyPortal.cs index 441090b8d..399c5d1a8 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/ServerEnemyPortal.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/EnemyPortal.cs @@ -5,7 +5,7 @@ using UnityEngine; using UnityEngine.Assertions; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.GameplayObjects { /// /// ServerEnemyPortal is a stationary dungeon element that spawns monsters when a player is @@ -20,20 +20,28 @@ namespace Unity.Multiplayer.Samples.BossRoom.Server /// the portal itself (a glowy visual effect stops when Broken, turns back on when unbroken) /// [RequireComponent(typeof(ServerWaveSpawner))] - [RequireComponent(typeof(NetworkBreakableState))] - public class ServerEnemyPortal : NetworkBehaviour + public class EnemyPortal : NetworkBehaviour, ITargetable { [SerializeField] [Tooltip("Portal becomes dormant when ALL of these breakables are broken")] - public List m_BreakableElements; + public List m_BreakableElements; [SerializeField] [Tooltip("When all breakable elements are broken, wait this long before respawning them (and reactivating)")] float m_DormantCooldown; + + /// + /// Is the item broken or not? + /// + public NetworkVariable IsBroken; + + public bool IsNpc { get { return true; } } + + public bool IsValidTarget { get { return !IsBroken.Value; } } + // cached reference to our components ServerWaveSpawner m_WaveSpawner; - NetworkBreakableState m_State; // currently active "wait X seconds and then restart" coroutine Coroutine m_CoroDormant; @@ -41,7 +49,6 @@ public class ServerEnemyPortal : NetworkBehaviour private void Awake() { m_WaveSpawner = GetComponent(); - m_State = GetComponent(); } public override void OnNetworkSpawn() @@ -90,7 +97,7 @@ private void MaintainState() } } - m_State.IsBroken.Value = !hasUnbrokenBreakables; + IsBroken.Value = !hasUnbrokenBreakables; m_WaveSpawner.SetSpawnerEnabled(hasUnbrokenBreakables); if (!hasUnbrokenBreakables && m_CoroDormant == null) { @@ -111,13 +118,13 @@ void Restart() { if (state) { - var serverComponent = state.GetComponent(); + var serverComponent = state.GetComponent(); Assert.IsNotNull(serverComponent); serverComponent.Unbreak(); } } - m_State.IsBroken.Value = false; + IsBroken.Value = false; m_WaveSpawner.SetSpawnerEnabled(true); m_CoroDormant = null; } @@ -138,7 +145,7 @@ public void ForceDestroy() { if (state) { - var serverComponent = state.GetComponent(); + var serverComponent = state.GetComponent(); Assert.IsNotNull(serverComponent); serverComponent.ReceiveHP(null, Int32.MinValue); } diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ServerEnemyPortal.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/EnemyPortal.cs.meta similarity index 100% rename from Assets/Scripts/Gameplay/GameplayObjects/ServerEnemyPortal.cs.meta rename to Assets/Scripts/Gameplay/GameplayObjects/EnemyPortal.cs.meta diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ServerFloorSwitch.cs b/Assets/Scripts/Gameplay/GameplayObjects/FloorSwitch.cs similarity index 78% rename from Assets/Scripts/Gameplay/GameplayObjects/ServerFloorSwitch.cs rename to Assets/Scripts/Gameplay/GameplayObjects/FloorSwitch.cs index 6f99bdb46..3dc9579b6 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/ServerFloorSwitch.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/FloorSwitch.cs @@ -1,15 +1,16 @@ +using System; using System.Collections.Generic; using Unity.Netcode; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.GameplayObjects { /// /// Server-side logic for a floor switch (a/k/a "pressure plate"). /// This script should be attached to a physics trigger. /// - [RequireComponent(typeof(Collider)), RequireComponent(typeof(NetworkFloorSwitchState))] - public class ServerFloorSwitch : NetworkBehaviour + [RequireComponent(typeof(Collider))] + public class FloorSwitch : NetworkBehaviour { [SerializeField] Animator m_Animator; @@ -17,8 +18,7 @@ public class ServerFloorSwitch : NetworkBehaviour [SerializeField] Collider m_Collider; - [SerializeField] - NetworkFloorSwitchState m_FloorSwitchState; + public NetworkVariable IsSwitchedOn { get; } = new NetworkVariable(); List m_RelevantCollidersInTrigger = new List(); @@ -39,9 +39,9 @@ public override void OnNetworkSpawn() enabled = false; } - FloorSwitchStateChanged(false, m_FloorSwitchState.IsSwitchedOn.Value); + FloorSwitchStateChanged(false, IsSwitchedOn.Value); - m_FloorSwitchState.IsSwitchedOn.OnValueChanged += FloorSwitchStateChanged; + IsSwitchedOn.OnValueChanged += FloorSwitchStateChanged; } void OnTriggerEnter(Collider other) @@ -61,7 +61,7 @@ void FixedUpdate() // In this case, OnTriggerExit() won't get called for them! We can tell if a Collider was destroyed // because its reference will become null. So here we remove any nulls and see if we're still active. m_RelevantCollidersInTrigger.RemoveAll(col => col == null); - m_FloorSwitchState.IsSwitchedOn.Value = m_RelevantCollidersInTrigger.Count > 0; + IsSwitchedOn.Value = m_RelevantCollidersInTrigger.Count > 0; } void FloorSwitchStateChanged(bool previousValue, bool newValue) diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ServerFloorSwitch.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/FloorSwitch.cs.meta similarity index 100% rename from Assets/Scripts/Gameplay/GameplayObjects/ServerFloorSwitch.cs.meta rename to Assets/Scripts/Gameplay/GameplayObjects/FloorSwitch.cs.meta diff --git a/Assets/Scripts/Gameplay/GameplayObjects/IDamageable.cs b/Assets/Scripts/Gameplay/GameplayObjects/IDamageable.cs index 0c93fce94..bb2d8bb8e 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/IDamageable.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/IDamageable.cs @@ -1,7 +1,8 @@ using System; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.GameplayObjects { /// /// Generic interface for damageable objects in the game. This includes ServerCharacter, as well as other things like diff --git a/Assets/Scripts/Gameplay/GameplayObjects/INetMovement.cs b/Assets/Scripts/Gameplay/GameplayObjects/INetMovement.cs deleted file mode 100644 index c469017f8..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/INetMovement.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Unity.Netcode; -using UnityEngine; - -namespace Unity.Multiplayer.Samples.BossRoom -{ - /// - /// This is a temporary abstraction for different shared network states that all handle movement. This - /// way a single client-side component can be used to update the local client transform. This can be dispensed with - /// once Netcode for GameObjects handles client-side movement internally. - /// - public interface INetMovement - { - /// - /// The current transform position of this entity. - /// - public NetworkVariable NetworkPosition { get; } - - /// - /// The networked rotation of this entity. This reflects the authorative rotation on the server. - /// - public NetworkVariable NetworkRotationY { get; } - - /// - /// The current speed of this entity in m/s. - /// - public NetworkVariable NetworkMovementSpeed { get; } - - public void InitNetworkPositionAndRotationY(Vector3 initPosition, float initRotationY); - } -} diff --git a/Assets/Scripts/Gameplay/GameplayObjects/INetMovement.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/INetMovement.cs.meta deleted file mode 100644 index a6139bc98..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/INetMovement.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 78efa3790f04bfc4881be8ad222217d4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ITargetable.cs b/Assets/Scripts/Gameplay/GameplayObjects/ITargetable.cs index e81ebb718..406b07d6a 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/ITargetable.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/ITargetable.cs @@ -1,4 +1,6 @@ -namespace Unity.Multiplayer.Samples.BossRoom +using System; + +namespace Unity.BossRoom.Gameplay.GameplayObjects { /// /// Entities that are Targetable by Skills should have their shared NetworkState component implement this interface. diff --git a/Assets/Scripts/Gameplay/GameplayObjects/NetworkBreakableState.cs b/Assets/Scripts/Gameplay/GameplayObjects/NetworkBreakableState.cs deleted file mode 100644 index ef7ee76bf..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/NetworkBreakableState.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Unity.Netcode; - -namespace Unity.Multiplayer.Samples.BossRoom -{ - /// - /// Shared Network logic for breakable items. - /// - public class NetworkBreakableState : NetworkBehaviour, ITargetable - { - /// - /// Is the item broken or not? - /// - public NetworkVariable IsBroken; - - public bool IsNpc { get { return true; } } - - public bool IsValidTarget { get { return !IsBroken.Value; } } - } - -} - diff --git a/Assets/Scripts/Gameplay/GameplayObjects/NetworkBreakableState.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/NetworkBreakableState.cs.meta deleted file mode 100644 index b15441e02..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/NetworkBreakableState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 07cb03f8b4d75ed4abb9801aa531be91 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/GameplayObjects/NetworkCharacterState.cs b/Assets/Scripts/Gameplay/GameplayObjects/NetworkCharacterState.cs deleted file mode 100644 index 657863ec6..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/NetworkCharacterState.cs +++ /dev/null @@ -1,205 +0,0 @@ -using System; -using Unity.Multiplayer.Samples.BossRoom.Actions; -using Unity.Netcode; -using UnityEngine; - -namespace Unity.Multiplayer.Samples.BossRoom -{ - public enum LifeState - { - Alive, - Fainted, - Dead, - } - - /// - /// Describes how the character's movement should be animated: as standing idle, running normally, - /// magically slowed, sped up, etc. (Not all statuses are currently used by game content, - /// but they are set up to be displayed correctly for future use.) - /// - [Serializable] - public enum MovementStatus - { - Idle, // not trying to move - Normal, // character is moving (normally) - Uncontrolled, // character is being moved by e.g. a knockback -- they are not in control! - Slowed, // character's movement is magically hindered - Hasted, // character's movement is magically enhanced - Walking, // character should appear to be "walking" rather than normal running (e.g. for cut-scenes) - } - - /// - /// Contains all NetworkVariables and RPCs of a character. This component is present on both client and server objects. - /// - [RequireComponent(typeof(NetworkHealthState), typeof(NetworkLifeState))] - public class NetworkCharacterState : NetworkBehaviour, ITargetable - { - /// Indicates how the character's movement should be depicted. - public NetworkVariable MovementStatus { get; } = new NetworkVariable(); - - public NetworkVariable heldNetworkObject; - - /// - /// Indicates whether this character is in "stealth mode" (invisible to monsters and other players). - /// - public NetworkVariable IsStealthy { get; } = new NetworkVariable(); - - [SerializeField] - NetworkHealthState m_NetworkHealthState; - - public NetworkHealthState HealthState - { - get - { - return m_NetworkHealthState; - } - } - - /// - /// The active target of this character. - /// - public NetworkVariable TargetId { get; } = new NetworkVariable(); - - /// - /// Current HP. This value is populated at startup time from CharacterClass data. - /// - public int HitPoints - { - get { return m_NetworkHealthState.HitPoints.Value; } - set { m_NetworkHealthState.HitPoints.Value = value; } - } - - [SerializeField] - NetworkLifeState m_NetworkLifeState; - - public NetworkLifeState NetworkLifeState => m_NetworkLifeState; - - /// - /// Current LifeState. Only Players should enter the FAINTED state. - /// - public LifeState LifeState - { - get => m_NetworkLifeState.LifeState.Value; - set => m_NetworkLifeState.LifeState.Value = value; - } - - /// - /// Returns true if this Character is an NPC. - /// - public bool IsNpc { get { return CharacterClass.IsNpc; } } - - public bool IsValidTarget => LifeState != LifeState.Dead; - - /// - /// Returns true if the Character is currently in a state where it can play actions, false otherwise. - /// - public bool CanPerformActions => LifeState == LifeState.Alive; - - [SerializeField] - CharacterClassContainer m_CharacterClassContainer; - - /// - /// The CharacterData object associated with this Character. This is the static game data that defines its attack skills, HP, etc. - /// - public CharacterClass CharacterClass => m_CharacterClassContainer.CharacterClass; - - /// - /// Character Type. This value is populated during character selection. - /// - public CharacterTypeEnum CharacterType => m_CharacterClassContainer.CharacterClass.CharacterType; - - /// - /// Gets invoked when inputs are received from the client which own this networked character. - /// - public event Action ReceivedClientInput; - - /// - /// RPC to send inputs for this character from a client to a server. - /// - /// The position which this character should move towards. - [ServerRpc] - public void SendCharacterInputServerRpc(Vector3 movementTarget) - { - ReceivedClientInput?.Invoke(movementTarget); - } - - // ACTION SYSTEM - - /// - /// This event is raised on the server when an action request arrives - /// - public event Action DoActionEventServer; - - /// - /// This event is raised on the client when an action is being played back. - /// - public event Action DoActionEventClient; - - /// - /// This event is raised on the client when the active action FXs need to be cancelled (e.g. when the character has been stunned) - /// - public event System.Action CancelAllActionsEventClient; - - /// - /// This event is raised on the client when active action FXs of a certain type need to be cancelled (e.g. when the Stealth action ends) - /// - public event Action CancelActionsByPrototypeIDEventClient; - - /// - /// /// Server to Client RPC that broadcasts this action play to all clients. - /// - /// Data about which action to play and its associated details. - [ClientRpc] - public void RecvDoActionClientRPC(ActionRequestData data) - { - DoActionEventClient?.Invoke(data); - } - - [ClientRpc] - public void RecvCancelAllActionsClientRpc() - { - CancelAllActionsEventClient?.Invoke(); - } - - [ClientRpc] - public void RecvCancelActionsByPrototypeIDClientRpc(ActionID actionPrototypeID) - { - CancelActionsByPrototypeIDEventClient?.Invoke(actionPrototypeID); - } - - /// - /// Client->Server RPC that sends a request to play an action. - /// - /// Data about which action to play and its associated details. - [ServerRpc] - public void RecvDoActionServerRPC(ActionRequestData data) - { - DoActionEventServer?.Invoke(data); - } - - // UTILITY AND SPECIAL-PURPOSE RPCs - - /// - /// Called on server when the character's client decides they have stopped "charging up" an attack. - /// - public event System.Action OnStopChargingUpServer; - - /// - /// Called on all clients when this character has stopped "charging up" an attack. - /// Provides a value between 0 and 1 inclusive which indicates how "charged up" the attack ended up being. - /// - public event Action OnStopChargingUpClient; - - [ServerRpc] - public void RecvStopChargingUpServerRpc() - { - OnStopChargingUpServer?.Invoke(); - } - - [ClientRpc] - public void RecvStopChargingUpClientRpc(float percentCharged) - { - OnStopChargingUpClient?.Invoke(percentCharged); - } - } -} diff --git a/Assets/Scripts/Gameplay/GameplayObjects/NetworkCharacterState.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/NetworkCharacterState.cs.meta deleted file mode 100644 index afec0c819..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/NetworkCharacterState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: edb78c1621dad5149bb47b96120d3fbf -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/GameplayObjects/NetworkDoorState.cs b/Assets/Scripts/Gameplay/GameplayObjects/NetworkDoorState.cs deleted file mode 100644 index 1ac567381..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/NetworkDoorState.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Unity.Netcode; - -namespace Unity.Multiplayer.Samples.BossRoom -{ - public class NetworkDoorState : NetworkBehaviour - { - /// - /// Network state for a door which can be opened by pressing on a floor switch - /// - public NetworkVariable IsOpen { get; } = new NetworkVariable(); - } -} diff --git a/Assets/Scripts/Gameplay/GameplayObjects/NetworkDoorState.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/NetworkDoorState.cs.meta deleted file mode 100644 index b12b00ec7..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/NetworkDoorState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 012e73faa11cbe24987c752e542cbf1c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/GameplayObjects/NetworkFloorSwitchState.cs b/Assets/Scripts/Gameplay/GameplayObjects/NetworkFloorSwitchState.cs deleted file mode 100644 index 9eec63776..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/NetworkFloorSwitchState.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Unity.Netcode; - -namespace Unity.Multiplayer.Samples.BossRoom -{ - /// - /// Describes the state of a floor-switch (a/k/a "pressure plate") - /// - public class NetworkFloorSwitchState : NetworkBehaviour - { - public NetworkVariable IsSwitchedOn { get; } = new NetworkVariable(); - } -} diff --git a/Assets/Scripts/Gameplay/GameplayObjects/NetworkFloorSwitchState.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/NetworkFloorSwitchState.cs.meta deleted file mode 100644 index 90fec8fa1..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/NetworkFloorSwitchState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d761b7be955d370428f1b3a33b7f15ad -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/GameplayObjects/NetworkHealthState.cs b/Assets/Scripts/Gameplay/GameplayObjects/NetworkHealthState.cs index 0df6ceee1..339cbbd00 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/NetworkHealthState.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/NetworkHealthState.cs @@ -2,7 +2,7 @@ using Unity.Netcode; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.GameplayObjects { /// /// MonoBehaviour containing only one NetworkVariableInt which represents this object's health. @@ -13,10 +13,10 @@ public class NetworkHealthState : NetworkBehaviour public NetworkVariable HitPoints = new NetworkVariable(); // public subscribable event to be invoked when HP has been fully depleted - public event Action hitPointsDepleted; + public event Action HitPointsDepleted; // public subscribable event to be invoked when HP has been replenished - public event Action hitPointsReplenished; + public event Action HitPointsReplenished; void OnEnable() { @@ -33,12 +33,12 @@ void HitPointsChanged(int previousValue, int newValue) if (previousValue > 0 && newValue <= 0) { // newly reached 0 HP - hitPointsDepleted?.Invoke(); + HitPointsDepleted?.Invoke(); } else if (previousValue <= 0 && newValue > 0) { // newly revived - hitPointsReplenished?.Invoke(); + HitPointsReplenished?.Invoke(); } } } diff --git a/Assets/Scripts/Gameplay/GameplayObjects/NetworkLifeState.cs b/Assets/Scripts/Gameplay/GameplayObjects/NetworkLifeState.cs index d6d61e200..4ca7af80b 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/NetworkLifeState.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/NetworkLifeState.cs @@ -1,15 +1,23 @@ +using System; using Unity.Netcode; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.GameplayObjects { + public enum LifeState + { + Alive, + Fainted, + Dead, + } + /// /// MonoBehaviour containing only one NetworkVariable of type LifeState which represents this object's life state. /// public class NetworkLifeState : NetworkBehaviour { [SerializeField] - NetworkVariable m_LifeState = new NetworkVariable(BossRoom.LifeState.Alive); + NetworkVariable m_LifeState = new NetworkVariable(GameplayObjects.LifeState.Alive); public NetworkVariable LifeState => m_LifeState; diff --git a/Assets/Scripts/Gameplay/GameplayObjects/NetworkProjectileState.cs b/Assets/Scripts/Gameplay/GameplayObjects/NetworkProjectileState.cs deleted file mode 100644 index a88545a80..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/NetworkProjectileState.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Unity.Netcode; - -namespace Unity.Multiplayer.Samples.BossRoom -{ - /// - /// Shared state for a Projectile. - /// - public class NetworkProjectileState : NetworkBehaviour - { - /// - /// This event is raised when the arrow hit an enemy. The argument is the NetworkObjectId of the enemy. - /// - public System.Action HitEnemyEvent; - - [ClientRpc] - public void RecvHitEnemyClientRPC(ulong enemyId) - { - HitEnemyEvent?.Invoke(enemyId); - } - } -} diff --git a/Assets/Scripts/Gameplay/GameplayObjects/NetworkProjectileState.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/NetworkProjectileState.cs.meta deleted file mode 100644 index 1676e7195..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/NetworkProjectileState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9f1775357f78b684294a25ef49f1a97d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/GameplayObjects/PersistentPlayer.cs b/Assets/Scripts/Gameplay/GameplayObjects/PersistentPlayer.cs index 4f8accf02..12a4e31f2 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/PersistentPlayer.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/PersistentPlayer.cs @@ -1,7 +1,12 @@ +using System; +using Unity.BossRoom.ConnectionManagement; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.Utils; +using Unity.Multiplayer.Samples.BossRoom; using Unity.Netcode; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.GameplayObjects { /// /// NetworkBehaviour that represents a player connection and is the "Default Player Prefab" inside Netcode for diff --git a/Assets/Scripts/Gameplay/GameplayObjects/PickUpState.cs b/Assets/Scripts/Gameplay/GameplayObjects/PickUpState.cs index 0f7287090..9415dee3f 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/PickUpState.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/PickUpState.cs @@ -1,6 +1,7 @@ +using System; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.GameplayObjects { /// /// Shared Network logic for targetable, NPC, pickup objects. diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Missiles.meta b/Assets/Scripts/Gameplay/GameplayObjects/Projectiles.meta similarity index 100% rename from Assets/Scripts/Gameplay/GameplayObjects/Missiles.meta rename to Assets/Scripts/Gameplay/GameplayObjects/Projectiles.meta diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Missiles/FXProjectile.cs b/Assets/Scripts/Gameplay/GameplayObjects/Projectiles/FXProjectile.cs similarity index 98% rename from Assets/Scripts/Gameplay/GameplayObjects/Missiles/FXProjectile.cs rename to Assets/Scripts/Gameplay/GameplayObjects/Projectiles/FXProjectile.cs index f3bf03e14..12a986372 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Missiles/FXProjectile.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Projectiles/FXProjectile.cs @@ -1,7 +1,8 @@ +using System; using System.Collections.Generic; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.GameplayObjects { /// /// Logic that handles an FX-based pretend-missile. diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Missiles/FXProjectile.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/Projectiles/FXProjectile.cs.meta similarity index 100% rename from Assets/Scripts/Gameplay/GameplayObjects/Missiles/FXProjectile.cs.meta rename to Assets/Scripts/Gameplay/GameplayObjects/Projectiles/FXProjectile.cs.meta diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ServerProjectileLogic.cs b/Assets/Scripts/Gameplay/GameplayObjects/Projectiles/PhysicsProjectile.cs similarity index 58% rename from Assets/Scripts/Gameplay/GameplayObjects/ServerProjectileLogic.cs rename to Assets/Scripts/Gameplay/GameplayObjects/Projectiles/PhysicsProjectile.cs index 6b1539910..34ae2792a 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/ServerProjectileLogic.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Projectiles/PhysicsProjectile.cs @@ -1,17 +1,21 @@ +using System; using System.Collections.Generic; -using Unity.Multiplayer.Samples.BossRoom.Actions; +using Unity.BossRoom.Gameplay.Actions; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.Utils; +using Unity.BossRoom.VisualEffects; using Unity.Netcode; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.GameplayObjects { - public class ServerProjectileLogic : NetworkBehaviour + /// + /// Logic that handles a physics-based projectile with a collider + /// + public class PhysicsProjectile : NetworkBehaviour { bool m_Started; - [SerializeField] - NetworkProjectileState m_NetState; - [SerializeField] SphereCollider m_OurCollider; @@ -54,6 +58,20 @@ public class ServerProjectileLogic : NetworkBehaviour /// bool m_IsDead; + [SerializeField] + [Tooltip("Explosion prefab used when projectile hits enemy. This should have a fixed duration.")] + SpecialFXGraphic m_OnHitParticlePrefab; + + [SerializeField] + TrailRenderer m_TrailRenderer; + + [SerializeField] + Transform m_Visualization; + + const float k_LerpTime = 0.1f; + + PositionLerper m_PositionLerper; + /// /// Set everything up based on provided projectile information. /// (Note that this is called before OnNetworkSpawn(), so don't try to do any network stuff here.) @@ -66,31 +84,50 @@ public void Initialize(ulong creatorsNetworkObjectId, in ProjectileInfo projecti public override void OnNetworkSpawn() { - if (!IsServer) + if (IsServer) { - enabled = false; - return; + m_Started = true; + + m_HitTargets = new List(); + m_IsDead = false; + + m_DestroyAtSec = Time.fixedTime + (m_ProjectileInfo.Range / m_ProjectileInfo.Speed_m_s); + + m_CollisionMask = LayerMask.GetMask(new[] { "NPCs", "Default", "Environment" }); + m_BlockerMask = LayerMask.GetMask(new[] { "Default", "Environment" }); + m_NpcLayer = LayerMask.NameToLayer("NPCs"); } - m_Started = true; - m_HitTargets = new List(); - m_IsDead = false; + if (IsClient) + { + m_TrailRenderer.Clear(); + + m_Visualization.parent = null; - m_DestroyAtSec = Time.fixedTime + (m_ProjectileInfo.Range / m_ProjectileInfo.Speed_m_s); + m_PositionLerper = new PositionLerper(transform.position, k_LerpTime); + m_Visualization.transform.rotation = transform.rotation; + } - m_CollisionMask = LayerMask.GetMask(new[] { "NPCs", "Default", "Environment" }); - m_BlockerMask = LayerMask.GetMask(new[] { "Default", "Environment" }); - m_NpcLayer = LayerMask.NameToLayer("NPCs"); } public override void OnNetworkDespawn() { - m_Started = false; + if (IsServer) + { + m_Started = false; + } + + + if (IsClient) + { + m_TrailRenderer.Clear(); + m_Visualization.parent = transform; + } } void FixedUpdate() { - if (!m_Started) + if (!m_Started || !IsServer) { return; //don't do anything before OnNetworkSpawn has run. } @@ -112,6 +149,30 @@ void FixedUpdate() } } + void Update() + { + if (IsClient) + { + // One thing to note: this graphics GameObject is detached from its parent on OnNetworkSpawn. On the host, + // the m_Parent Transform is translated via PhysicsProjectile's FixedUpdate method. On all other + // clients, m_Parent's NetworkTransform handles syncing and interpolating the m_Parent Transform. Thus, to + // eliminate any visual jitter on the host, this GameObject is positionally smoothed over time. On all other + // clients, no positional smoothing is required, since m_Parent's NetworkTransform will perform + // positional interpolation on its Update method, and so this position is simply matched 1:1 with m_Parent. + + if (IsHost) + { + m_Visualization.position = m_PositionLerper.LerpPosition(m_Visualization.position, + transform.position); + } + else + { + m_Visualization.position = transform.position; + } + } + + } + void DetectCollisions() { var position = transform.localToWorldMatrix.MultiplyPoint(m_OurCollider.center); @@ -143,7 +204,7 @@ void DetectCollisions() var targetNetObj = m_CollisionCache[i].GetComponentInParent(); if (targetNetObj) { - m_NetState.RecvHitEnemyClientRPC(targetNetObj.NetworkObjectId); + RecvHitEnemyClientRPC(targetNetObj.NetworkObjectId); //retrieve the person that created us, if he's still around. NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(m_SpawnerId, out var spawnerNet); @@ -162,6 +223,22 @@ void DetectCollisions() } } } + + [ClientRpc] + private void RecvHitEnemyClientRPC(ulong enemyId) + { + //in the future we could do quite fancy things, like deparenting the Graphics Arrow and parenting it to the target. + //For the moment we play some particles (optionally), and cause the target to animate a hit-react. + + NetworkObject targetNetObject; + if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(enemyId, out targetNetObject)) + { + if (m_OnHitParticlePrefab) + { + // show an impact graphic + Instantiate(m_OnHitParticlePrefab.gameObject, transform.position, transform.rotation); + } + } + } } } - diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ServerProjectileLogic.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/Projectiles/PhysicsProjectile.cs.meta similarity index 100% rename from Assets/Scripts/Gameplay/GameplayObjects/ServerProjectileLogic.cs.meta rename to Assets/Scripts/Gameplay/GameplayObjects/Projectiles/PhysicsProjectile.cs.meta diff --git a/Assets/Scripts/Gameplay/GameplayObjects/PublishMessageOnLifeChange.cs b/Assets/Scripts/Gameplay/GameplayObjects/PublishMessageOnLifeChange.cs index 65246571a..ceb866027 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/PublishMessageOnLifeChange.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/PublishMessageOnLifeChange.cs @@ -1,30 +1,38 @@ -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; +using System; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.Gameplay.GameState; +using Unity.BossRoom.Gameplay.Messages; +using Unity.BossRoom.Infrastructure; +using Unity.BossRoom.Utils; using Unity.Netcode; using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.GameplayObjects { /// /// Server-only component which publishes a message once the LifeState changes. /// - [RequireComponent(typeof(NetworkLifeState))] + [RequireComponent(typeof(NetworkLifeState), typeof(ServerCharacter))] public class PublishMessageOnLifeChange : NetworkBehaviour { - [SerializeField] NetworkLifeState m_NetworkLifeState; + ServerCharacter m_ServerCharacter; [SerializeField] string m_CharacterName; - [SerializeField] - CharacterClassContainer m_CharacterClass; - NetworkNameState m_NameState; [Inject] IPublisher m_Publisher; + void Awake() + { + m_NetworkLifeState = GetComponent(); + m_ServerCharacter = GetComponent(); + } + public override void OnNetworkSpawn() { if (IsServer) @@ -45,7 +53,7 @@ void OnLifeStateChanged(LifeState previousState, LifeState newState) m_Publisher.Publish(new LifeStateChangedEventMessage() { CharacterName = m_NameState != null ? m_NameState.Name.Value : (FixedPlayerName)m_CharacterName, - CharacterType = m_CharacterClass.CharacterClass.CharacterType, + CharacterType = m_ServerCharacter.CharacterClass.CharacterType, NewLifeState = newState }); } diff --git a/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/CharacterClassContainer.cs b/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/CharacterClassContainer.cs deleted file mode 100644 index 6b962230f..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/CharacterClassContainer.cs +++ /dev/null @@ -1,39 +0,0 @@ -using UnityEngine; - -namespace Unity.Multiplayer.Samples.BossRoom -{ - /// - /// The source of truth for a PC/NPCs CharacterClass. - /// Player's class is dynamic. NPC's class isn't. This class serves as a single access point for static vs dynamic classes - /// - public class CharacterClassContainer : MonoBehaviour - { - [SerializeField] - CharacterClass m_CharacterClass; - - public CharacterClass CharacterClass - { - get - { - if (m_CharacterClass == null) - { - m_CharacterClass = m_State.RegisteredAvatar.CharacterClass; - } - - return m_CharacterClass; - } - } - - private NetworkAvatarGuidState m_State; - - private void Awake() - { - m_State = GetComponent(); - } - - public void SetCharacterClass(CharacterClass characterClass) - { - m_CharacterClass = characterClass; - } - } -} diff --git a/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/CharacterClassContainer.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/CharacterClassContainer.cs.meta deleted file mode 100644 index 4d655c87c..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/CharacterClassContainer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4a3a07abfb44d50469112a0db6a202b2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/ClientPlayerAvatarRuntimeCollection.cs b/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/ClientPlayerAvatarRuntimeCollection.cs index 98e0daf17..d2c06b8e7 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/ClientPlayerAvatarRuntimeCollection.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/ClientPlayerAvatarRuntimeCollection.cs @@ -1,7 +1,9 @@ using System; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.Infrastructure; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.GameplayObjects { /// /// A runtime list of objects that is populated both on clients and server. diff --git a/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/GameDataSource.cs b/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/GameDataSource.cs index 7ce199355..35db1a1bf 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/GameDataSource.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/GameDataSource.cs @@ -1,10 +1,12 @@ using System; using System.Collections.Generic; -using Unity.Multiplayer.Samples.BossRoom.Actions; +using Unity.BossRoom.Gameplay.Actions; +using Unity.BossRoom.Gameplay.Configuration; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using UnityEngine; -using Action = Unity.Multiplayer.Samples.BossRoom.Actions.Action; +using Action = Unity.BossRoom.Gameplay.Actions.Action; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.GameplayObjects { public class GameDataSource : MonoBehaviour { diff --git a/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/PersistentPlayerRuntimeCollection.cs b/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/PersistentPlayerRuntimeCollection.cs index f35966594..c127fdf31 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/PersistentPlayerRuntimeCollection.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/PersistentPlayerRuntimeCollection.cs @@ -1,6 +1,8 @@ +using System; +using Unity.BossRoom.Infrastructure; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.GameplayObjects { /// /// A runtime list of objects that is populated both on clients and server. diff --git a/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/TransformRegister.cs b/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/TransformRegister.cs deleted file mode 100644 index d416a8e8d..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/TransformRegister.cs +++ /dev/null @@ -1,23 +0,0 @@ -using UnityEngine; - -namespace Unity.Multiplayer.Samples.BossRoom -{ - /// - /// Class which registers a transform to an associated TransformVariable ScriptableObject. - /// - public class TransformRegister : MonoBehaviour - { - [SerializeField] - TransformVariable m_TransformVariable; - - void OnEnable() - { - m_TransformVariable.Value = transform; - } - - void OnDisable() - { - m_TransformVariable.Value = null; - } - } -} diff --git a/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/TransformRegister.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/TransformRegister.cs.meta deleted file mode 100644 index 166bcd8af..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/TransformRegister.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7598968fc3503a4499941ba23cc04000 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ServerBreakableLogic.cs b/Assets/Scripts/Gameplay/GameplayObjects/ServerBreakableLogic.cs deleted file mode 100644 index 65eb8c50e..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/ServerBreakableLogic.cs +++ /dev/null @@ -1,121 +0,0 @@ -using Unity.Netcode; -using UnityEngine; - -namespace Unity.Multiplayer.Samples.BossRoom.Server -{ - /// - /// This script handles the logic for a simple "single-shot" breakable object like a pot, or - /// other stationary items with arbitrary amounts of HP, like spawner-portal crystals. - /// - [RequireComponent(typeof(NetworkBreakableState))] - public class ServerBreakableLogic : NetworkBehaviour, IDamageable - { - [SerializeField] - [Tooltip("If left blank, this breakable effectively has 1 hit point")] - IntVariable m_MaxHealth; - - [SerializeField] - [Tooltip("If this breakable will have hit points, add a NetworkHealthState component to this GameObject")] - NetworkHealthState m_NetworkHealthState; - - [SerializeField] - Collider m_Collider; - - [SerializeField] - [Tooltip("Indicate which special interaction behaviors are needed for this breakable")] - IDamageable.SpecialDamageFlags m_SpecialDamageFlags; - - private NetworkBreakableState m_State; - - private void Awake() - { - m_State = GetComponent(); - } - - public override void OnNetworkSpawn() - { - if (!IsServer) - { - enabled = false; - } - else - { - if (m_MaxHealth && m_NetworkHealthState) - { - m_NetworkHealthState.HitPoints.Value = m_MaxHealth.Value; - } - } - } - - public void ReceiveHP(ServerCharacter inflicter, int HP) - { - if (HP < 0) - { - if (inflicter && !inflicter.IsNpc) - { - bool isNotDamagedByPlayers = (GetSpecialDamageFlags() & IDamageable.SpecialDamageFlags.NotDamagedByPlayers) == IDamageable.SpecialDamageFlags.NotDamagedByPlayers; - if (isNotDamagedByPlayers) - { - // a player tried to damage us, but we are immune to player damage! - return; - } - } - - if (m_NetworkHealthState) - { - m_NetworkHealthState.HitPoints.Value = - Mathf.Clamp(m_NetworkHealthState.HitPoints.Value + HP, 0, m_MaxHealth.Value); - if (m_NetworkHealthState.HitPoints.Value <= 0) - { - Break(); - } - } - else - { - //any damage at all is enough to slay me. - Break(); - } - } - } - - private void Break() - { - m_State.IsBroken.Value = true; - if (m_Collider) - m_Collider.enabled = false; - } - - public void Unbreak() - { - m_State.IsBroken.Value = false; - if (m_Collider) - m_Collider.enabled = true; - if (m_MaxHealth && m_NetworkHealthState) - m_NetworkHealthState.HitPoints.Value = m_MaxHealth.Value; - } - - public IDamageable.SpecialDamageFlags GetSpecialDamageFlags() - { - return m_SpecialDamageFlags; - } - - public bool IsDamageable() - { - // you can damage this breakable until it's broken! - return !m_State.IsBroken.Value; - } - -#if UNITY_EDITOR - private void OnValidate() - { - if (!m_Collider) - m_Collider = GetComponent(); - if (!m_NetworkHealthState) - m_NetworkHealthState = GetComponent(); - } -#endif - } - - -} - diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ServerDisplacerOnParentChange.cs b/Assets/Scripts/Gameplay/GameplayObjects/ServerDisplacerOnParentChange.cs index d9ee67c84..c73e7370a 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/ServerDisplacerOnParentChange.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/ServerDisplacerOnParentChange.cs @@ -5,7 +5,7 @@ using UnityEngine; using UnityEngine.Animations; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.GameplayObjects { /// /// Component to simply play a descending animation when this NetworkObject's parent NetworkObject changes. diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ServerSwitchedDoor.cs b/Assets/Scripts/Gameplay/GameplayObjects/ServerSwitchedDoor.cs deleted file mode 100644 index 406869eff..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/ServerSwitchedDoor.cs +++ /dev/null @@ -1,79 +0,0 @@ -using Unity.Netcode; -using UnityEngine; - -namespace Unity.Multiplayer.Samples.BossRoom.Server -{ - /// - /// Server-side logic for a door. This particular type of door - /// is opened when a player stands on a floor switch. - /// (Assign the floor switches for this door in the editor.) - /// - [RequireComponent(typeof(NetworkDoorState))] - public class ServerSwitchedDoor : NetworkBehaviour - { - [SerializeField] - NetworkFloorSwitchState[] m_SwitchesThatOpenThisDoor; - - [SerializeField] - Animator m_Animator; - - [SerializeField] - NetworkDoorState m_NetworkDoorState; - - const string k_AnimatorDoorOpenBoolVarName = "IsOpen"; - - [SerializeField, HideInInspector] - int m_AnimatorDoorOpenBoolID; - -#if UNITY_EDITOR || DEVELOPMENT_BUILD - public bool ForceOpen; -#endif - - void Awake() - { - // don't let Update() run until after OnNetworkSpawn() - enabled = false; - - if (m_SwitchesThatOpenThisDoor.Length == 0) - Debug.LogError("Door has no switches and can never be opened!", gameObject); - } - - public override void OnNetworkSpawn() - { - enabled = IsServer; - - DoorStateChanged(false, m_NetworkDoorState.IsOpen.Value); - - m_NetworkDoorState.IsOpen.OnValueChanged += DoorStateChanged; - } - - void Update() - { - var isAnySwitchOn = false; - foreach (var floorSwitch in m_SwitchesThatOpenThisDoor) - { - if (floorSwitch && floorSwitch.IsSwitchedOn.Value) - { - isAnySwitchOn = true; - break; - } - } - -#if UNITY_EDITOR || DEVELOPMENT_BUILD - isAnySwitchOn |= ForceOpen; -#endif - - m_NetworkDoorState.IsOpen.Value = isAnySwitchOn; - } - - void DoorStateChanged(bool previousValue, bool newValue) - { - m_Animator.SetBool(m_AnimatorDoorOpenBoolID, newValue); - } - - void OnValidate() - { - m_AnimatorDoorOpenBoolID = Animator.StringToHash(k_AnimatorDoorOpenBoolVarName); - } - } -} diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ServerTossedItem.cs b/Assets/Scripts/Gameplay/GameplayObjects/ServerTossedItem.cs deleted file mode 100644 index 10fba7c8c..000000000 --- a/Assets/Scripts/Gameplay/GameplayObjects/ServerTossedItem.cs +++ /dev/null @@ -1,115 +0,0 @@ -using Unity.Netcode; -using UnityEngine; -using UnityEngine.Events; - -namespace Unity.Multiplayer.Samples.BossRoom.Server -{ - public class ServerTossedItem : NetworkBehaviour - { - [SerializeField] - int m_DamagePoints; - - [SerializeField] - float m_HitRadius = 5f; - - [SerializeField] - float m_KnockbackSpeed; - - [SerializeField] - float m_KnockbackDuration; - - [SerializeField] - LayerMask m_LayerMask; - - bool m_Started; - - const int k_MaxCollisions = 16; - - Collider[] m_CollisionCache = new Collider[k_MaxCollisions]; - - [SerializeField] - float m_DetonateAfterSeconds = 5f; - - float m_DetonateTimer; - - [SerializeField] - float m_DestroyAfterSeconds = 6f; - - float m_DestroyTimer; - - bool m_Detonated; - - public UnityEvent detonatedCallback; - - public override void OnNetworkSpawn() - { - if (!IsServer) - { - enabled = false; - return; - } - - m_Started = true; - m_Detonated = false; - - m_DetonateTimer = Time.fixedTime + m_DetonateAfterSeconds; - m_DestroyTimer = Time.fixedTime + m_DestroyAfterSeconds; - } - - public override void OnNetworkDespawn() - { - m_Started = false; - m_Detonated = false; - } - - void Detonate() - { - var hits = Physics.OverlapSphereNonAlloc(transform.position, m_HitRadius, m_CollisionCache, m_LayerMask); - - for (int i = 0; i < hits; i++) - { - if (m_CollisionCache[i].gameObject.TryGetComponent(out IDamageable damageReceiver)) - { - damageReceiver.ReceiveHP(null, -m_DamagePoints); - - var serverCharacter = m_CollisionCache[i].gameObject.GetComponentInParent(); - if (serverCharacter) - { - serverCharacter.Movement.StartKnockback(transform.position, m_KnockbackSpeed, m_KnockbackDuration); - } - } - } - - // send client RPC to detonate on clients - DetonateClientRpc(); - - m_Detonated = true; - } - - [ClientRpc] - void DetonateClientRpc() - { - detonatedCallback?.Invoke(); - } - - void FixedUpdate() - { - if (!m_Started) - { - return; //don't do anything before OnNetworkSpawn has run. - } - - if (!m_Detonated && m_DetonateTimer < Time.fixedTime) - { - Detonate(); - } - - if (m_Detonated && m_DestroyTimer < Time.fixedTime) - { - // despawn after sending detonate RPC - var networkObject = gameObject.GetComponent(); - networkObject.Despawn(); - } - } - } -} diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ServerWaveSpawner.cs b/Assets/Scripts/Gameplay/GameplayObjects/ServerWaveSpawner.cs index 098b3fbb0..5b65e282f 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/ServerWaveSpawner.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/ServerWaveSpawner.cs @@ -1,13 +1,15 @@ +using System; using System.Collections; using System.Collections.Generic; -using UnityEngine; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.Netcode; +using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Gameplay.GameplayObjects { /// /// Component responsible for spawning prefab clones in waves on the server. - /// calls our SetSpawnerEnabled() to turn on/off spawning. + /// calls our SetSpawnerEnabled() to turn on/off spawning. /// public class ServerWaveSpawner : NetworkBehaviour { @@ -257,7 +259,7 @@ int GetCurrentSpawnCap() int numPlayers = 0; foreach (var serverCharacter in PlayerServerCharacter.GetPlayerServerCharacters()) { - if (serverCharacter.NetState.NetworkLifeState.LifeState.Value == LifeState.Alive) + if (serverCharacter.NetLifeState.LifeState.Value == LifeState.Alive) { ++numPlayers; } @@ -283,7 +285,7 @@ bool IsAnyPlayerNearbyAndVisible() // and is not occluded by a blocking collider. foreach (var serverCharacter in PlayerServerCharacter.GetPlayerServerCharacters()) { - if (!m_DetectStealthyPlayers && serverCharacter.NetState.IsStealthy.Value) + if (!m_DetectStealthyPlayers && serverCharacter.IsStealthy.Value) { // we don't detect stealthy players continue; diff --git a/Assets/Scripts/Gameplay/GameplayObjects/SwitchedDoor.cs b/Assets/Scripts/Gameplay/GameplayObjects/SwitchedDoor.cs new file mode 100644 index 000000000..426fc340c --- /dev/null +++ b/Assets/Scripts/Gameplay/GameplayObjects/SwitchedDoor.cs @@ -0,0 +1,112 @@ +using System; +using Unity.BossRoom.Gameplay.Messages; +using Unity.BossRoom.Infrastructure; +using Unity.Netcode; +using UnityEngine; +using VContainer; + +namespace Unity.BossRoom.Gameplay.GameplayObjects +{ + /// + /// This class contains both client and server logic for a door that is opened when a player stands on a floor switch. + /// (Assign the floor switches for this door in the editor.) + /// Represents a door in the client. The visuals of the door animate as + /// "opening" and "closing", but for physics purposes this is an illusion: + /// whenever the door is open on the server, the door's physics are disabled, + /// and vice versa. + /// + public class SwitchedDoor : NetworkBehaviour + { + [SerializeField] + FloorSwitch[] m_SwitchesThatOpenThisDoor; + + [SerializeField] + Animator m_Animator; + + public NetworkVariable IsOpen { get; } = new NetworkVariable(); + + const string k_AnimatorDoorOpenBoolVarName = "IsOpen"; + + [SerializeField, HideInInspector] + int m_AnimatorDoorOpenBoolID; + +#if UNITY_EDITOR || DEVELOPMENT_BUILD + public bool ForceOpen; +#endif + + [SerializeField] + [Tooltip("This physics and navmesh obstacle is enabled when the door is closed.")] + GameObject m_PhysicsObject; + + [Inject] + IPublisher m_Publisher; + + void Awake() + { + if (m_SwitchesThatOpenThisDoor.Length == 0) + Debug.LogError("Door has no switches and can never be opened!", gameObject); + } + + public override void OnNetworkSpawn() + { + IsOpen.OnValueChanged += OnDoorStateChanged; + + if (IsClient) + { + // initialize visuals based on current server state (or else we default to "closed") + m_PhysicsObject.SetActive(!IsOpen.Value); + } + + if (IsServer) + { + OnDoorStateChanged(false, IsOpen.Value); + } + } + + public override void OnNetworkDespawn() + { + IsOpen.OnValueChanged -= OnDoorStateChanged; + } + + void Update() + { + if (IsServer && IsSpawned) + { + var isAnySwitchOn = false; + foreach (var floorSwitch in m_SwitchesThatOpenThisDoor) + { + if (floorSwitch && floorSwitch.IsSwitchedOn.Value) + { + isAnySwitchOn = true; + break; + } + } + +#if UNITY_EDITOR || DEVELOPMENT_BUILD + isAnySwitchOn |= ForceOpen; +#endif + + IsOpen.Value = isAnySwitchOn; + } + } + + void OnDoorStateChanged(bool wasDoorOpen, bool isDoorOpen) + { + if (IsServer) + { + m_Animator.SetBool(m_AnimatorDoorOpenBoolID, isDoorOpen); + } + + if (IsClient) + { + m_PhysicsObject.SetActive(!isDoorOpen); + m_Publisher?.Publish(new DoorStateChangedEventMessage() { IsDoorOpen = isDoorOpen }); + } + } + + void OnValidate() + { + m_AnimatorDoorOpenBoolID = Animator.StringToHash(k_AnimatorDoorOpenBoolVarName); + } + } +} diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ServerSwitchedDoor.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/SwitchedDoor.cs.meta similarity index 100% rename from Assets/Scripts/Gameplay/GameplayObjects/ServerSwitchedDoor.cs.meta rename to Assets/Scripts/Gameplay/GameplayObjects/SwitchedDoor.cs.meta diff --git a/Assets/Scripts/Gameplay/GameplayObjects/TossedItem.cs b/Assets/Scripts/Gameplay/GameplayObjects/TossedItem.cs new file mode 100644 index 000000000..77f5e7473 --- /dev/null +++ b/Assets/Scripts/Gameplay/GameplayObjects/TossedItem.cs @@ -0,0 +1,161 @@ +using System; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.Netcode; +using UnityEngine; +using UnityEngine.Events; + +namespace Unity.BossRoom.Gameplay.GameplayObjects +{ + public class TossedItem : NetworkBehaviour + { + [Header("Server")] + + [SerializeField] + int m_DamagePoints; + + [SerializeField] + float m_HitRadius = 5f; + + [SerializeField] + float m_KnockbackSpeed; + + [SerializeField] + float m_KnockbackDuration; + + [SerializeField] + LayerMask m_LayerMask; + + bool m_Started; + + const int k_MaxCollisions = 16; + + Collider[] m_CollisionCache = new Collider[k_MaxCollisions]; + + [SerializeField] + float m_DetonateAfterSeconds = 5f; + + float m_DetonateTimer; + + [SerializeField] + float m_DestroyAfterSeconds = 6f; + + float m_DestroyTimer; + + bool m_Detonated; + + public UnityEvent detonatedCallback; + + [Header("Client")] + + [SerializeField] + Transform m_TossedItemVisualTransform; + + const float k_DisplayHeight = 0.1f; + + readonly Quaternion k_TossAttackRadiusDisplayRotation = Quaternion.Euler(90f, 0f, 0f); + + [SerializeField] + GameObject m_TossedObjectGraphics; + + [SerializeField] + AudioSource m_FallingSound; + + public override void OnNetworkSpawn() + { + if (IsServer) + { + m_Started = true; + m_Detonated = false; + + m_DetonateTimer = Time.fixedTime + m_DetonateAfterSeconds; + m_DestroyTimer = Time.fixedTime + m_DestroyAfterSeconds; + } + + if (IsClient) + { + m_TossedItemVisualTransform.gameObject.SetActive(true); + m_TossedObjectGraphics.SetActive(true); + m_FallingSound.Play(); + } + } + + public override void OnNetworkDespawn() + { + if (IsServer) + { + m_Started = false; + m_Detonated = false; + } + + if (IsClient) + { + m_TossedItemVisualTransform.gameObject.SetActive(false); + } + + } + + void Detonate() + { + var hits = Physics.OverlapSphereNonAlloc(transform.position, m_HitRadius, m_CollisionCache, m_LayerMask); + + for (int i = 0; i < hits; i++) + { + if (m_CollisionCache[i].gameObject.TryGetComponent(out IDamageable damageReceiver)) + { + damageReceiver.ReceiveHP(null, -m_DamagePoints); + + var serverCharacter = m_CollisionCache[i].gameObject.GetComponentInParent(); + if (serverCharacter) + { + serverCharacter.Movement.StartKnockback(transform.position, m_KnockbackSpeed, m_KnockbackDuration); + } + } + } + + // send client RPC to detonate on clients + DetonateClientRpc(); + + m_Detonated = true; + } + + [ClientRpc] + void DetonateClientRpc() + { + detonatedCallback?.Invoke(); + } + + void FixedUpdate() + { + if (IsServer) + { + if (!m_Started) + { + return; //don't do anything before OnNetworkSpawn has run. + } + + if (!m_Detonated && m_DetonateTimer < Time.fixedTime) + { + Detonate(); + } + + if (m_Detonated && m_DestroyTimer < Time.fixedTime) + { + // despawn after sending detonate RPC + var networkObject = gameObject.GetComponent(); + networkObject.Despawn(); + } + } + } + + void LateUpdate() + { + if (IsClient) + { + var tossedItemPosition = transform.position; + m_TossedItemVisualTransform.SetPositionAndRotation( + new Vector3(tossedItemPosition.x, k_DisplayHeight, tossedItemPosition.z), + k_TossAttackRadiusDisplayRotation); + } + } + } +} diff --git a/Assets/Scripts/Gameplay/GameplayObjects/ServerTossedItem.cs.meta b/Assets/Scripts/Gameplay/GameplayObjects/TossedItem.cs.meta similarity index 100% rename from Assets/Scripts/Gameplay/GameplayObjects/ServerTossedItem.cs.meta rename to Assets/Scripts/Gameplay/GameplayObjects/TossedItem.cs.meta diff --git a/Assets/Scripts/Gameplay/Messages/GameEventMessage.cs b/Assets/Scripts/Gameplay/Messages/CheatUsedMessage.cs similarity index 59% rename from Assets/Scripts/Gameplay/Messages/GameEventMessage.cs rename to Assets/Scripts/Gameplay/Messages/CheatUsedMessage.cs index f7fb2dfa1..2e8ca75b7 100644 --- a/Assets/Scripts/Gameplay/Messages/GameEventMessage.cs +++ b/Assets/Scripts/Gameplay/Messages/CheatUsedMessage.cs @@ -1,23 +1,12 @@ using System; +using Unity.BossRoom.Utils; using Unity.Collections; using Unity.Netcode; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.Messages { - public struct LifeStateChangedEventMessage : INetworkSerializeByMemcpy - { - public LifeState NewLifeState; - public CharacterTypeEnum CharacterType; - public FixedPlayerName CharacterName; - } - - public struct DoorStateChangedEventMessage : INetworkSerializeByMemcpy - { - public bool IsDoorOpen; - } - - #if UNITY_EDITOR || DEVELOPMENT_BUILD + public struct CheatUsedMessage : INetworkSerializeByMemcpy { FixedString32Bytes m_CheatUsed; @@ -32,5 +21,6 @@ public CheatUsedMessage(string cheatUsed, string cheaterName) m_CheaterName = cheaterName; } } + #endif } diff --git a/Assets/Scripts/Gameplay/Messages/CheatUsedMessage.cs.meta b/Assets/Scripts/Gameplay/Messages/CheatUsedMessage.cs.meta new file mode 100644 index 000000000..46c679de1 --- /dev/null +++ b/Assets/Scripts/Gameplay/Messages/CheatUsedMessage.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4cfd07691ddf434b84ab4a018e879501 +timeCreated: 1662580393 \ No newline at end of file diff --git a/Assets/Scripts/Gameplay/Messages/DoorStateChangedEventMessage.cs b/Assets/Scripts/Gameplay/Messages/DoorStateChangedEventMessage.cs new file mode 100644 index 000000000..2a6fe5c2f --- /dev/null +++ b/Assets/Scripts/Gameplay/Messages/DoorStateChangedEventMessage.cs @@ -0,0 +1,10 @@ +using System; +using Unity.Netcode; + +namespace Unity.BossRoom.Gameplay.Messages +{ + public struct DoorStateChangedEventMessage : INetworkSerializeByMemcpy + { + public bool IsDoorOpen; + } +} diff --git a/Assets/Scripts/Gameplay/Messages/DoorStateChangedEventMessage.cs.meta b/Assets/Scripts/Gameplay/Messages/DoorStateChangedEventMessage.cs.meta new file mode 100644 index 000000000..f0a6e40ca --- /dev/null +++ b/Assets/Scripts/Gameplay/Messages/DoorStateChangedEventMessage.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9fe9a32d91034b26a47e8e08bd888e40 +timeCreated: 1662580393 \ No newline at end of file diff --git a/Assets/Scripts/Gameplay/Messages/LifeStateChangedEventMessage.cs b/Assets/Scripts/Gameplay/Messages/LifeStateChangedEventMessage.cs new file mode 100644 index 000000000..279877048 --- /dev/null +++ b/Assets/Scripts/Gameplay/Messages/LifeStateChangedEventMessage.cs @@ -0,0 +1,15 @@ +using System; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.Utils; +using Unity.Netcode; + +namespace Unity.BossRoom.Gameplay.Messages +{ + public struct LifeStateChangedEventMessage : INetworkSerializeByMemcpy + { + public LifeState NewLifeState; + public CharacterTypeEnum CharacterType; + public FixedPlayerName CharacterName; + } +} diff --git a/Assets/Scripts/Gameplay/Messages/GameEventMessage.cs.meta b/Assets/Scripts/Gameplay/Messages/LifeStateChangedEventMessage.cs.meta similarity index 100% rename from Assets/Scripts/Gameplay/Messages/GameEventMessage.cs.meta rename to Assets/Scripts/Gameplay/Messages/LifeStateChangedEventMessage.cs.meta diff --git a/Assets/Scripts/Gameplay/Input/ClickFeedbackLerper.cs b/Assets/Scripts/Gameplay/UI/ClickFeedbackLerper.cs similarity index 89% rename from Assets/Scripts/Gameplay/Input/ClickFeedbackLerper.cs rename to Assets/Scripts/Gameplay/UI/ClickFeedbackLerper.cs index 9c59d6794..e350a2c07 100644 --- a/Assets/Scripts/Gameplay/Input/ClickFeedbackLerper.cs +++ b/Assets/Scripts/Gameplay/UI/ClickFeedbackLerper.cs @@ -1,7 +1,8 @@ -using Unity.Multiplayer.Samples.BossRoom.Visual; +using System; +using Unity.BossRoom.Utils; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.UI { public class ClickFeedbackLerper : MonoBehaviour { diff --git a/Assets/Scripts/Gameplay/Input/ClickFeedbackLerper.cs.meta b/Assets/Scripts/Gameplay/UI/ClickFeedbackLerper.cs.meta similarity index 100% rename from Assets/Scripts/Gameplay/Input/ClickFeedbackLerper.cs.meta rename to Assets/Scripts/Gameplay/UI/ClickFeedbackLerper.cs.meta diff --git a/Assets/Scripts/Gameplay/UI/ClientBossRoomLoadingScreen.cs b/Assets/Scripts/Gameplay/UI/ClientBossRoomLoadingScreen.cs index 3ce9f41c3..e7eb75eca 100644 --- a/Assets/Scripts/Gameplay/UI/ClientBossRoomLoadingScreen.cs +++ b/Assets/Scripts/Gameplay/UI/ClientBossRoomLoadingScreen.cs @@ -1,8 +1,9 @@ using System; +using Unity.BossRoom.Gameplay.GameplayObjects; using Unity.Multiplayer.Samples.Utilities; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { public class ClientBossRoomLoadingScreen : ClientLoadingScreen { diff --git a/Assets/Scripts/Gameplay/Input/ClientClickFeedback.cs b/Assets/Scripts/Gameplay/UI/ClientClickFeedback.cs similarity index 93% rename from Assets/Scripts/Gameplay/Input/ClientClickFeedback.cs rename to Assets/Scripts/Gameplay/UI/ClientClickFeedback.cs index a89eddbe1..559dc580b 100644 --- a/Assets/Scripts/Gameplay/Input/ClientClickFeedback.cs +++ b/Assets/Scripts/Gameplay/UI/ClientClickFeedback.cs @@ -1,7 +1,9 @@ +using System; +using Unity.BossRoom.Gameplay.UserInput; using Unity.Netcode; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.UI { /// /// Responsible for managing and creating a feedback icon where the player clicked to move diff --git a/Assets/Scripts/Gameplay/Input/ClientClickFeedback.cs.meta b/Assets/Scripts/Gameplay/UI/ClientClickFeedback.cs.meta similarity index 100% rename from Assets/Scripts/Gameplay/Input/ClientClickFeedback.cs.meta rename to Assets/Scripts/Gameplay/UI/ClientClickFeedback.cs.meta diff --git a/Assets/Scripts/Gameplay/UI/ConnectionAnimation.cs b/Assets/Scripts/Gameplay/UI/ConnectionAnimation.cs index cc774b51b..f64d004b3 100644 --- a/Assets/Scripts/Gameplay/UI/ConnectionAnimation.cs +++ b/Assets/Scripts/Gameplay/UI/ConnectionAnimation.cs @@ -1,7 +1,8 @@ +using System; using UnityEngine; using UnityEngine.UI; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { /// /// A Temporary animation script that rotates the image on the game diff --git a/Assets/Scripts/Gameplay/UI/ConnectionStatusMessageUIManager.cs b/Assets/Scripts/Gameplay/UI/ConnectionStatusMessageUIManager.cs index 5a278c04d..e41ddcbdb 100644 --- a/Assets/Scripts/Gameplay/UI/ConnectionStatusMessageUIManager.cs +++ b/Assets/Scripts/Gameplay/UI/ConnectionStatusMessageUIManager.cs @@ -1,9 +1,10 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; +using Unity.BossRoom.ConnectionManagement; +using Unity.BossRoom.Infrastructure; using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { /// /// Subscribes to connection status messages to display them through the popup panel. diff --git a/Assets/Scripts/Gameplay/UI/HeroActionBar.cs b/Assets/Scripts/Gameplay/UI/HeroActionBar.cs index 8457a4918..e7cf41f27 100644 --- a/Assets/Scripts/Gameplay/UI/HeroActionBar.cs +++ b/Assets/Scripts/Gameplay/UI/HeroActionBar.cs @@ -1,11 +1,14 @@ +using System; using System.Collections.Generic; -using Unity.Multiplayer.Samples.BossRoom.Actions; -using Unity.Multiplayer.Samples.BossRoom.Client; +using Unity.BossRoom.Gameplay.UserInput; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.Netcode; using UnityEngine; -using SkillTriggerStyle = Unity.Multiplayer.Samples.BossRoom.Client.ClientInputSender.SkillTriggerStyle; +using Action = Unity.BossRoom.Gameplay.Actions.Action; +using SkillTriggerStyle = Unity.BossRoom.Gameplay.UserInput.ClientInputSender.SkillTriggerStyle; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { /// /// Provides logic for a Hero Action Bar with attack, skill buttons and a button to open emotes panel @@ -36,18 +39,18 @@ public class HeroActionBar : MonoBehaviour /// /// Our input-sender. Initialized in RegisterInputSender() /// - Client.ClientInputSender m_InputSender; + ClientInputSender m_InputSender; /// /// Cached reference to local player's net state. /// We find the Sprites to use by checking the Skill1, Skill2, and Skill3 members of our chosen CharacterClass /// - NetworkCharacterState m_NetState; + ServerCharacter m_ServerCharacter; /// /// If we have another player selected, this is a reference to their stats; if anything else is selected, this is null /// - NetworkCharacterState m_SelectedPlayerNetState; + ServerCharacter m_SelectedPlayerServerCharacter; /// /// If m_SelectedPlayerNetState is non-null, this indicates whether we think they're alive. (Updated every frame) @@ -74,7 +77,7 @@ class ActionButtonInfo { public readonly ActionButtonType Type; public readonly UIHUDButton Button; - public readonly Client.UITooltipDetector Tooltip; + public readonly UITooltipDetector Tooltip; /// T /// The current Action that is used when this button is pressed. @@ -87,7 +90,7 @@ public ActionButtonInfo(ActionButtonType type, UIHUDButton button, HeroActionBar { Type = type; Button = button; - Tooltip = button.GetComponent(); + Tooltip = button.GetComponent(); m_Owner = owner; } @@ -136,9 +139,9 @@ void RegisterInputSender(ClientPlayerAvatar clientPlayerAvatar) } m_InputSender = inputSender; - m_NetState = m_InputSender.GetComponent(); - m_NetState.TargetId.OnValueChanged += OnSelectionChanged; - m_NetState.heldNetworkObject.OnValueChanged += OnHeldNetworkObjectChanged; + m_ServerCharacter = m_InputSender.GetComponent(); + m_ServerCharacter.TargetId.OnValueChanged += OnSelectionChanged; + m_ServerCharacter.HeldNetworkObject.OnValueChanged += OnHeldNetworkObjectChanged; UpdateAllActionButtons(); } @@ -150,12 +153,12 @@ void OnHeldNetworkObjectChanged(ulong previousValue, ulong newValue) void DeregisterInputSender() { m_InputSender = null; - if (m_NetState) + if (m_ServerCharacter != null) { - m_NetState.TargetId.OnValueChanged -= OnSelectionChanged; - m_NetState.heldNetworkObject.OnValueChanged -= OnHeldNetworkObjectChanged; + m_ServerCharacter.TargetId.OnValueChanged -= OnSelectionChanged; + m_ServerCharacter.HeldNetworkObject.OnValueChanged -= OnHeldNetworkObjectChanged; } - m_NetState = null; + m_ServerCharacter = null; } void Awake() @@ -201,14 +204,14 @@ void Update() // If we have another player selected, see if their aliveness state has changed, // and if so, update the interactiveness of the basic-action button - if (Input.GetKeyUp(KeyCode.Alpha4)) + if (UnityEngine.Input.GetKeyUp(KeyCode.Alpha4)) { m_ButtonInfo[ActionButtonType.EmoteBar].Button.OnPointerUpEvent.Invoke(); } - if (!m_SelectedPlayerNetState) { return; } + if (!m_SelectedPlayerServerCharacter) { return; } - bool isAliveNow = m_SelectedPlayerNetState.NetworkLifeState.LifeState.Value == LifeState.Alive; + bool isAliveNow = m_SelectedPlayerServerCharacter.NetLifeState.LifeState.Value == LifeState.Alive; if (isAliveNow != m_WasSelectedPlayerAliveDuringLastUpdate) { // this will update the icons so that the basic-action button's interactiveness is correct @@ -264,15 +267,15 @@ void OnButtonClickedUp(ActionButtonType buttonType) /// void UpdateAllActionButtons() { - UpdateActionButton(m_ButtonInfo[ActionButtonType.BasicAction], m_NetState.CharacterClass.Skill1); - UpdateActionButton(m_ButtonInfo[ActionButtonType.Special1], m_NetState.CharacterClass.Skill2); - UpdateActionButton(m_ButtonInfo[ActionButtonType.Special2], m_NetState.CharacterClass.Skill3); + UpdateActionButton(m_ButtonInfo[ActionButtonType.BasicAction], m_ServerCharacter.CharacterClass.Skill1); + UpdateActionButton(m_ButtonInfo[ActionButtonType.Special1], m_ServerCharacter.CharacterClass.Skill2); + UpdateActionButton(m_ButtonInfo[ActionButtonType.Special2], m_ServerCharacter.CharacterClass.Skill3); var isHoldingNetworkObject = - NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(m_NetState.heldNetworkObject.Value, + NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(m_ServerCharacter.HeldNetworkObject.Value, out var heldNetworkObject); - NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(m_NetState.TargetId.Value, + NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(m_ServerCharacter.TargetId.Value, out var selection); if (isHoldingNetworkObject) @@ -280,7 +283,7 @@ void UpdateAllActionButtons() // show drop! UpdateActionButton(m_ButtonInfo[ActionButtonType.BasicAction], GameDataSource.Instance.DropActionPrototype, true); } - if ((m_NetState.TargetId.Value != 0 + if ((m_ServerCharacter.TargetId.Value != 0 && selection != null && selection.TryGetComponent(out PickUpState pickUpState)) ) @@ -288,26 +291,26 @@ void UpdateAllActionButtons() // special case: targeting a pickup-able item or holding a pickup object UpdateActionButton(m_ButtonInfo[ActionButtonType.BasicAction], GameDataSource.Instance.PickUpActionPrototype, true); } - else if (m_NetState.TargetId.Value != 0 + else if (m_ServerCharacter.TargetId.Value != 0 && selection != null - && selection.NetworkObjectId != m_NetState.NetworkObjectId - && selection.TryGetComponent(out NetworkCharacterState charState) + && selection.NetworkObjectId != m_ServerCharacter.NetworkObjectId + && selection.TryGetComponent(out ServerCharacter charState) && !charState.IsNpc) { // special case: when we have a player selected, we change the meaning of the basic action // we have another player selected! In that case we want to reflect that our basic Action is a Revive, not an attack! // But we need to know if the player is alive... if so, the button should be disabled (for better player communication) - bool isAlive = charState.NetworkLifeState.LifeState.Value == LifeState.Alive; + bool isAlive = charState.NetLifeState.LifeState.Value == LifeState.Alive; UpdateActionButton(m_ButtonInfo[ActionButtonType.BasicAction], GameDataSource.Instance.ReviveActionPrototype, !isAlive); // we'll continue to monitor our selected player every frame to see if their life-state changes. - m_SelectedPlayerNetState = charState; + m_SelectedPlayerServerCharacter = charState; m_WasSelectedPlayerAliveDuringLastUpdate = isAlive; } else { - m_SelectedPlayerNetState = null; + m_SelectedPlayerServerCharacter = null; m_WasSelectedPlayerAliveDuringLastUpdate = false; } } diff --git a/Assets/Scripts/Gameplay/UI/HeroEmoteBar.cs b/Assets/Scripts/Gameplay/UI/HeroEmoteBar.cs index 08d0ad31a..4fd845e30 100644 --- a/Assets/Scripts/Gameplay/UI/HeroEmoteBar.cs +++ b/Assets/Scripts/Gameplay/UI/HeroEmoteBar.cs @@ -1,9 +1,11 @@ -using Unity.Multiplayer.Samples.BossRoom.Actions; -using Unity.Multiplayer.Samples.BossRoom.Client; +using System; +using Unity.BossRoom.Gameplay.UserInput; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.Gameplay.GameplayObjects; using UnityEngine; -using SkillTriggerStyle = Unity.Multiplayer.Samples.BossRoom.Client.ClientInputSender.SkillTriggerStyle; +using SkillTriggerStyle = Unity.BossRoom.Gameplay.UserInput.ClientInputSender.SkillTriggerStyle; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { /// /// Provides logic for a Hero Emote Bar diff --git a/Assets/Scripts/Gameplay/UI/IPConnectionWindow.cs b/Assets/Scripts/Gameplay/UI/IPConnectionWindow.cs index 90c75151a..cf3d1d968 100644 --- a/Assets/Scripts/Gameplay/UI/IPConnectionWindow.cs +++ b/Assets/Scripts/Gameplay/UI/IPConnectionWindow.cs @@ -1,13 +1,14 @@ using System; using System.Collections; using TMPro; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; +using Unity.BossRoom.ConnectionManagement; +using Unity.BossRoom.Infrastructure; using Unity.Netcode; using Unity.Netcode.Transports.UTP; using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { public class IPConnectionWindow : MonoBehaviour { diff --git a/Assets/Scripts/Gameplay/UI/IPHostingUI.cs b/Assets/Scripts/Gameplay/UI/IPHostingUI.cs index 332ef2025..1d970682b 100644 --- a/Assets/Scripts/Gameplay/UI/IPHostingUI.cs +++ b/Assets/Scripts/Gameplay/UI/IPHostingUI.cs @@ -1,9 +1,9 @@ -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; +using System; using UnityEngine; using UnityEngine.UI; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { public class IPHostingUI : MonoBehaviour { diff --git a/Assets/Scripts/Gameplay/UI/IPJoiningUI.cs b/Assets/Scripts/Gameplay/UI/IPJoiningUI.cs index f33840044..8b79e7dd9 100644 --- a/Assets/Scripts/Gameplay/UI/IPJoiningUI.cs +++ b/Assets/Scripts/Gameplay/UI/IPJoiningUI.cs @@ -1,10 +1,9 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; using UnityEngine; using UnityEngine.UI; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { public class IPJoiningUI : MonoBehaviour { diff --git a/Assets/Scripts/Gameplay/UI/IPUIMediator.cs b/Assets/Scripts/Gameplay/UI/IPUIMediator.cs index 2d8957482..7037c380f 100644 --- a/Assets/Scripts/Gameplay/UI/IPUIMediator.cs +++ b/Assets/Scripts/Gameplay/UI/IPUIMediator.cs @@ -1,11 +1,13 @@ using System; using System.Text.RegularExpressions; +using Unity.BossRoom.Gameplay.Configuration; using TMPro; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; +using Unity.BossRoom.ConnectionManagement; +using Unity.BossRoom.Infrastructure; using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { public class IPUIMediator : MonoBehaviour { diff --git a/Assets/Scripts/Gameplay/UI/Lobby/LobbyCreationUI.cs b/Assets/Scripts/Gameplay/UI/Lobby/LobbyCreationUI.cs index 8a167a526..4f21410ec 100644 --- a/Assets/Scripts/Gameplay/UI/Lobby/LobbyCreationUI.cs +++ b/Assets/Scripts/Gameplay/UI/Lobby/LobbyCreationUI.cs @@ -1,8 +1,9 @@ +using System; using UnityEngine; using UnityEngine.UI; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { public class LobbyCreationUI : MonoBehaviour { diff --git a/Assets/Scripts/Gameplay/UI/Lobby/LobbyJoiningUI.cs b/Assets/Scripts/Gameplay/UI/Lobby/LobbyJoiningUI.cs index f75bbcb3c..084754514 100644 --- a/Assets/Scripts/Gameplay/UI/Lobby/LobbyJoiningUI.cs +++ b/Assets/Scripts/Gameplay/UI/Lobby/LobbyJoiningUI.cs @@ -1,13 +1,13 @@ using System; using System.Collections.Generic; using System.Text.RegularExpressions; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; -using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies; +using Unity.BossRoom.Infrastructure; +using Unity.BossRoom.UnityServices.Lobbies; using UnityEngine; using UnityEngine.UI; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { /// /// Handles the list of LobbyListItemUIs and ensures it stays synchronized with the lobby list from the service. diff --git a/Assets/Scripts/Gameplay/UI/Lobby/LobbyListItemUI.cs b/Assets/Scripts/Gameplay/UI/Lobby/LobbyListItemUI.cs index 54abeee2b..62733cda3 100644 --- a/Assets/Scripts/Gameplay/UI/Lobby/LobbyListItemUI.cs +++ b/Assets/Scripts/Gameplay/UI/Lobby/LobbyListItemUI.cs @@ -1,10 +1,10 @@ +using System; using TMPro; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; -using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies; +using Unity.BossRoom.UnityServices.Lobbies; using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { /// /// An individual Lobby UI in the list of available lobbies diff --git a/Assets/Scripts/Gameplay/UI/Lobby/LobbyUIMediator.cs b/Assets/Scripts/Gameplay/UI/Lobby/LobbyUIMediator.cs index 4f5fef1e5..e5a56180f 100644 --- a/Assets/Scripts/Gameplay/UI/Lobby/LobbyUIMediator.cs +++ b/Assets/Scripts/Gameplay/UI/Lobby/LobbyUIMediator.cs @@ -1,14 +1,15 @@ using System; -using BossRoom.Scripts.Shared.Net.UnityServices.Auth; +using Unity.BossRoom.Gameplay.Configuration; using TMPro; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; -using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies; +using Unity.BossRoom.ConnectionManagement; +using Unity.BossRoom.Infrastructure; +using Unity.BossRoom.UnityServices.Auth; +using Unity.BossRoom.UnityServices.Lobbies; using Unity.Services.Core; -using Unity.Services.Lobbies.Models; using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { public class LobbyUIMediator : MonoBehaviour { @@ -106,7 +107,7 @@ public async void CreateLobbyRequest(string lobbyName, bool isPrivate) public async void QueryLobbiesRequest(bool blockUI) { - if (UnityServices.State != ServicesInitializationState.Initialized) + if (Unity.Services.Core.UnityServices.State != ServicesInitializationState.Initialized) { return; } @@ -200,7 +201,7 @@ public async void QuickJoinRequest() } } - void OnJoinedLobby(Lobby remoteLobby) + void OnJoinedLobby(Unity.Services.Lobbies.Models.Lobby remoteLobby) { m_LobbyServiceFacade.SetRemoteLobby(remoteLobby); diff --git a/Assets/Scripts/Gameplay/UI/PartyHUD.cs b/Assets/Scripts/Gameplay/UI/PartyHUD.cs index ffcd2d124..1ad3b3743 100644 --- a/Assets/Scripts/Gameplay/UI/PartyHUD.cs +++ b/Assets/Scripts/Gameplay/UI/PartyHUD.cs @@ -1,13 +1,15 @@ using System; using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; +using Unity.BossRoom.Gameplay.UserInput; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using TMPro; -using Unity.Multiplayer.Samples.BossRoom.Actions; -using Unity.Multiplayer.Samples.BossRoom.Client; +using Unity.BossRoom.Utils; +using UnityEngine; using UnityEngine.Assertions; +using UnityEngine.UI; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { /// /// Provides logic for the Party HUD with information on the player and allies @@ -43,13 +45,13 @@ public class PartyHUD : MonoBehaviour // track Hero's target to show when it is the Hero or an ally private ulong m_CurrentTarget; - NetworkCharacterState m_OwnedCharacterState; + ServerCharacter m_OwnedServerCharacter; ClientPlayerAvatar m_OwnedPlayerAvatar; - private Dictionary m_TrackedAllies = new Dictionary(); + private Dictionary m_TrackedAllies = new Dictionary(); - private Client.ClientInputSender m_ClientSender; + private ClientInputSender m_ClientSender; void Awake() { @@ -87,36 +89,33 @@ void PlayerAvatarRemoved(ClientPlayerAvatar clientPlayerAvatar) void SetHeroData(ClientPlayerAvatar clientPlayerAvatar) { - var networkCharacterStateExists = - clientPlayerAvatar.TryGetComponent(out NetworkCharacterState networkCharacterState); + m_OwnedServerCharacter = clientPlayerAvatar.GetComponent(); - Assert.IsTrue(networkCharacterStateExists, - "NetworkCharacterState component not found on ClientPlayerAvatar"); + Assert.IsTrue(m_OwnedServerCharacter, "ServerCharacter component not found on ClientPlayerAvatar"); m_OwnedPlayerAvatar = clientPlayerAvatar; - m_OwnedCharacterState = networkCharacterState; // Hero is always our slot 0 - m_PartyIds[0] = m_OwnedCharacterState.NetworkObject.NetworkObjectId; + m_PartyIds[0] = m_OwnedServerCharacter.NetworkObject.NetworkObjectId; // set hero portrait - if (m_OwnedCharacterState.TryGetComponent(out NetworkAvatarGuidState avatarGuidState)) + if (m_OwnedServerCharacter.TryGetComponent(out NetworkAvatarGuidState avatarGuidState)) { m_HeroPortrait.sprite = avatarGuidState.RegisteredAvatar.Portrait; } - SetUIFromSlotData(0, m_OwnedCharacterState); + SetUIFromSlotData(0, m_OwnedServerCharacter); - m_OwnedCharacterState.HealthState.HitPoints.OnValueChanged += SetHeroHealth; + m_OwnedServerCharacter.NetHealthState.HitPoints.OnValueChanged += SetHeroHealth; #if UNITY_EDITOR || DEVELOPMENT_BUILD - m_OwnedCharacterState.NetworkLifeState.IsGodMode.OnValueChanged += SetHeroGodModeStatus; + m_OwnedServerCharacter.NetLifeState.IsGodMode.OnValueChanged += SetHeroGodModeStatus; #endif // plus we track their target - m_OwnedCharacterState.TargetId.OnValueChanged += OnHeroSelectionChanged; + m_OwnedServerCharacter.TargetId.OnValueChanged += OnHeroSelectionChanged; - m_ClientSender = m_OwnedCharacterState.GetComponent(); + m_ClientSender = m_OwnedServerCharacter.GetComponent(); } void SetHeroHealth(int previousValue, int newValue) @@ -144,12 +143,12 @@ string GetPlayerName(Component component) void SetAllyData(ClientPlayerAvatar clientPlayerAvatar) { var networkCharacterStateExists = - clientPlayerAvatar.TryGetComponent(out NetworkCharacterState networkCharacterState); + clientPlayerAvatar.TryGetComponent(out ServerCharacter serverCharacter); Assert.IsTrue(networkCharacterStateExists, "NetworkCharacterState component not found on ClientPlayerAvatar"); - ulong id = networkCharacterState.NetworkObjectId; + ulong id = serverCharacter.NetworkObjectId; int slot = FindOrAddAlly(id); // do nothing if not in a slot if (slot == -1) @@ -157,34 +156,34 @@ void SetAllyData(ClientPlayerAvatar clientPlayerAvatar) return; } - SetUIFromSlotData(slot, networkCharacterState); + SetUIFromSlotData(slot, serverCharacter); - networkCharacterState.HealthState.HitPoints.OnValueChanged += (int previousValue, int newValue) => + serverCharacter.NetHealthState.HitPoints.OnValueChanged += (int previousValue, int newValue) => { SetAllyHealth(id, newValue); }; #if UNITY_EDITOR || DEVELOPMENT_BUILD - networkCharacterState.NetworkLifeState.IsGodMode.OnValueChanged += (value, newValue) => + serverCharacter.NetLifeState.IsGodMode.OnValueChanged += (value, newValue) => { SetAllyGodModeStatus(id, newValue); }; #endif - m_TrackedAllies.Add(networkCharacterState.NetworkObjectId, networkCharacterState); + m_TrackedAllies.Add(serverCharacter.NetworkObjectId, serverCharacter); } - void SetUIFromSlotData(int slot, NetworkCharacterState netState) + void SetUIFromSlotData(int slot, ServerCharacter serverCharacter) { - m_PartyHealthSliders[slot].maxValue = netState.CharacterClass.BaseHP.Value; - m_PartyHealthSliders[slot].value = netState.HitPoints; - m_PartyNames[slot].text = GetPlayerName(netState); + m_PartyHealthSliders[slot].maxValue = serverCharacter.CharacterClass.BaseHP.Value; + m_PartyHealthSliders[slot].value = serverCharacter.HitPoints; + m_PartyNames[slot].text = GetPlayerName(serverCharacter); #if UNITY_EDITOR || DEVELOPMENT_BUILD - m_PartyHealthGodModeImages[slot].gameObject.SetActive(netState.NetworkLifeState.IsGodMode.Value); + m_PartyHealthGodModeImages[slot].gameObject.SetActive(serverCharacter.NetLifeState.IsGodMode.Value); #endif - m_PartyClassSymbols[slot].sprite = netState.CharacterClass.ClassBannerLit; + m_PartyClassSymbols[slot].sprite = serverCharacter.CharacterClass.ClassBannerLit; } #if UNITY_EDITOR || DEVELOPMENT_BUILD @@ -240,7 +239,7 @@ private void SetHeroSelectFX(ulong target, bool selected) public void SelectPartyMember(int slot) { - m_ClientSender.RequestAction(GameDataSource.Instance.GeneralTargetActionPrototype, Client.ClientInputSender.SkillTriggerStyle.UI, m_PartyIds[slot]); + m_ClientSender.RequestAction(GameDataSource.Instance.GeneralTargetActionPrototype, ClientInputSender.SkillTriggerStyle.UI, m_PartyIds[slot]); } // helper to initialize the Allies array - safe to call multiple times @@ -298,15 +297,15 @@ private int FindOrAddAlly(ulong id, bool dontAdd = false) void RemoveHero() { - if (m_OwnedCharacterState && m_OwnedCharacterState.HealthState) + if (m_OwnedServerCharacter && m_OwnedServerCharacter.NetHealthState) { - m_OwnedCharacterState.HealthState.HitPoints.OnValueChanged -= SetHeroHealth; + m_OwnedServerCharacter.NetHealthState.HitPoints.OnValueChanged -= SetHeroHealth; #if UNITY_EDITOR || DEVELOPMENT_BUILD - m_OwnedCharacterState.NetworkLifeState.IsGodMode.OnValueChanged -= SetHeroGodModeStatus; + m_OwnedServerCharacter.NetLifeState.IsGodMode.OnValueChanged -= SetHeroGodModeStatus; #endif } - m_OwnedCharacterState = null; + m_OwnedServerCharacter = null; } /// @@ -327,14 +326,14 @@ void RemoveAlly(ulong id) } } - if (m_TrackedAllies.TryGetValue(id, out NetworkCharacterState networkCharacterState)) + if (m_TrackedAllies.TryGetValue(id, out ServerCharacter serverCharacter)) { - networkCharacterState.HealthState.HitPoints.OnValueChanged -= (int previousValue, int newValue) => + serverCharacter.NetHealthState.HitPoints.OnValueChanged -= (int previousValue, int newValue) => { SetAllyHealth(id, newValue); }; #if UNITY_EDITOR || DEVELOPMENT_BUILD - networkCharacterState.NetworkLifeState.IsGodMode.OnValueChanged -= (value, newValue) => + serverCharacter.NetLifeState.IsGodMode.OnValueChanged -= (value, newValue) => { SetAllyGodModeStatus(id, value); }; diff --git a/Assets/Scripts/Gameplay/UI/PopupManager.cs b/Assets/Scripts/Gameplay/UI/PopupManager.cs index 38ac893c3..65c19485b 100644 --- a/Assets/Scripts/Gameplay/UI/PopupManager.cs +++ b/Assets/Scripts/Gameplay/UI/PopupManager.cs @@ -1,9 +1,8 @@ using System; -using System.Collections; using System.Collections.Generic; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { /// /// Handles the display of Popup messages. Instantiates and reuses popup panel prefabs to allow displaying multiple diff --git a/Assets/Scripts/Gameplay/UI/PopupPanel.cs b/Assets/Scripts/Gameplay/UI/PopupPanel.cs index 0241be9f6..1fe7d66d0 100644 --- a/Assets/Scripts/Gameplay/UI/PopupPanel.cs +++ b/Assets/Scripts/Gameplay/UI/PopupPanel.cs @@ -2,7 +2,7 @@ using UnityEngine; using TMPro; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { /// /// Simple popup panel to display information to players. diff --git a/Assets/Scripts/Gameplay/UI/PostGameUI.cs b/Assets/Scripts/Gameplay/UI/PostGameUI.cs index 99f97dd21..6d291cf4e 100644 --- a/Assets/Scripts/Gameplay/UI/PostGameUI.cs +++ b/Assets/Scripts/Gameplay/UI/PostGameUI.cs @@ -1,11 +1,11 @@ using System; -using UnityEngine; +using Unity.BossRoom.Gameplay.GameState; using TMPro; -using Unity.Multiplayer.Samples.BossRoom.Server; using Unity.Netcode; +using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { /// /// Provides backing logic for all of the UI that runs in the PostGame stage. @@ -55,15 +55,15 @@ void Inject(ServerPostGameState postGameState) void Start() { - m_PostGameState.SynchronizedStateData.WinState.OnValueChanged += OnWinStateChanged; - SetPostGameUI(m_PostGameState.SynchronizedStateData.WinState.Value); + m_PostGameState.NetworkPostGame.WinState.OnValueChanged += OnWinStateChanged; + SetPostGameUI(m_PostGameState.NetworkPostGame.WinState.Value); } void OnDestroy() { if (m_PostGameState != null) { - m_PostGameState.SynchronizedStateData.WinState.OnValueChanged -= OnWinStateChanged; + m_PostGameState.NetworkPostGame.WinState.OnValueChanged -= OnWinStateChanged; } } diff --git a/Assets/Scripts/Gameplay/UI/ProfileListItemUI.cs b/Assets/Scripts/Gameplay/UI/ProfileListItemUI.cs index 417962ca2..6dccc2c1f 100644 --- a/Assets/Scripts/Gameplay/UI/ProfileListItemUI.cs +++ b/Assets/Scripts/Gameplay/UI/ProfileListItemUI.cs @@ -1,10 +1,10 @@ +using System; using TMPro; -using Unity.Multiplayer.Samples.BossRoom.Shared; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; +using Unity.BossRoom.Utils; using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { public class ProfileListItemUI : MonoBehaviour { diff --git a/Assets/Scripts/Gameplay/UI/QualityButton.cs b/Assets/Scripts/Gameplay/UI/QualityButton.cs index 3d94da591..b8028851c 100644 --- a/Assets/Scripts/Gameplay/UI/QualityButton.cs +++ b/Assets/Scripts/Gameplay/UI/QualityButton.cs @@ -1,7 +1,8 @@ +using System; using TMPro; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.UI { public class QualityButton : MonoBehaviour { diff --git a/Assets/Scripts/Gameplay/UI/RoomNameBox.cs b/Assets/Scripts/Gameplay/UI/RoomNameBox.cs index 7321c8acb..945e2133f 100644 --- a/Assets/Scripts/Gameplay/UI/RoomNameBox.cs +++ b/Assets/Scripts/Gameplay/UI/RoomNameBox.cs @@ -1,51 +1,54 @@ using System; -using UnityEngine; using TMPro; -using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies; +using Unity.BossRoom.UnityServices.Lobbies; +using UnityEngine; using UnityEngine.UI; using VContainer; -public class RoomNameBox : MonoBehaviour +namespace Unity.BossRoom.Gameplay.UI { - [SerializeField] - TextMeshProUGUI m_RoomNameText; - [SerializeField] - Button m_CopyToClipboardButton; + public class RoomNameBox : MonoBehaviour + { + [SerializeField] + TextMeshProUGUI m_RoomNameText; + [SerializeField] + Button m_CopyToClipboardButton; - LocalLobby m_LocalLobby; - string m_LobbyCode; + LocalLobby m_LocalLobby; + string m_LobbyCode; - [Inject] - private void InjectDependencies(LocalLobby localLobby) - { - m_LocalLobby = localLobby; - m_LocalLobby.changed += UpdateUI; - UpdateUI(localLobby); - } + [Inject] + private void InjectDependencies(LocalLobby localLobby) + { + m_LocalLobby = localLobby; + m_LocalLobby.changed += UpdateUI; + UpdateUI(localLobby); + } - void Awake() - { - gameObject.SetActive(false); - } + void Awake() + { + gameObject.SetActive(false); + } - private void OnDestroy() - { - m_LocalLobby.changed -= UpdateUI; - } + private void OnDestroy() + { + m_LocalLobby.changed -= UpdateUI; + } - private void UpdateUI(LocalLobby localLobby) - { - if (!string.IsNullOrEmpty(localLobby.LobbyCode)) + private void UpdateUI(LocalLobby localLobby) { - m_LobbyCode = localLobby.LobbyCode; - m_RoomNameText.text = $"Lobby Code: {m_LobbyCode}"; - gameObject.SetActive(true); - m_CopyToClipboardButton.gameObject.SetActive(true); + if (!string.IsNullOrEmpty(localLobby.LobbyCode)) + { + m_LobbyCode = localLobby.LobbyCode; + m_RoomNameText.text = $"Lobby Code: {m_LobbyCode}"; + gameObject.SetActive(true); + m_CopyToClipboardButton.gameObject.SetActive(true); + } } - } - public void CopyToClipboard() - { - GUIUtility.systemCopyBuffer = m_LobbyCode; + public void CopyToClipboard() + { + GUIUtility.systemCopyBuffer = m_LobbyCode; + } } } diff --git a/Assets/Scripts/Gameplay/UI/UICharSelectClassInfoBox.cs b/Assets/Scripts/Gameplay/UI/UICharSelectClassInfoBox.cs index 793437382..153501c02 100644 --- a/Assets/Scripts/Gameplay/UI/UICharSelectClassInfoBox.cs +++ b/Assets/Scripts/Gameplay/UI/UICharSelectClassInfoBox.cs @@ -1,9 +1,11 @@ +using System; +using Unity.BossRoom.Gameplay.Configuration; +using TMPro; using UnityEngine; using UnityEngine.UI; -using TMPro; -using Unity.Multiplayer.Samples.BossRoom.Actions; +using Action = Unity.BossRoom.Gameplay.Actions.Action; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.UI { /// /// Controls the "information box" on the character-select screen. diff --git a/Assets/Scripts/Gameplay/UI/UICharSelectPlayerSeat.cs b/Assets/Scripts/Gameplay/UI/UICharSelectPlayerSeat.cs index 2262449d4..d79146ac0 100644 --- a/Assets/Scripts/Gameplay/UI/UICharSelectPlayerSeat.cs +++ b/Assets/Scripts/Gameplay/UI/UICharSelectPlayerSeat.cs @@ -1,8 +1,11 @@ +using System; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.Gameplay.GameState; +using TMPro; using UnityEngine; using UnityEngine.UI; -using TMPro; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.UI { /// /// Controls one of the eight "seats" on the character-select screen (the boxes along the bottom). @@ -40,7 +43,7 @@ public class UICharSelectPlayerSeat : MonoBehaviour private int m_PlayerNumber; // the last SeatState we were assigned - private CharSelectData.SeatState m_State; + private NetworkCharSelection.SeatState m_State; // once this is true, we're never clickable again! private bool m_IsDisabled; @@ -48,12 +51,12 @@ public class UICharSelectPlayerSeat : MonoBehaviour public void Initialize(int seatIndex) { m_SeatIndex = seatIndex; - m_State = CharSelectData.SeatState.Inactive; + m_State = NetworkCharSelection.SeatState.Inactive; m_PlayerNumber = -1; ConfigureStateGraphics(); } - public void SetState(CharSelectData.SeatState state, int playerIndex, string playerName) + public void SetState(NetworkCharSelection.SeatState state, int playerIndex, string playerName) { if (state == m_State && playerIndex == m_PlayerNumber) return; // no actual changes @@ -61,14 +64,14 @@ public void SetState(CharSelectData.SeatState state, int playerIndex, string pla m_State = state; m_PlayerNumber = playerIndex; m_PlayerNameHolder.text = playerName; - if (m_State == CharSelectData.SeatState.Inactive) + if (m_State == NetworkCharSelection.SeatState.Inactive) m_PlayerNumber = -1; ConfigureStateGraphics(); } public bool IsLocked() { - return m_State == CharSelectData.SeatState.LockedIn; + return m_State == NetworkCharSelection.SeatState.LockedIn; } public void SetDisableInteraction(bool disable) @@ -103,7 +106,7 @@ private void PlayUnlockAnim() private void ConfigureStateGraphics() { - if (m_State == CharSelectData.SeatState.Inactive) + if (m_State == NetworkCharSelection.SeatState.Inactive) { m_InactiveStateVisuals.SetActive(true); m_ActiveStateVisuals.SetActive(false); @@ -123,7 +126,7 @@ private void ConfigureStateGraphics() m_PlayerNameHolder.color = ClientCharSelectState.Instance.m_IdentifiersForEachPlayerNumber[m_PlayerNumber].Color; m_Button.interactable = m_IsDisabled ? false : true; - if (m_State == CharSelectData.SeatState.LockedIn) + if (m_State == NetworkCharSelection.SeatState.LockedIn) { m_Glow.color = ClientCharSelectState.Instance.m_IdentifiersForEachPlayerNumber[m_PlayerNumber].Color; m_Glow.gameObject.SetActive(true); diff --git a/Assets/Scripts/Gameplay/UI/UIHUDButton.cs b/Assets/Scripts/Gameplay/UI/UIHUDButton.cs index 83d7f080b..cbf9818ea 100644 --- a/Assets/Scripts/Gameplay/UI/UIHUDButton.cs +++ b/Assets/Scripts/Gameplay/UI/UIHUDButton.cs @@ -3,7 +3,7 @@ using UnityEngine.EventSystems; using UnityEngine.UI; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { /// /// Provides logic for a UI HUD Button to slightly shrink scale on pointer down. diff --git a/Assets/Scripts/Gameplay/UI/UIHealth.cs b/Assets/Scripts/Gameplay/UI/UIHealth.cs index e4fcf4db6..845d35318 100644 --- a/Assets/Scripts/Gameplay/UI/UIHealth.cs +++ b/Assets/Scripts/Gameplay/UI/UIHealth.cs @@ -1,8 +1,9 @@ +using System; using Unity.Netcode; using UnityEngine; using UnityEngine.UI; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.UI { /// /// UI object that visually represents an object's health. Visuals are updated when NetworkVariable is modified. diff --git a/Assets/Scripts/Gameplay/UI/UIMessageFeed.cs b/Assets/Scripts/Gameplay/UI/UIMessageFeed.cs index 3ca36b960..9f3eb9473 100644 --- a/Assets/Scripts/Gameplay/UI/UIMessageFeed.cs +++ b/Assets/Scripts/Gameplay/UI/UIMessageFeed.cs @@ -1,11 +1,15 @@ using System; using System.Collections.Generic; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; +using Unity.BossRoom.ConnectionManagement; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.Gameplay.Messages; +using Unity.BossRoom.Infrastructure; using UnityEngine; using UnityEngine.UI; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { /// /// Handles the display of in-game messages in a message feed diff --git a/Assets/Scripts/Gameplay/UI/UIMessageSlot.cs b/Assets/Scripts/Gameplay/UI/UIMessageSlot.cs index 29a1cda93..571c78dc1 100644 --- a/Assets/Scripts/Gameplay/UI/UIMessageSlot.cs +++ b/Assets/Scripts/Gameplay/UI/UIMessageSlot.cs @@ -1,7 +1,8 @@ +using System; using System.Collections; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { public class UIMessageSlot : MonoBehaviour { diff --git a/Assets/Scripts/Gameplay/UI/UIName.cs b/Assets/Scripts/Gameplay/UI/UIName.cs index 21b327e81..d56021f14 100644 --- a/Assets/Scripts/Gameplay/UI/UIName.cs +++ b/Assets/Scripts/Gameplay/UI/UIName.cs @@ -1,9 +1,10 @@ -using UnityEngine; +using System; using TMPro; -using Unity.Collections; +using Unity.BossRoom.Utils; using Unity.Netcode; +using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.UI { /// /// UI object that visually represents an object's name. Visuals are updated when NetworkVariable is modified. diff --git a/Assets/Scripts/Gameplay/UI/UIProfileSelector.cs b/Assets/Scripts/Gameplay/UI/UIProfileSelector.cs index 9218a949a..c6300cb38 100644 --- a/Assets/Scripts/Gameplay/UI/UIProfileSelector.cs +++ b/Assets/Scripts/Gameplay/UI/UIProfileSelector.cs @@ -1,13 +1,12 @@ using System; using System.Collections.Generic; using System.Text.RegularExpressions; -using Unity.Multiplayer.Samples.BossRoom.Shared; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; +using Unity.BossRoom.Utils; using UnityEngine; using UnityEngine.UI; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { public class UIProfileSelector : MonoBehaviour { diff --git a/Assets/Scripts/Gameplay/UI/UIQuitPanel.cs b/Assets/Scripts/Gameplay/UI/UIQuitPanel.cs index 144e5b283..1c4b706fd 100644 --- a/Assets/Scripts/Gameplay/UI/UIQuitPanel.cs +++ b/Assets/Scripts/Gameplay/UI/UIQuitPanel.cs @@ -1,10 +1,11 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.ApplicationLifecycle.Messages; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; +using Unity.BossRoom.ApplicationLifecycle.Messages; +using Unity.BossRoom.ConnectionManagement; +using Unity.BossRoom.Infrastructure; using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.UI { public class UIQuitPanel : MonoBehaviour { diff --git a/Assets/Scripts/Gameplay/UI/UISettingsCanvas.cs b/Assets/Scripts/Gameplay/UI/UISettingsCanvas.cs index 4db9d64c9..ec3804d70 100644 --- a/Assets/Scripts/Gameplay/UI/UISettingsCanvas.cs +++ b/Assets/Scripts/Gameplay/UI/UISettingsCanvas.cs @@ -1,8 +1,7 @@ using System; using UnityEngine; -using UnityEngine.SceneManagement; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { /// /// Controls the special Canvas that has the settings icon and the settings window. diff --git a/Assets/Scripts/Gameplay/UI/UISettingsPanel.cs b/Assets/Scripts/Gameplay/UI/UISettingsPanel.cs index ae181e1bd..6e2f7d271 100644 --- a/Assets/Scripts/Gameplay/UI/UISettingsPanel.cs +++ b/Assets/Scripts/Gameplay/UI/UISettingsPanel.cs @@ -1,7 +1,10 @@ +using System; +using Unity.BossRoom.Audio; +using Unity.BossRoom.Utils; using UnityEngine; using UnityEngine.UI; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.UI { public class UISettingsPanel : MonoBehaviour diff --git a/Assets/Scripts/Gameplay/UI/UIStateDisplay.cs b/Assets/Scripts/Gameplay/UI/UIStateDisplay.cs index bf37d3065..26e634618 100644 --- a/Assets/Scripts/Gameplay/UI/UIStateDisplay.cs +++ b/Assets/Scripts/Gameplay/UI/UIStateDisplay.cs @@ -1,8 +1,9 @@ -using Unity.Collections; +using System; +using Unity.BossRoom.Utils; using Unity.Netcode; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Gameplay.UI { /// /// Class containing references to UI children that we can display. Both are disabled by default on prefab. diff --git a/Assets/Scripts/Gameplay/UI/UIStateDisplayHandler.cs b/Assets/Scripts/Gameplay/UI/UIStateDisplayHandler.cs index e5afd02b6..ef15dbce5 100644 --- a/Assets/Scripts/Gameplay/UI/UIStateDisplayHandler.cs +++ b/Assets/Scripts/Gameplay/UI/UIStateDisplayHandler.cs @@ -1,9 +1,14 @@ +using System; using System.Collections; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.Infrastructure; +using Unity.BossRoom.Utils; using Unity.Netcode; using UnityEngine; using UnityEngine.Assertions; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.UI { /// /// Class designed to only run on a client. Add this to a world-space prefab to display health or name on UI. @@ -31,14 +36,13 @@ public class UIStateDisplayHandler : NetworkBehaviour bool m_UIStateActive; - [SerializeField] - NetworkNameState m_NetworkNameState; - [SerializeField] NetworkHealthState m_NetworkHealthState; [SerializeField] - ClientCharacter m_ClientCharacter; + NetworkNameState m_NetworkNameState; + + ServerCharacter m_ServerCharacter; ClientAvatarGuidHandler m_ClientAvatarGuidHandler; @@ -71,6 +75,11 @@ public class UIStateDisplayHandler : NetworkBehaviour // used to compute world position based on target and offsets Vector3 m_WorldPos; + void Awake() + { + m_ServerCharacter = GetComponent(); + } + public override void OnNetworkSpawn() { if (!NetworkManager.Singleton.IsClient) @@ -106,9 +115,9 @@ public override void OnNetworkSpawn() { m_BaseHP = m_NetworkAvatarGuidState.RegisteredAvatar.CharacterClass.BaseHP; - if (m_ClientCharacter.ChildVizObject) + if (m_ServerCharacter.clientCharacter) { - TrackGraphicsTransform(m_ClientCharacter.ChildVizObject.gameObject); + TrackGraphicsTransform(m_ServerCharacter.clientCharacter.gameObject); } else { @@ -117,8 +126,8 @@ public override void OnNetworkSpawn() if (m_DisplayHealth) { - m_NetworkHealthState.hitPointsReplenished += DisplayUIHealth; - m_NetworkHealthState.hitPointsDepleted += RemoveUIHealth; + m_NetworkHealthState.HitPointsReplenished += DisplayUIHealth; + m_NetworkHealthState.HitPointsDepleted += RemoveUIHealth; } } @@ -142,8 +151,8 @@ void OnDisable() if (m_NetworkHealthState != null) { - m_NetworkHealthState.hitPointsReplenished -= DisplayUIHealth; - m_NetworkHealthState.hitPointsDepleted -= RemoveUIHealth; + m_NetworkHealthState.HitPointsReplenished -= DisplayUIHealth; + m_NetworkHealthState.HitPointsDepleted -= RemoveUIHealth; } if (m_ClientAvatarGuidHandler) diff --git a/Assets/Scripts/Gameplay/UI/UITinter.cs b/Assets/Scripts/Gameplay/UI/UITinter.cs index 4042810f9..3b5cccb7c 100644 --- a/Assets/Scripts/Gameplay/UI/UITinter.cs +++ b/Assets/Scripts/Gameplay/UI/UITinter.cs @@ -1,7 +1,8 @@ +using System; using UnityEngine; using UnityEngine.UI; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { [RequireComponent(typeof(Image))] public class UITinter : MonoBehaviour diff --git a/Assets/Scripts/Gameplay/UI/UITooltipDetector.cs b/Assets/Scripts/Gameplay/UI/UITooltipDetector.cs index eaeb9d8a4..558221f9e 100644 --- a/Assets/Scripts/Gameplay/UI/UITooltipDetector.cs +++ b/Assets/Scripts/Gameplay/UI/UITooltipDetector.cs @@ -1,7 +1,8 @@ +using System; using UnityEngine; using UnityEngine.EventSystems; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.UI { /// /// Attach to any UI element that should have a tooltip popup. If the mouse hovers over this element diff --git a/Assets/Scripts/Gameplay/UI/UITooltipPopup.cs b/Assets/Scripts/Gameplay/UI/UITooltipPopup.cs index 78cb76888..864bcf0bc 100644 --- a/Assets/Scripts/Gameplay/UI/UITooltipPopup.cs +++ b/Assets/Scripts/Gameplay/UI/UITooltipPopup.cs @@ -1,8 +1,9 @@ -using UnityEngine; +using System; using TMPro; +using UnityEngine; using UnityEngine.Assertions; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.UI { /// /// This controls the tooltip popup -- the little text blurb that appears when you hover your mouse diff --git a/Assets/Scripts/Gameplay/UI/UnityServicesUIHandler.cs b/Assets/Scripts/Gameplay/UI/UnityServicesUIHandler.cs index b6cfdb73c..680dcd91d 100644 --- a/Assets/Scripts/Gameplay/UI/UnityServicesUIHandler.cs +++ b/Assets/Scripts/Gameplay/UI/UnityServicesUIHandler.cs @@ -1,12 +1,12 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Shared; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; -using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Infrastructure; +using Unity.BossRoom.Infrastructure; +using Unity.BossRoom.UnityServices; +using Unity.BossRoom.Utils; using Unity.Services.Lobbies; using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Gameplay.UI { public class UnityServicesUIHandler : MonoBehaviour { diff --git a/Assets/Scripts/Gameplay/Unity.BossRoom.Gameplay.asmdef b/Assets/Scripts/Gameplay/Unity.BossRoom.Gameplay.asmdef index 7c8e77e26..1d1f78c11 100644 --- a/Assets/Scripts/Gameplay/Unity.BossRoom.Gameplay.asmdef +++ b/Assets/Scripts/Gameplay/Unity.BossRoom.Gameplay.asmdef @@ -14,13 +14,14 @@ "Unity.BossRoom.Infrastructure", "Unity.BossRoom.UnityServices", "Unity.BossRoom.Navigation", - "Unity.BossRoom.CameraController", "Unity.BossRoom.ApplicationLifecycle.Messages", "Unity.BossRoom.Audio", "Unity.Multiplayer.Samples.Utilities", "Unity.BossRoom.Utils", "Unity.BossRoom.ConnectionManagement", - "VContainer" + "VContainer", + "Unity.BossRoom.VisualEffects", + "Unity.BossRoom.CameraUtils" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Assets/Scripts/Gameplay/Input.meta b/Assets/Scripts/Gameplay/UserInput.meta similarity index 100% rename from Assets/Scripts/Gameplay/Input.meta rename to Assets/Scripts/Gameplay/UserInput.meta diff --git a/Assets/Scripts/Gameplay/Input/ClientInputSender.cs b/Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs similarity index 86% rename from Assets/Scripts/Gameplay/Input/ClientInputSender.cs rename to Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs index fa40f9b52..d8e67a100 100644 --- a/Assets/Scripts/Gameplay/Input/ClientInputSender.cs +++ b/Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs @@ -1,18 +1,21 @@ using System; -using Unity.Multiplayer.Samples.BossRoom.Actions; +using Unity.BossRoom.Gameplay.Actions; +using Unity.BossRoom.Gameplay.Configuration; +using Unity.BossRoom.Gameplay.GameplayObjects; +using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Assertions; using UnityEngine.EventSystems; -using Action = Unity.Multiplayer.Samples.BossRoom.Actions.Action; +using Action = Unity.BossRoom.Gameplay.Actions.Action; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Gameplay.UserInput { /// /// Captures inputs for a character on a client and sends them to the server. /// - [RequireComponent(typeof(NetworkCharacterState))] + [RequireComponent(typeof(ServerCharacter))] public class ClientInputSender : NetworkBehaviour { const float k_MouseInputRaycastDistance = 100f; @@ -37,12 +40,12 @@ public class ClientInputSender : NetworkBehaviour RaycastHitComparer m_RaycastHitComparer; - NetworkCharacterState m_NetworkCharacter; + ServerCharacter m_ServerCharacter; /// /// This event fires at the time when an action request is sent to the server. /// - public Action ActionInputEvent; + public event Action ActionInputEvent; /// /// This describes how a skill was requested. Skills requested via mouse click will do raycasts to determine their target; skills requested @@ -97,13 +100,10 @@ struct ActionRequest public event Action ClientMoveEvent; - [SerializeField] - CharacterClassContainer m_CharacterClassContainer; - /// /// Convenience getter that returns our CharacterData /// - CharacterClass CharacterData => m_CharacterClassContainer.CharacterClass; + CharacterClass CharacterClass => m_ServerCharacter.CharacterClass; [SerializeField] PhysicsWrapper m_PhysicsWrapper; @@ -125,7 +125,7 @@ public override void OnNetworkSpawn() void Awake() { - m_NetworkCharacter = GetComponent(); + m_ServerCharacter = GetComponent(); m_MainCamera = Camera.main; } @@ -137,7 +137,7 @@ void FinishSkill() void SendInput(ActionRequestData action) { ActionInputEvent?.Invoke(action); - m_NetworkCharacter.RecvDoActionServerRPC(action); + m_ServerCharacter.RecvDoActionServerRPC(action); } void FixedUpdate() @@ -159,7 +159,7 @@ void FixedUpdate() if (actionPrototype.Config.ActionInput != null) { var skillPlayer = Instantiate(actionPrototype.Config.ActionInput); - skillPlayer.Initiate(m_NetworkCharacter, m_PhysicsWrapper.Transform.position, actionPrototype.ActionID, SendInput, FinishSkill); + skillPlayer.Initiate(m_ServerCharacter, m_PhysicsWrapper.Transform.position, actionPrototype.ActionID, SendInput, FinishSkill); m_CurrentSkillInput = skillPlayer; } else @@ -182,7 +182,7 @@ void FixedUpdate() if ((Time.time - m_LastSentMove) > k_MoveSendRateSeconds) { m_LastSentMove = Time.time; - var ray = m_MainCamera.ScreenPointToRay(Input.mousePosition); + var ray = m_MainCamera.ScreenPointToRay(UnityEngine.Input.mousePosition); var groundHits = Physics.RaycastNonAlloc(ray, k_CachedHit, @@ -203,7 +203,7 @@ void FixedUpdate() k_MaxNavMeshDistance, NavMesh.AllAreas)) { - m_NetworkCharacter.SendCharacterInputServerRpc(hit.position); + m_ServerCharacter.SendCharacterInputServerRpc(hit.position); //Send our client only click request ClientMoveEvent?.Invoke(hit.position); @@ -238,7 +238,7 @@ void PerformSkill(ActionID actionID, SkillTriggerStyle triggerStyle, ulong targe int numHits = 0; if (triggerStyle == SkillTriggerStyle.MouseClick) { - var ray = m_MainCamera.ScreenPointToRay(Input.mousePosition); + var ray = m_MainCamera.ScreenPointToRay(UnityEngine.Input.mousePosition); numHits = Physics.RaycastNonAlloc(ray, k_CachedHit, k_MouseInputRaycastDistance, m_ActionLayerMask); } @@ -290,10 +290,10 @@ bool GetActionRequestForTarget(Transform hit, ActionID actionID, SkillTriggerSty var targetNetObj = hit != null ? hit.GetComponentInParent() : null; - //if we can't get our target from the submitted hit transform, get it from our stateful target in our NetworkCharacterState. + //if we can't get our target from the submitted hit transform, get it from our stateful target in our ServerCharacter. if (!targetNetObj && !GameDataSource.Instance.GetActionPrototypeByID(actionID).IsGeneralTargetAction) { - ulong targetId = m_NetworkCharacter.TargetId.Value; + ulong targetId = m_ServerCharacter.TargetId.Value; NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(targetId, out targetNetObj); } @@ -303,13 +303,12 @@ bool GetActionRequestForTarget(Transform hit, ActionID actionID, SkillTriggerSty return false; } - var targetNetState = targetNetObj.GetComponent(); - if (targetNetState != null) + if (targetNetObj.TryGetComponent(out var serverCharacter)) { //Skill1 may be contextually overridden if it was generated from a mouse-click. - if (actionID == CharacterData.Skill1.ActionID && triggerStyle == SkillTriggerStyle.MouseClick) + if (actionID == CharacterClass.Skill1.ActionID && triggerStyle == SkillTriggerStyle.MouseClick) { - if (!targetNetState.IsNpc && targetNetState.LifeState == LifeState.Fainted) + if (!serverCharacter.IsNpc && serverCharacter.LifeState == LifeState.Fainted) { //right-clicked on a downed ally--change the skill play to Revive. actionID = GameDataSource.Instance.ReviveActionPrototype.ActionID; @@ -409,44 +408,44 @@ public void RequestAction(Action action, SkillTriggerStyle triggerStyle, ulong t void Update() { - if (Input.GetKeyDown(KeyCode.Alpha1)) + if (UnityEngine.Input.GetKeyDown(KeyCode.Alpha1)) { - RequestAction(CharacterData.Skill1, SkillTriggerStyle.Keyboard); + RequestAction(CharacterClass.Skill1, SkillTriggerStyle.Keyboard); } - else if (Input.GetKeyUp(KeyCode.Alpha1)) + else if (UnityEngine.Input.GetKeyUp(KeyCode.Alpha1)) { - RequestAction(CharacterData.Skill1, SkillTriggerStyle.KeyboardRelease); + RequestAction(CharacterClass.Skill1, SkillTriggerStyle.KeyboardRelease); } - if (Input.GetKeyDown(KeyCode.Alpha2)) + if (UnityEngine.Input.GetKeyDown(KeyCode.Alpha2)) { - RequestAction(CharacterData.Skill2, SkillTriggerStyle.Keyboard); + RequestAction(CharacterClass.Skill2, SkillTriggerStyle.Keyboard); } - else if (Input.GetKeyUp(KeyCode.Alpha2)) + else if (UnityEngine.Input.GetKeyUp(KeyCode.Alpha2)) { - RequestAction(CharacterData.Skill2, SkillTriggerStyle.KeyboardRelease); + RequestAction(CharacterClass.Skill2, SkillTriggerStyle.KeyboardRelease); } - if (Input.GetKeyDown(KeyCode.Alpha3)) + if (UnityEngine.Input.GetKeyDown(KeyCode.Alpha3)) { - RequestAction(CharacterData.Skill3, SkillTriggerStyle.Keyboard); + RequestAction(CharacterClass.Skill3, SkillTriggerStyle.Keyboard); } - else if (Input.GetKeyUp(KeyCode.Alpha3)) + else if (UnityEngine.Input.GetKeyUp(KeyCode.Alpha3)) { - RequestAction(CharacterData.Skill3, SkillTriggerStyle.KeyboardRelease); + RequestAction(CharacterClass.Skill3, SkillTriggerStyle.KeyboardRelease); } - if (Input.GetKeyDown(KeyCode.Alpha5)) + if (UnityEngine.Input.GetKeyDown(KeyCode.Alpha5)) { RequestAction(GameDataSource.Instance.Emote1ActionPrototype, SkillTriggerStyle.Keyboard); } - if (Input.GetKeyDown(KeyCode.Alpha6)) + if (UnityEngine.Input.GetKeyDown(KeyCode.Alpha6)) { RequestAction(GameDataSource.Instance.Emote2ActionPrototype, SkillTriggerStyle.Keyboard); } - if (Input.GetKeyDown(KeyCode.Alpha7)) + if (UnityEngine.Input.GetKeyDown(KeyCode.Alpha7)) { RequestAction(GameDataSource.Instance.Emote3ActionPrototype, SkillTriggerStyle.Keyboard); } - if (Input.GetKeyDown(KeyCode.Alpha8)) + if (UnityEngine.Input.GetKeyDown(KeyCode.Alpha8)) { RequestAction(GameDataSource.Instance.Emote4ActionPrototype, SkillTriggerStyle.Keyboard); } @@ -456,16 +455,16 @@ void Update() //IsPointerOverGameObject() is a simple way to determine if the mouse is over a UI element. If it is, we don't perform mouse input logic, //to model the button "blocking" mouse clicks from falling through and interacting with the world. - if (Input.GetMouseButtonDown(1)) + if (UnityEngine.Input.GetMouseButtonDown(1)) { - RequestAction(CharacterData.Skill1, SkillTriggerStyle.MouseClick); + RequestAction(CharacterClass.Skill1, SkillTriggerStyle.MouseClick); } - if (Input.GetMouseButtonDown(0)) + if (UnityEngine.Input.GetMouseButtonDown(0)) { RequestAction(GameDataSource.Instance.GeneralTargetActionPrototype, SkillTriggerStyle.MouseClick); } - else if (Input.GetMouseButton(0)) + else if (UnityEngine.Input.GetMouseButton(0)) { m_MoveRequest = true; } diff --git a/Assets/Scripts/Gameplay/Input/ClientInputSender.cs.meta b/Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs.meta similarity index 100% rename from Assets/Scripts/Gameplay/Input/ClientInputSender.cs.meta rename to Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs.meta diff --git a/Assets/Scripts/Infrastructure/DisposableGroup.cs b/Assets/Scripts/Infrastructure/DisposableGroup.cs index d34fbf21e..12b5d67ff 100644 --- a/Assets/Scripts/Infrastructure/DisposableGroup.cs +++ b/Assets/Scripts/Infrastructure/DisposableGroup.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure +namespace Unity.BossRoom.Infrastructure { public class DisposableGroup : IDisposable { diff --git a/Assets/Scripts/Infrastructure/NetworkGuid.cs b/Assets/Scripts/Infrastructure/NetworkGuid.cs index 6109471f8..05eb28377 100644 --- a/Assets/Scripts/Infrastructure/NetworkGuid.cs +++ b/Assets/Scripts/Infrastructure/NetworkGuid.cs @@ -1,7 +1,7 @@ using System; using Unity.Netcode; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Infrastructure { public struct NetworkGuid : INetworkSerializable { diff --git a/Assets/Scripts/Infrastructure/NetworkObjectPool.cs b/Assets/Scripts/Infrastructure/NetworkObjectPool.cs index ab49f0054..4c18daa1a 100644 --- a/Assets/Scripts/Infrastructure/NetworkObjectPool.cs +++ b/Assets/Scripts/Infrastructure/NetworkObjectPool.cs @@ -5,7 +5,7 @@ using UnityEngine; using UnityEngine.Assertions; -namespace BossRoom.Scripts.Shared.Net.NetworkObjectPool +namespace Unity.BossRoom.Infrastructure { /// /// Object Pool for networked objects, used for controlling how objects are spawned by Netcode. Netcode by default will allocate new memory when spawning new diff --git a/Assets/Scripts/Infrastructure/PubSub/BufferedMessageChannel.cs b/Assets/Scripts/Infrastructure/PubSub/BufferedMessageChannel.cs index ecb321684..3a8624d0a 100644 --- a/Assets/Scripts/Infrastructure/PubSub/BufferedMessageChannel.cs +++ b/Assets/Scripts/Infrastructure/PubSub/BufferedMessageChannel.cs @@ -1,6 +1,6 @@ using System; -namespace Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure +namespace Unity.BossRoom.Infrastructure { public class BufferedMessageChannel : MessageChannel, IBufferedMessageChannel { diff --git a/Assets/Scripts/Infrastructure/PubSub/DisposableSubscription.cs b/Assets/Scripts/Infrastructure/PubSub/DisposableSubscription.cs index fd602482f..971ccd72f 100644 --- a/Assets/Scripts/Infrastructure/PubSub/DisposableSubscription.cs +++ b/Assets/Scripts/Infrastructure/PubSub/DisposableSubscription.cs @@ -1,6 +1,6 @@ using System; -namespace Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure +namespace Unity.BossRoom.Infrastructure { /// /// This class is a handle to an active Message Channel subscription and when disposed it unsubscribes from said channel. diff --git a/Assets/Scripts/Infrastructure/PubSub/IMessageChannel.cs b/Assets/Scripts/Infrastructure/PubSub/IMessageChannel.cs index a94a90e6e..b262e4d65 100644 --- a/Assets/Scripts/Infrastructure/PubSub/IMessageChannel.cs +++ b/Assets/Scripts/Infrastructure/PubSub/IMessageChannel.cs @@ -1,6 +1,6 @@ using System; -namespace Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure +namespace Unity.BossRoom.Infrastructure { public interface IPublisher { diff --git a/Assets/Scripts/Infrastructure/PubSub/MessageChannel.cs b/Assets/Scripts/Infrastructure/PubSub/MessageChannel.cs index 8243f31a8..8d8a31fb2 100644 --- a/Assets/Scripts/Infrastructure/PubSub/MessageChannel.cs +++ b/Assets/Scripts/Infrastructure/PubSub/MessageChannel.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using UnityEngine.Assertions; -namespace Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure +namespace Unity.BossRoom.Infrastructure { public class MessageChannel : IMessageChannel { diff --git a/Assets/Scripts/Infrastructure/PubSub/NetworkedMessageChannel.cs b/Assets/Scripts/Infrastructure/PubSub/NetworkedMessageChannel.cs index f1bd3a2b0..39228691c 100644 --- a/Assets/Scripts/Infrastructure/PubSub/NetworkedMessageChannel.cs +++ b/Assets/Scripts/Infrastructure/PubSub/NetworkedMessageChannel.cs @@ -4,7 +4,7 @@ using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure +namespace Unity.BossRoom.Infrastructure { /// /// This type of message channel allows the server to publish a message that will be sent to clients as well as diff --git a/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/Editor/GameEventEditor.cs b/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/Editor/GameEventEditor.cs index 4d04866a0..b4984d3d5 100644 --- a/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/Editor/GameEventEditor.cs +++ b/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/Editor/GameEventEditor.cs @@ -1,7 +1,7 @@ using UnityEditor; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Scripts.Editor +namespace Unity.BossRoom.Infrastructure { /// /// Custom inspector class for GameEvent ScriptableObject class. Overriding OnInspectorGUI() to add debugging diff --git a/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/GameEvent.cs b/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/GameEvent.cs index f015c5e91..77d012089 100644 --- a/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/GameEvent.cs +++ b/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/GameEvent.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Infrastructure { /// /// Class for encapsulating game-related events within ScriptableObject instances. This class defines a List of diff --git a/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/GuidScriptableObject.cs b/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/GuidScriptableObject.cs index 25c1fe9f9..3b37efea4 100644 --- a/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/GuidScriptableObject.cs +++ b/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/GuidScriptableObject.cs @@ -1,7 +1,7 @@ using System; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Infrastructure { /// /// ScriptableObject that stores a GUID for unique identification. The population of this field is implemented diff --git a/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/IGameEventListenable.cs b/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/IGameEventListenable.cs index d0c7d68bd..b0eadf23a 100644 --- a/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/IGameEventListenable.cs +++ b/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/IGameEventListenable.cs @@ -1,4 +1,4 @@ -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Infrastructure { /// /// This class is designed to work hand in hand with the GameEvent class, which is a ScriptableObject container diff --git a/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/IntVariable.cs b/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/IntVariable.cs index e9b41b547..4cc547fac 100644 --- a/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/IntVariable.cs +++ b/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/IntVariable.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Infrastructure { [CreateAssetMenu] public class IntVariable : ScriptableObject diff --git a/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/RuntimeCollection.cs b/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/RuntimeCollection.cs index 151bd0f11..09c386c53 100644 --- a/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/RuntimeCollection.cs +++ b/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/RuntimeCollection.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Infrastructure { /// /// ScriptableObject class that contains a list of a given type. The instance of this ScriptableObject can be diff --git a/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/TransformVariable.cs b/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/TransformVariable.cs deleted file mode 100644 index d3ae2fd5d..000000000 --- a/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/TransformVariable.cs +++ /dev/null @@ -1,14 +0,0 @@ -using UnityEngine; - -namespace Unity.Multiplayer.Samples.BossRoom -{ - /// - /// A ScriptableObject which contains a reference to a Transform component. This can be used to remove dependencies - /// between scene objects. - /// - [CreateAssetMenu] - public class TransformVariable : ScriptableObject - { - public Transform Value; - } -} diff --git a/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/TransformVariable.cs.meta b/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/TransformVariable.cs.meta deleted file mode 100644 index 2a36afbcd..000000000 --- a/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/TransformVariable.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1fe3cde88241ca04db14ceaaa8c11970 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/UnityEventGameEventListener.cs b/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/UnityEventGameEventListener.cs index 41095831c..157815fa9 100644 --- a/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/UnityEventGameEventListener.cs +++ b/Assets/Scripts/Infrastructure/ScriptableObjectArchitecture/UnityEventGameEventListener.cs @@ -2,7 +2,7 @@ using UnityEngine.Assertions; using UnityEngine.Events; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Infrastructure { /// /// This class implements the IGameEventListener interface and exposes a GameEvent that we can populate within the diff --git a/Assets/Scripts/Infrastructure/UpdateRunner.cs b/Assets/Scripts/Infrastructure/UpdateRunner.cs index ae8dbb3f5..2a9a954b7 100644 --- a/Assets/Scripts/Infrastructure/UpdateRunner.cs +++ b/Assets/Scripts/Infrastructure/UpdateRunner.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure +namespace Unity.BossRoom.Infrastructure { /// /// Some objects might need to be on a slower update loop than the usual MonoBehaviour Update and without precise timing, e.g. to refresh data from services. diff --git a/Assets/Scripts/Navigation/DynamicNavObstacle.cs b/Assets/Scripts/Navigation/DynamicNavObstacle.cs deleted file mode 100644 index 32bc3fce2..000000000 --- a/Assets/Scripts/Navigation/DynamicNavObstacle.cs +++ /dev/null @@ -1,39 +0,0 @@ -using UnityEngine; -using UnityEngine.AI; -using UnityEngine.Assertions; - -namespace Unity.Multiplayer.Samples.BossRoom.Server -{ - [DefaultExecutionOrder(10000)] // The enable/disable triggers have to be called after the triggers from NavMeshObstacle which update the nav mesh. - [RequireComponent(typeof(NavMeshObstacle))] - public sealed class DynamicNavObstacle : MonoBehaviour - { - private NavigationSystem m_NavigationSystem; - - private void Awake() - { - m_NavigationSystem = GameObject.FindGameObjectWithTag(NavigationSystem.NavigationSystemTag).GetComponent(); - } - - private void OnValidate() - { - if (gameObject.scene.rootCount > 1) // Hacky way for checking if this is a scene object or a prefab instance and not a prefab definition. - { - Assert.IsNotNull( - GameObject.FindGameObjectWithTag(NavigationSystem.NavigationSystemTag)?.GetComponent(), - $"NavigationSystem not found. Is there a NavigationSystem Behaviour in the Scene and does its GameObject have the {NavigationSystem.NavigationSystemTag} tag?" - ); - } - } - - private void OnEnable() - { - m_NavigationSystem.OnDynamicObstacleEnabled(); - } - - private void OnDisable() - { - m_NavigationSystem.OnDynamicObstacleDisabled(); - } - } -} diff --git a/Assets/Scripts/Navigation/DynamicNavObstacle.cs.meta b/Assets/Scripts/Navigation/DynamicNavObstacle.cs.meta deleted file mode 100644 index 8ce6b52a3..000000000 --- a/Assets/Scripts/Navigation/DynamicNavObstacle.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b6ec113fefb19754c8dc3087500d9f1e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Navigation/DynamicNavPath.cs b/Assets/Scripts/Navigation/DynamicNavPath.cs index 6ecab3e70..0b467a613 100644 --- a/Assets/Scripts/Navigation/DynamicNavPath.cs +++ b/Assets/Scripts/Navigation/DynamicNavPath.cs @@ -3,7 +3,7 @@ using UnityEngine; using UnityEngine.AI; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Navigation { public sealed class DynamicNavPath : IDisposable { diff --git a/Assets/Scripts/Navigation/NavigationSystem.cs b/Assets/Scripts/Navigation/NavigationSystem.cs index 6d8bed464..669e7496a 100644 --- a/Assets/Scripts/Navigation/NavigationSystem.cs +++ b/Assets/Scripts/Navigation/NavigationSystem.cs @@ -1,7 +1,7 @@ using UnityEngine; using UnityEngine.Assertions; -namespace Unity.Multiplayer.Samples.BossRoom.Server +namespace Unity.BossRoom.Navigation { /// /// This system exists to coordinate path finding and navigation functionality in a scene. diff --git a/Assets/Scripts/UnityServices/Auth/AuthenticationServiceFacade.cs b/Assets/Scripts/UnityServices/Auth/AuthenticationServiceFacade.cs index a25a258a7..c8f8396aa 100644 --- a/Assets/Scripts/UnityServices/Auth/AuthenticationServiceFacade.cs +++ b/Assets/Scripts/UnityServices/Auth/AuthenticationServiceFacade.cs @@ -1,13 +1,12 @@ using System; using System.Threading.Tasks; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; -using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Infrastructure; +using Unity.BossRoom.Infrastructure; using Unity.Services.Authentication; using Unity.Services.Core; using UnityEngine; using VContainer; -namespace BossRoom.Scripts.Shared.Net.UnityServices.Auth +namespace Unity.BossRoom.UnityServices.Auth { public class AuthenticationServiceFacade { diff --git a/Assets/Scripts/UnityServices/Infrastructure/Messages/UnityServiceErrorMessage.cs b/Assets/Scripts/UnityServices/Infrastructure/Messages/UnityServiceErrorMessage.cs index eabee4172..f24733baa 100644 --- a/Assets/Scripts/UnityServices/Infrastructure/Messages/UnityServiceErrorMessage.cs +++ b/Assets/Scripts/UnityServices/Infrastructure/Messages/UnityServiceErrorMessage.cs @@ -1,6 +1,6 @@ using System; -namespace Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Infrastructure +namespace Unity.BossRoom.UnityServices { public struct UnityServiceErrorMessage { diff --git a/Assets/Scripts/UnityServices/Infrastructure/RateLimitCooldown.cs b/Assets/Scripts/UnityServices/Infrastructure/RateLimitCooldown.cs index ee1a127ff..80549dab1 100644 --- a/Assets/Scripts/UnityServices/Infrastructure/RateLimitCooldown.cs +++ b/Assets/Scripts/UnityServices/Infrastructure/RateLimitCooldown.cs @@ -1,9 +1,7 @@ using System; -using System.Collections.Generic; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Infrastructure +namespace Unity.BossRoom.UnityServices { public class RateLimitCooldown { diff --git a/Assets/Scripts/UnityServices/Lobbies/JoinedLobbyContentHeartbeat.cs b/Assets/Scripts/UnityServices/Lobbies/JoinedLobbyContentHeartbeat.cs index ce788fbd1..f63e28312 100644 --- a/Assets/Scripts/UnityServices/Lobbies/JoinedLobbyContentHeartbeat.cs +++ b/Assets/Scripts/UnityServices/Lobbies/JoinedLobbyContentHeartbeat.cs @@ -1,7 +1,7 @@ -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; +using Unity.BossRoom.Infrastructure; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies +namespace Unity.BossRoom.UnityServices.Lobbies { /// /// Keep updated on changes to a joined lobby, at a speed compliant with Lobby's rate limiting. diff --git a/Assets/Scripts/UnityServices/Lobbies/LobbyAPIInterface.cs b/Assets/Scripts/UnityServices/Lobbies/LobbyAPIInterface.cs index 18ad06396..033dfe386 100644 --- a/Assets/Scripts/UnityServices/Lobbies/LobbyAPIInterface.cs +++ b/Assets/Scripts/UnityServices/Lobbies/LobbyAPIInterface.cs @@ -1,14 +1,13 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; -using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Infrastructure; +using Unity.BossRoom.Infrastructure; using Unity.Services.Lobbies; using Unity.Services.Lobbies.Models; using UnityEngine; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies +namespace Unity.BossRoom.UnityServices.Lobbies { using Lobbies = Unity.Services.Lobbies.Lobbies; diff --git a/Assets/Scripts/UnityServices/Lobbies/LobbyServiceFacade.cs b/Assets/Scripts/UnityServices/Lobbies/LobbyServiceFacade.cs index 8bf063499..a5e9e7681 100644 --- a/Assets/Scripts/UnityServices/Lobbies/LobbyServiceFacade.cs +++ b/Assets/Scripts/UnityServices/Lobbies/LobbyServiceFacade.cs @@ -1,8 +1,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; -using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Infrastructure; +using Unity.BossRoom.Infrastructure; using Unity.Services.Authentication; using Unity.Services.Lobbies; using Unity.Services.Lobbies.Models; @@ -10,7 +9,7 @@ using VContainer; using VContainer.Unity; -namespace Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies +namespace Unity.BossRoom.UnityServices.Lobbies { /// /// An abstraction layer between the direct calls into the Lobby API and the outcomes you actually want. diff --git a/Assets/Scripts/UnityServices/Lobbies/LocalLobby.cs b/Assets/Scripts/UnityServices/Lobbies/LocalLobby.cs index 920dd0193..9629bfdef 100644 --- a/Assets/Scripts/UnityServices/Lobbies/LocalLobby.cs +++ b/Assets/Scripts/UnityServices/Lobbies/LocalLobby.cs @@ -3,7 +3,7 @@ using Unity.Services.Lobbies.Models; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies +namespace Unity.BossRoom.UnityServices.Lobbies { /// /// A local wrapper around a lobby's remote data, with additional functionality for providing that data to UI elements and tracking local player objects. diff --git a/Assets/Scripts/UnityServices/Lobbies/LocalLobbyUser.cs b/Assets/Scripts/UnityServices/Lobbies/LocalLobbyUser.cs index cd1af7252..ec3676443 100644 --- a/Assets/Scripts/UnityServices/Lobbies/LocalLobbyUser.cs +++ b/Assets/Scripts/UnityServices/Lobbies/LocalLobbyUser.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using Unity.Services.Lobbies.Models; -namespace Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies +namespace Unity.BossRoom.UnityServices.Lobbies { /// /// Data for a local lobby user instance. This will update data and is observed to know when to push local user changes to the entire lobby. diff --git a/Assets/Scripts/UnityServices/Lobbies/Messages/LobbyListFetchedMessage.cs b/Assets/Scripts/UnityServices/Lobbies/Messages/LobbyListFetchedMessage.cs index 29709d621..e1879e015 100644 --- a/Assets/Scripts/UnityServices/Lobbies/Messages/LobbyListFetchedMessage.cs +++ b/Assets/Scripts/UnityServices/Lobbies/Messages/LobbyListFetchedMessage.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies +namespace Unity.BossRoom.UnityServices.Lobbies { public struct LobbyListFetchedMessage { diff --git a/Assets/Scripts/Utils/ClientPrefs.cs b/Assets/Scripts/Utils/ClientPrefs.cs index d5e59e186..4f06f78bd 100644 --- a/Assets/Scripts/Utils/ClientPrefs.cs +++ b/Assets/Scripts/Utils/ClientPrefs.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Utils { /// /// Singleton class which saves/loads local-client settings. diff --git a/Assets/Scripts/Utils/EnableOrDisableColliderOnAwake.cs b/Assets/Scripts/Utils/EnableOrDisableColliderOnAwake.cs index 4d229762c..dcc4faaeb 100644 --- a/Assets/Scripts/Utils/EnableOrDisableColliderOnAwake.cs +++ b/Assets/Scripts/Utils/EnableOrDisableColliderOnAwake.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Utils { public class EnableOrDisableColliderOnAwake : MonoBehaviour { diff --git a/Assets/Scripts/Utils/NetworkNameState.cs b/Assets/Scripts/Utils/NetworkNameState.cs index 318c2ea61..f70a8ffda 100644 --- a/Assets/Scripts/Utils/NetworkNameState.cs +++ b/Assets/Scripts/Utils/NetworkNameState.cs @@ -3,7 +3,7 @@ using Unity.Netcode; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Utils { /// /// NetworkBehaviour containing only one NetworkVariableString which represents this object's name. diff --git a/Assets/Scripts/Utils/NetworkOverlay/NetworkLatencyWarning.cs b/Assets/Scripts/Utils/NetworkOverlay/NetworkLatencyWarning.cs index 2c1ab6897..7cdeb0eaf 100644 --- a/Assets/Scripts/Utils/NetworkOverlay/NetworkLatencyWarning.cs +++ b/Assets/Scripts/Utils/NetworkOverlay/NetworkLatencyWarning.cs @@ -1,13 +1,12 @@ using System; using TMPro; using UnityEngine; -using UnityEngine.UI; using Unity.Netcode; using Unity.Netcode.Transports.UTP; using UnityEngine.Assertions; -namespace Unity.Multiplayer.Samples.BossRoom.Editor +namespace Unity.BossRoom.Utils.Editor { public class NetworkLatencyWarning : MonoBehaviour { diff --git a/Assets/Scripts/Utils/NetworkOverlay/NetworkOverlay.cs b/Assets/Scripts/Utils/NetworkOverlay/NetworkOverlay.cs index 952267cef..2743558d1 100644 --- a/Assets/Scripts/Utils/NetworkOverlay/NetworkOverlay.cs +++ b/Assets/Scripts/Utils/NetworkOverlay/NetworkOverlay.cs @@ -2,7 +2,7 @@ using UnityEngine; using UnityEngine.UI; -namespace Unity.Multiplayer.Samples.BossRoom.Editor +namespace Unity.BossRoom.Utils.Editor { public class NetworkOverlay : MonoBehaviour { diff --git a/Assets/Scripts/Utils/NetworkOverlay/NetworkStats.cs b/Assets/Scripts/Utils/NetworkOverlay/NetworkStats.cs index 3bee4a3e5..67b13b412 100644 --- a/Assets/Scripts/Utils/NetworkOverlay/NetworkStats.cs +++ b/Assets/Scripts/Utils/NetworkOverlay/NetworkStats.cs @@ -4,7 +4,7 @@ using UnityEngine; using UnityEngine.Assertions; -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Utils { /// This utility help showing Network statistics at runtime. /// diff --git a/Assets/Scripts/Utils/PositionLerper.cs b/Assets/Scripts/Utils/PositionLerper.cs index 4cd6d3e68..d0f9510bd 100644 --- a/Assets/Scripts/Utils/PositionLerper.cs +++ b/Assets/Scripts/Utils/PositionLerper.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Utils { /// /// Utility struct to linearly interpolate between two Vector3 values. Allows for flexible linear interpolations diff --git a/Assets/Scripts/Utils/PrefabSpawner.cs b/Assets/Scripts/Utils/PrefabSpawner.cs index 531469fcd..cc596094a 100644 --- a/Assets/Scripts/Utils/PrefabSpawner.cs +++ b/Assets/Scripts/Utils/PrefabSpawner.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Client +namespace Unity.BossRoom.Utils { public class PrefabSpawner : MonoBehaviour { diff --git a/Assets/Scripts/Utils/ProfileManager.cs b/Assets/Scripts/Utils/ProfileManager.cs index 42b808182..aa7c75713 100644 --- a/Assets/Scripts/Utils/ProfileManager.cs +++ b/Assets/Scripts/Utils/ProfileManager.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using Unity.Multiplayer.Samples.BossRoom.Client; #if UNITY_EDITOR using System.Security.Cryptography; @@ -10,7 +9,7 @@ using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Shared +namespace Unity.BossRoom.Utils { public class ProfileManager { diff --git a/Assets/Scripts/Utils/RotationLerper.cs b/Assets/Scripts/Utils/RotationLerper.cs index ec7aff51f..be4aef171 100644 --- a/Assets/Scripts/Utils/RotationLerper.cs +++ b/Assets/Scripts/Utils/RotationLerper.cs @@ -1,7 +1,7 @@ using System; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.Utils { /// /// Utility struct to linearly interpolate between two Quaternion values. Allows for flexible linear interpolations diff --git a/Assets/Scripts/Utils/SelfDisable.cs b/Assets/Scripts/Utils/SelfDisable.cs index 8dbd289dd..3215b04de 100644 --- a/Assets/Scripts/Utils/SelfDisable.cs +++ b/Assets/Scripts/Utils/SelfDisable.cs @@ -1,25 +1,27 @@ using UnityEngine; -/// -/// Will Disable this game object once active after the delay duration has passed. -/// -public class SelfDisable : MonoBehaviour +namespace Unity.BossRoom.Utils { - [SerializeField] - float m_DisabledDelay; - float m_DisableTimestamp; - - // Update is called once per frame - void Update() + /// + /// Will Disable this game object once active after the delay duration has passed. + /// + public class SelfDisable : MonoBehaviour { - if (Time.time >= m_DisableTimestamp) + [SerializeField] + float m_DisabledDelay; + float m_DisableTimestamp; + + void Update() { - gameObject.SetActive(false); + if (Time.time >= m_DisableTimestamp) + { + gameObject.SetActive(false); + } } - } - void OnEnable() - { - m_DisableTimestamp = Time.time + m_DisabledDelay; + void OnEnable() + { + m_DisableTimestamp = Time.time + m_DisabledDelay; + } } } diff --git a/Assets/Scripts/Utils/TimedSelfDestruct.cs b/Assets/Scripts/Utils/TimedSelfDestruct.cs index 833142f0a..c8df7b1aa 100644 --- a/Assets/Scripts/Utils/TimedSelfDestruct.cs +++ b/Assets/Scripts/Utils/TimedSelfDestruct.cs @@ -15,7 +15,7 @@ /// Also, performance note: self-destruction is a convenient idiom but not the most performant one. In games /// for mobile devices (and other lower-graphics-power platforms), it's best to use object pooling instead. /// -namespace Unity.Multiplayer.Samples.BossRoom +namespace Unity.BossRoom.Utils { public class TimedSelfDestruct : MonoBehaviour { diff --git a/Assets/Scripts/VisualEffects/RandomizedLight.cs b/Assets/Scripts/VisualEffects/RandomizedLight.cs index 86bc035af..f411b26de 100644 --- a/Assets/Scripts/VisualEffects/RandomizedLight.cs +++ b/Assets/Scripts/VisualEffects/RandomizedLight.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.VisualEffects { /// /// This script randomly varies a light source to create a flickering effect. diff --git a/Assets/Scripts/VisualEffects/ScrollingMaterialUVs.cs b/Assets/Scripts/VisualEffects/ScrollingMaterialUVs.cs index e2debc29b..7b5f683f7 100644 --- a/Assets/Scripts/VisualEffects/ScrollingMaterialUVs.cs +++ b/Assets/Scripts/VisualEffects/ScrollingMaterialUVs.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.VisualEffects { public class ScrollingMaterialUVs : MonoBehaviour { diff --git a/Assets/Scripts/Utils/SpecialFXGraphic.cs b/Assets/Scripts/VisualEffects/SpecialFXGraphic.cs similarity index 99% rename from Assets/Scripts/Utils/SpecialFXGraphic.cs rename to Assets/Scripts/VisualEffects/SpecialFXGraphic.cs index 6ee06c273..8b924929a 100644 --- a/Assets/Scripts/Utils/SpecialFXGraphic.cs +++ b/Assets/Scripts/VisualEffects/SpecialFXGraphic.cs @@ -6,7 +6,7 @@ using UnityEditor; #endif -namespace Unity.Multiplayer.Samples.BossRoom.Visual +namespace Unity.BossRoom.VisualEffects { /// /// Utility script attached to special-effects prefabs. These prefabs are diff --git a/Assets/Scripts/Utils/SpecialFXGraphic.cs.meta b/Assets/Scripts/VisualEffects/SpecialFXGraphic.cs.meta similarity index 100% rename from Assets/Scripts/Utils/SpecialFXGraphic.cs.meta rename to Assets/Scripts/VisualEffects/SpecialFXGraphic.cs.meta diff --git a/Assets/Tests/Runtime/ConnectionManagementTests.cs b/Assets/Tests/Runtime/ConnectionManagementTests.cs index 41e109f29..c197be613 100644 --- a/Assets/Tests/Runtime/ConnectionManagementTests.cs +++ b/Assets/Tests/Runtime/ConnectionManagementTests.cs @@ -1,11 +1,11 @@ using System; using System.Collections; -using System.Collections.Generic; using NUnit.Framework; -using Unity.Multiplayer.Samples.BossRoom.Shared; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; -using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Infrastructure; -using Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies; +using Unity.BossRoom.ConnectionManagement; +using Unity.BossRoom.Infrastructure; +using Unity.BossRoom.UnityServices; +using Unity.BossRoom.UnityServices.Lobbies; +using Unity.BossRoom.Utils; using Unity.Multiplayer.Samples.Utilities; using Unity.Netcode; using Unity.Netcode.TestHelpers.Runtime; @@ -15,7 +15,7 @@ using VContainer; using VContainer.Unity; -namespace Unity.Multiplayer.Samples.BossRoom.Tests.Runtime +namespace Unity.BossRoom.Tests.Runtime { public class ConnectionManagementTests : NetcodeIntegrationTest { diff --git a/Assets/Tests/Runtime/HostAndDisconnectTest.cs b/Assets/Tests/Runtime/HostAndDisconnectTest.cs index 3e007b76d..df395a848 100644 --- a/Assets/Tests/Runtime/HostAndDisconnectTest.cs +++ b/Assets/Tests/Runtime/HostAndDisconnectTest.cs @@ -1,8 +1,8 @@ using System; using System.Collections; +using Unity.BossRoom.Gameplay.GameState; +using Unity.BossRoom.Gameplay.UI; using NUnit.Framework; -using Unity.Multiplayer.Samples.BossRoom.Client; -using Unity.Multiplayer.Samples.BossRoom.Visual; using Unity.Multiplayer.Samples.Utilities; using Unity.Netcode; using UnityEngine; @@ -10,7 +10,7 @@ using UnityEngine.TestTools; using VContainer; -namespace Unity.Multiplayer.Samples.BossRoom.Tests.Runtime +namespace Unity.BossRoom.Tests.Runtime { public class HostAndDisconnectTest { diff --git a/Assets/Tests/Runtime/MessageChannelTest.cs b/Assets/Tests/Runtime/MessageChannelTest.cs index 2cc96fdba..9bdf742f7 100644 --- a/Assets/Tests/Runtime/MessageChannelTest.cs +++ b/Assets/Tests/Runtime/MessageChannelTest.cs @@ -1,9 +1,9 @@ using System; using NUnit.Framework; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; +using Unity.BossRoom.Infrastructure; using UnityEngine; -namespace Unity.Multiplayer.Samples.BossRoom.Tests.Runtime +namespace Unity.BossRoom.Tests.Runtime { public class MessageChannelTests { diff --git a/Assets/Tests/Runtime/NetworkedMessageChannelTests.cs b/Assets/Tests/Runtime/NetworkedMessageChannelTests.cs index 3f275e085..511dc121c 100644 --- a/Assets/Tests/Runtime/NetworkedMessageChannelTests.cs +++ b/Assets/Tests/Runtime/NetworkedMessageChannelTests.cs @@ -1,7 +1,7 @@ using System; using System.Collections; using NUnit.Framework; -using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure; +using Unity.BossRoom.Infrastructure; using Unity.Netcode; using UnityEngine; using Unity.Netcode.TestHelpers.Runtime; @@ -9,7 +9,7 @@ using VContainer; using Assert = UnityEngine.Assertions.Assert; -namespace Unity.Multiplayer.Samples.BossRoom.Tests.Runtime +namespace Unity.BossRoom.Tests.Runtime { public class NetworkedMessageChannelTests : NetcodeIntegrationTest { diff --git a/Assets/VFX/Prefabs/Archer/fx_ArrowGraphics.prefab b/Assets/VFX/Prefabs/Archer/fx_ArrowGraphics.prefab index 08fd9e087..1cf62255b 100644 --- a/Assets/VFX/Prefabs/Archer/fx_ArrowGraphics.prefab +++ b/Assets/VFX/Prefabs/Archer/fx_ArrowGraphics.prefab @@ -11,7 +11,6 @@ GameObject: - component: {fileID: 3325143161705299546} - component: {fileID: 445632146649864073} - component: {fileID: 7463718357983197496} - - component: {fileID: 153916515354694390} m_Layer: 0 m_Name: fx_ArrowGraphics m_TagString: Untagged @@ -29,6 +28,7 @@ Transform: m_LocalRotation: {x: 0.000000021855694, y: 0.00000011920929, z: -2.6054018e-15, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 757528979405128990} m_Father: {fileID: 0} @@ -53,6 +53,7 @@ MeshRenderer: m_CastShadows: 0 m_ReceiveShadows: 1 m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -83,20 +84,6 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!114 &153916515354694390 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4371491365999748502} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a45006257d512344ba116bae366f7757, type: 3} - m_Name: - m_EditorClassIdentifier: - m_OnHitParticlePrefab: {fileID: 0} - m_TrailRenderer: {fileID: 939547987977570762} --- !u!1001 &8427704294362486480 PrefabInstance: m_ObjectHideFlags: 0 @@ -179,8 +166,3 @@ Transform: m_CorrespondingSourceObject: {fileID: 9112595075296351182, guid: 660b64eb444497d41af2c727909eb671, type: 3} m_PrefabInstance: {fileID: 8427704294362486480} m_PrefabAsset: {fileID: 0} ---- !u!96 &939547987977570762 stripped -TrailRenderer: - m_CorrespondingSourceObject: {fileID: 8790122182988832538, guid: 660b64eb444497d41af2c727909eb671, type: 3} - m_PrefabInstance: {fileID: 8427704294362486480} - m_PrefabAsset: {fileID: 0} diff --git a/Assets/VFX/Prefabs/Archer/fx_ChargedArrow1Graphics.prefab b/Assets/VFX/Prefabs/Archer/fx_ChargedArrow1Graphics.prefab index cd94c1a67..0fd3d97e2 100644 --- a/Assets/VFX/Prefabs/Archer/fx_ChargedArrow1Graphics.prefab +++ b/Assets/VFX/Prefabs/Archer/fx_ChargedArrow1Graphics.prefab @@ -11,7 +11,6 @@ GameObject: - component: {fileID: 3325143161705299546} - component: {fileID: 445632146649864073} - component: {fileID: 7463718357983197496} - - component: {fileID: 153916515354694390} m_Layer: 0 m_Name: fx_ChargedArrow1Graphics m_TagString: Untagged @@ -29,6 +28,7 @@ Transform: m_LocalRotation: {x: 0.000000021855694, y: 0.00000011920929, z: -2.6054018e-15, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1.5, y: 1.5, z: 1.5} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 4275796242942192563} m_Father: {fileID: 0} @@ -53,6 +53,7 @@ MeshRenderer: m_CastShadows: 0 m_ReceiveShadows: 1 m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -83,20 +84,6 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!114 &153916515354694390 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4371491365999748502} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a45006257d512344ba116bae366f7757, type: 3} - m_Name: - m_EditorClassIdentifier: - m_OnHitParticlePrefab: {fileID: 8618909711417914730, guid: dc9de50a71cc1854586afa8a275a6a6b, type: 3} - m_TrailRenderer: {fileID: 4385405951865464679} --- !u!1001 &4981226344026716285 PrefabInstance: m_ObjectHideFlags: 0 @@ -399,8 +386,3 @@ Transform: m_CorrespondingSourceObject: {fileID: 9112595075296351182, guid: 660b64eb444497d41af2c727909eb671, type: 3} m_PrefabInstance: {fileID: 4981226344026716285} m_PrefabAsset: {fileID: 0} ---- !u!96 &4385405951865464679 stripped -TrailRenderer: - m_CorrespondingSourceObject: {fileID: 8790122182988832538, guid: 660b64eb444497d41af2c727909eb671, type: 3} - m_PrefabInstance: {fileID: 4981226344026716285} - m_PrefabAsset: {fileID: 0} diff --git a/Assets/VFX/Prefabs/Archer/fx_ChargedArrow2Graphics.prefab b/Assets/VFX/Prefabs/Archer/fx_ChargedArrow2Graphics.prefab index 4f52e99b9..7b51e9aef 100644 --- a/Assets/VFX/Prefabs/Archer/fx_ChargedArrow2Graphics.prefab +++ b/Assets/VFX/Prefabs/Archer/fx_ChargedArrow2Graphics.prefab @@ -11,7 +11,6 @@ GameObject: - component: {fileID: 3325143161705299546} - component: {fileID: 445632146649864073} - component: {fileID: 7463718357983197496} - - component: {fileID: 153916515354694390} m_Layer: 0 m_Name: fx_ChargedArrow2Graphics m_TagString: Untagged @@ -29,6 +28,7 @@ Transform: m_LocalRotation: {x: 0.000000021855694, y: 0.00000011920929, z: -2.6054018e-15, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1.5, y: 1.5, z: 1.5} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 4275796242942192563} m_Father: {fileID: 0} @@ -53,6 +53,7 @@ MeshRenderer: m_CastShadows: 0 m_ReceiveShadows: 1 m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -83,20 +84,6 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!114 &153916515354694390 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4371491365999748502} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a45006257d512344ba116bae366f7757, type: 3} - m_Name: - m_EditorClassIdentifier: - m_OnHitParticlePrefab: {fileID: -6745866273066112404, guid: ae64395b058ab5e4db24271fb6fadb93, type: 3} - m_TrailRenderer: {fileID: 4385405951379145903} --- !u!1001 &4981226344026716285 PrefabInstance: m_ObjectHideFlags: 0 @@ -395,8 +382,3 @@ Transform: m_CorrespondingSourceObject: {fileID: 9112595075296351182, guid: 660b64eb444497d41af2c727909eb671, type: 3} m_PrefabInstance: {fileID: 4981226344026716285} m_PrefabAsset: {fileID: 0} ---- !u!96 &4385405951379145903 stripped -TrailRenderer: - m_CorrespondingSourceObject: {fileID: 8790122182468517074, guid: 660b64eb444497d41af2c727909eb671, type: 3} - m_PrefabInstance: {fileID: 4981226344026716285} - m_PrefabAsset: {fileID: 0} diff --git a/Assets/VFX/Prefabs/Archer/fx_ChargedArrow3Graphics.prefab b/Assets/VFX/Prefabs/Archer/fx_ChargedArrow3Graphics.prefab index 7eee9df90..848062311 100644 --- a/Assets/VFX/Prefabs/Archer/fx_ChargedArrow3Graphics.prefab +++ b/Assets/VFX/Prefabs/Archer/fx_ChargedArrow3Graphics.prefab @@ -11,7 +11,6 @@ GameObject: - component: {fileID: 3325143161705299546} - component: {fileID: 445632146649864073} - component: {fileID: 7463718357983197496} - - component: {fileID: 153916515354694390} m_Layer: 0 m_Name: fx_ChargedArrow3Graphics m_TagString: Untagged @@ -29,6 +28,7 @@ Transform: m_LocalRotation: {x: 0.000000021855694, y: 0.00000011920929, z: -2.6054018e-15, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1.5, y: 1.5, z: 1.5} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 4275796242942192563} m_Father: {fileID: 0} @@ -53,6 +53,7 @@ MeshRenderer: m_CastShadows: 0 m_ReceiveShadows: 1 m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -83,20 +84,6 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!114 &153916515354694390 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4371491365999748502} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a45006257d512344ba116bae366f7757, type: 3} - m_Name: - m_EditorClassIdentifier: - m_OnHitParticlePrefab: {fileID: 4562743285343113751, guid: 274d5f31ee594904399cb65bae8ec339, type: 3} - m_TrailRenderer: {fileID: 4385405950053795736} --- !u!1001 &4981226344026716285 PrefabInstance: m_ObjectHideFlags: 0 @@ -331,8 +318,3 @@ Transform: m_CorrespondingSourceObject: {fileID: 9112595075296351182, guid: 660b64eb444497d41af2c727909eb671, type: 3} m_PrefabInstance: {fileID: 4981226344026716285} m_PrefabAsset: {fileID: 0} ---- !u!96 &4385405950053795736 stripped -TrailRenderer: - m_CorrespondingSourceObject: {fileID: 8790122183726792677, guid: 660b64eb444497d41af2c727909eb671, type: 3} - m_PrefabInstance: {fileID: 4981226344026716285} - m_PrefabAsset: {fileID: 0} diff --git a/CHANGELOG.md b/CHANGELOG.md index 147bc8312..65884afc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ Additional documentation and release notes are available at [Multiplayer Documen * Replaced our dependency injection solution with VContainer. (#679) * NetworkedMessageChannels can now be subscribed to before initiating a connection (#670) * Refactored connection management into simpler state machine (#666) -* Merged GameState bridge classes (the ones that contained no or limited functionality) (#697) This cleans up our sometimes too verbose code split. +* Merged GameState bridge classes (the ones that contained no or limited functionality) (#697 #732) This cleans up our sometimes too verbose code split. * Modified the red arrow of the boss charge attack to fade in and out (rather than just being enabled disabled) (#715) * Rearranged the Action system by adding more folders that separate different pieces more clearly (#701) * Action and ActionFX classes have been merged into a single Scriptable Object-based Action class; all the existing actions have been refactored to follow this new design (#705) @@ -32,7 +32,11 @@ Additional documentation and release notes are available at [Multiplayer Documen * Instead of a NetworkBehaviour that carries a WinState netvar we now pass the win state on the server to the PostGame scene and it then stores that state in the netvar, eliminating the need to preserve a NetworkBehaviour-bearing gameObject across scenes. (#724) * Bump to NGO 1.0.1 (#720) * Reduced the MaxPacketQueueSize UTP parameter value from 512 to 256 (#728). This reduces the amount of memory used by UTP by around 1 MB. Boss Room does not need a bigger queue size than this because there can only be 7 clients connected to a host and UTP already limits the maximum number of in-flight packets to 32 per connection. -* +* Cleanup + * Namespaces in the project have been changed to map to their assembly definitions (#732) + * Numerous name changes for fields and variables to match their new type names (#732) + * Removed DynamicNavObstacle - an unused class (#732) + * Merged networked data classes into their Server counterparts. An example of that change is the contents of NetworkCharacterState getting moved into ServerCharacter, contents of NetworkDoorState getting moved into SwitchedDoor etc. (#732) ### Removed * ### Fixed