From 38bc89e1122800909c4b8e25cbd0927ae45a1af0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Buratto?= <46575243+joaoburatto@users.noreply.github.com> Date: Tue, 17 Jan 2023 15:10:30 -0300 Subject: [PATCH] Include Minds to Entity workflow (#974) * Rename PlayerControllable to Entity * Continue Mind inclusion to player workflow * Reorganize a bit how the stamina system is laid out * Add sync var callback for stamina * Remove FindObjectOfType * Rename PlayerControlSystem to PlayerSystem and fix bugs * Rename UI * Fix missing custom editor * Change variable naming * Code cleanup * Fix errors when late joining as a client after the round started * Remove debug.logs * Fix NullRef Exceptions * Add documentation and reorganize methods * Change how the inventory UI is loaded Co-authored-by: TaylorNAlbarnaz --- Assets/AddressableAssetsData/link.xml | 16 + .../link.xml.meta} | 5 +- .../Content/Data/DefaultPrefabObjects.asset | 2 + .../Entities/Human/Human_Temporary.prefab | 10 +- Assets/Content/Entities/Mind.prefab | 138 +++ Assets/Content/Entities/Mind.prefab.meta | 7 + .../Silicon/Engineer Borg/Engi Borg.prefab | 6 +- .../Items/Generic/ToolBoxes/Toolbox.asset | 20 - .../{RedToolbox.prefab => ToolboxBlue.prefab} | 39 +- ...ox.prefab.meta => ToolboxBlue.prefab.meta} | 0 Assets/Content/UI/HumanoidInventory.prefab | 241 +++-- .../UI/Lobby/Canvas/Player Canvas.prefab | 90 +- .../Content/UI/StaminaBar/StaminaBar.prefab | 2 +- Assets/Scenes/Lobby.unity | 911 ++++++++++++++---- Assets/Scenes/Startup.unity | 34 +- Assets/Scripts/EditorTests/HealthTests.cs | 8 +- .../SS3D/Core/ApplicationStateSystem.cs.meta | 2 +- .../SS3D/Core/Behaviours/NetworkActor.cs | 4 +- .../SS3D/Core/Behaviours/NetworkView.cs | 19 + .../SS3D/Core/Behaviours/NetworkView.cs.meta | 3 + Assets/Scripts/SS3D/Core/Behaviours/View.cs | 22 + .../Scripts/SS3D/Core/Behaviours/View.cs.meta | 3 + .../Scripts/SS3D/Core/SessionNetworkSystem.cs | 5 +- .../SS3D/Core/Settings/ApplicationSettings.cs | 3 +- Assets/Scripts/SS3D/Core/SystemLocator.cs | 2 - Assets/Scripts/SS3D/Core/ViewLocator.cs | 71 ++ Assets/Scripts/SS3D/Core/ViewLocator.cs.meta | 3 + ...actionIconsAssetDatabaseInspectorEditor.cs | 87 ++ ...nIconsAssetDatabaseInspectorEditor.cs.meta | 3 + .../SS3D/Networking/SS3D.Networking.asmdef | 4 +- .../SS3D/Networking/UnauthorizedPlayer.cs | 19 +- .../Networking/UnauthorizedPlayer.cs.meta | 2 +- .../Systems/Entities/Debug/MindSwapDebug.cs | 14 +- .../Scripts/SS3D/Systems/Entities/Entity.cs | 82 ++ ...yerControllable.cs.meta => Entity.cs.meta} | 0 .../Systems/Entities/EntitySpawnSystem.cs | 247 ----- .../SS3D/Systems/Entities/EntitySystem.cs | 276 ++++++ ...awnSystem.cs.meta => EntitySystem.cs.meta} | 0 .../Entities/Events/InitialPlayersSpawned.cs | 15 + ....cs.meta => InitialPlayersSpawned.cs.meta} | 0 .../Events/InitialPlayersSpawnedEvent.cs | 15 - .../Events/LocalPlayerObjectChanged.cs | 15 + .../Events/LocalPlayerObjectChanged.cs.meta | 3 + .../Entities/Events/SpawnedPlayersUpdated.cs | 4 +- .../Entities/Humanoid/HumanoidController.cs | 67 +- .../SS3D/Systems/Entities/Messages.meta | 3 - .../Entities/Messages/RequestMindSwap.cs | 17 - .../Entities/Messages/RequestMindSwap.cs.meta | 3 - Assets/Scripts/SS3D/Systems/Entities/Mind.cs | 35 +- .../SS3D/Systems/Entities/Mind.cs.meta | 14 +- .../SS3D/Systems/Entities/MindSystem.cs | 111 +++ .../SS3D/Systems/Entities/MindSystem.cs.meta | 3 + .../Systems/Entities/PlayerControllable.cs | 76 -- .../Entities/Silicon/ThreadController.cs | 63 +- Assets/Scripts/SS3D/Systems/Entities/Soul.cs | 35 +- Assets/Scripts/SS3D/Systems/Furniture/Nuke.cs | 1 - .../SS3D/Systems/Gamemodes/GamemodeSystem.cs | 24 +- Assets/Scripts/SS3D/Systems/Health/Stamina.cs | 87 +- .../SS3D/Systems/Health/StaminaBarView.cs | 19 +- .../SS3D/Systems/Health/StaminaController.cs | 149 ++- .../{StaminaHelper.cs => StaminaFactory.cs} | 5 +- ...aHelper.cs.meta => StaminaFactory.cs.meta} | 0 .../IngameConsoleSystem/CommandsContainer.cs | 4 +- .../Systems/Items/NukeDetonateInteraction.cs | 4 +- .../SS3D/Systems/Lobby/UI/LobbyReadyView.cs | 22 +- .../Lobby/UI/PlayerUsernameListView.cs | 16 +- ...PlayerControlSystem.cs => PlayerSystem.cs} | 125 ++- ...rolSystem.cs.meta => PlayerSystem.cs.meta} | 0 .../Rounds/Events/ReadyPlayersChanged.cs | 4 +- .../Rounds/Events/SpawnReadyPlayersEvent.cs | 5 +- .../Rounds/Messages/RequestEmbarkMessage.cs | 14 - .../Messages/RequestEmbarkMessage.cs.meta | 3 - .../SS3D/Systems/Rounds/ReadyPlayersSystem.cs | 60 +- .../SS3D/Systems/Rounds/RoundSystem.cs | 3 +- .../SS3D/Systems/Rounds/RoundSystemBase.cs | 11 +- ...eCameraEvent.cs => CameraTargetChanged.cs} | 4 +- ...nt.cs.meta => CameraTargetChanged.cs.meta} | 0 .../SS3D/Systems/Screens/GameScreen.cs | 7 +- .../Systems/Screens/PlayerCameraSystem.cs | 28 +- .../Storage/Containers/AttachedContainer.cs | 10 +- .../Storage/Containers/ContainerDescriptor.cs | 14 +- .../Containers/ContainerInteractive.cs | 11 +- .../Editor/ContainerDescriptorEditor.cs | 22 +- .../SS3D/Systems/Storage/Containers/Hands.cs | 14 +- .../Systems/Storage/Containers/Inventory.cs | 91 +- .../Storage/Containers/NetworkedOpenable.cs | 13 +- .../Storage/Interactions/OpenInteraction.cs | 2 +- .../Storage/Interactions/PickupInteraction.cs | 2 +- .../Interactions/ViewContainerInteraction.cs | 2 +- .../SS3D/Systems/Storage/Items/Item.cs | 4 +- .../SS3D/Systems/Storage/UI/ClothingUi.cs | 4 +- .../Systems/Storage/UI/ContainerDisplay.cs | 17 + .../Storage/UI/ContainerDisplay.cs.meta | 3 + .../Storage/UI/{HandsUi.cs => HandsView.cs} | 18 +- .../UI/{HandsUi.cs.meta => HandsView.cs.meta} | 0 .../UI/{InventoryUi.cs => InventoryView.cs} | 51 +- ...entoryUi.cs.meta => InventoryView.cs.meta} | 0 .../SS3D/Systems/Storage/UI/PocketView.cs | 84 +- ProjectSettings/ProjectSettings.asset | 6 +- SS3D.sln.DotSettings | 6 +- 100 files changed, 2466 insertions(+), 1382 deletions(-) create mode 100644 Assets/AddressableAssetsData/link.xml rename Assets/{Content/Items/Generic/ToolBoxes/Toolbox.asset.meta => AddressableAssetsData/link.xml.meta} (54%) create mode 100644 Assets/Content/Entities/Mind.prefab create mode 100644 Assets/Content/Entities/Mind.prefab.meta delete mode 100644 Assets/Content/Items/Generic/ToolBoxes/Toolbox.asset rename Assets/Content/Items/Generic/ToolBoxes/{RedToolbox.prefab => ToolboxBlue.prefab} (94%) rename Assets/Content/Items/Generic/ToolBoxes/{RedToolbox.prefab.meta => ToolboxBlue.prefab.meta} (100%) create mode 100644 Assets/Scripts/SS3D/Core/Behaviours/NetworkView.cs create mode 100644 Assets/Scripts/SS3D/Core/Behaviours/NetworkView.cs.meta create mode 100644 Assets/Scripts/SS3D/Core/Behaviours/View.cs create mode 100644 Assets/Scripts/SS3D/Core/Behaviours/View.cs.meta create mode 100644 Assets/Scripts/SS3D/Core/ViewLocator.cs create mode 100644 Assets/Scripts/SS3D/Core/ViewLocator.cs.meta create mode 100644 Assets/Scripts/SS3D/Data/AssetDatabases/InteractionIconsAssetDatabaseInspectorEditor.cs create mode 100644 Assets/Scripts/SS3D/Data/AssetDatabases/InteractionIconsAssetDatabaseInspectorEditor.cs.meta create mode 100644 Assets/Scripts/SS3D/Systems/Entities/Entity.cs rename Assets/Scripts/SS3D/Systems/Entities/{PlayerControllable.cs.meta => Entity.cs.meta} (100%) delete mode 100644 Assets/Scripts/SS3D/Systems/Entities/EntitySpawnSystem.cs create mode 100644 Assets/Scripts/SS3D/Systems/Entities/EntitySystem.cs rename Assets/Scripts/SS3D/Systems/Entities/{EntitySpawnSystem.cs.meta => EntitySystem.cs.meta} (100%) create mode 100644 Assets/Scripts/SS3D/Systems/Entities/Events/InitialPlayersSpawned.cs rename Assets/Scripts/SS3D/Systems/Entities/Events/{InitialPlayersSpawnedEvent.cs.meta => InitialPlayersSpawned.cs.meta} (100%) delete mode 100644 Assets/Scripts/SS3D/Systems/Entities/Events/InitialPlayersSpawnedEvent.cs create mode 100644 Assets/Scripts/SS3D/Systems/Entities/Events/LocalPlayerObjectChanged.cs create mode 100644 Assets/Scripts/SS3D/Systems/Entities/Events/LocalPlayerObjectChanged.cs.meta delete mode 100644 Assets/Scripts/SS3D/Systems/Entities/Messages.meta delete mode 100644 Assets/Scripts/SS3D/Systems/Entities/Messages/RequestMindSwap.cs delete mode 100644 Assets/Scripts/SS3D/Systems/Entities/Messages/RequestMindSwap.cs.meta create mode 100644 Assets/Scripts/SS3D/Systems/Entities/MindSystem.cs create mode 100644 Assets/Scripts/SS3D/Systems/Entities/MindSystem.cs.meta delete mode 100644 Assets/Scripts/SS3D/Systems/Entities/PlayerControllable.cs rename Assets/Scripts/SS3D/Systems/Health/{StaminaHelper.cs => StaminaFactory.cs} (57%) rename Assets/Scripts/SS3D/Systems/Health/{StaminaHelper.cs.meta => StaminaFactory.cs.meta} (100%) rename Assets/Scripts/SS3D/Systems/PlayerControl/{PlayerControlSystem.cs => PlayerSystem.cs} (56%) rename Assets/Scripts/SS3D/Systems/PlayerControl/{PlayerControlSystem.cs.meta => PlayerSystem.cs.meta} (100%) delete mode 100644 Assets/Scripts/SS3D/Systems/Rounds/Messages/RequestEmbarkMessage.cs delete mode 100644 Assets/Scripts/SS3D/Systems/Rounds/Messages/RequestEmbarkMessage.cs.meta rename Assets/Scripts/SS3D/Systems/Screens/Events/{ChangeCameraEvent.cs => CameraTargetChanged.cs} (67%) rename Assets/Scripts/SS3D/Systems/Screens/Events/{ChangeCameraEvent.cs.meta => CameraTargetChanged.cs.meta} (100%) create mode 100644 Assets/Scripts/SS3D/Systems/Storage/UI/ContainerDisplay.cs create mode 100644 Assets/Scripts/SS3D/Systems/Storage/UI/ContainerDisplay.cs.meta rename Assets/Scripts/SS3D/Systems/Storage/UI/{HandsUi.cs => HandsView.cs} (88%) rename Assets/Scripts/SS3D/Systems/Storage/UI/{HandsUi.cs.meta => HandsView.cs.meta} (100%) rename Assets/Scripts/SS3D/Systems/Storage/UI/{InventoryUi.cs => InventoryView.cs} (74%) rename Assets/Scripts/SS3D/Systems/Storage/UI/{InventoryUi.cs.meta => InventoryView.cs.meta} (100%) diff --git a/Assets/AddressableAssetsData/link.xml b/Assets/AddressableAssetsData/link.xml new file mode 100644 index 0000000000..e2f9acfc75 --- /dev/null +++ b/Assets/AddressableAssetsData/link.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Assets/Content/Items/Generic/ToolBoxes/Toolbox.asset.meta b/Assets/AddressableAssetsData/link.xml.meta similarity index 54% rename from Assets/Content/Items/Generic/ToolBoxes/Toolbox.asset.meta rename to Assets/AddressableAssetsData/link.xml.meta index d580cb5936..d90d7e413b 100644 --- a/Assets/Content/Items/Generic/ToolBoxes/Toolbox.asset.meta +++ b/Assets/AddressableAssetsData/link.xml.meta @@ -1,8 +1,7 @@ fileFormatVersion: 2 -guid: 68d2644ff5a940c4d8861f24b34f9e40 -NativeFormatImporter: +guid: ea52d7256994f4143b99834baac604c6 +TextScriptImporter: externalObjects: {} - mainObjectFileID: 0 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/Content/Data/DefaultPrefabObjects.asset b/Assets/Content/Data/DefaultPrefabObjects.asset index b31b1396b5..a0fcfcb1a3 100644 --- a/Assets/Content/Data/DefaultPrefabObjects.asset +++ b/Assets/Content/Data/DefaultPrefabObjects.asset @@ -13,6 +13,7 @@ MonoBehaviour: m_Name: DefaultPrefabObjects m_EditorClassIdentifier: _prefabs: + - {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} - {fileID: 562230263738288595, guid: 59f05e8a3a1d4b94eb5222aed605e260, type: 3} - {fileID: 8203177977882359099, guid: 6ab4ce7059d374a4498481e1385c222e, type: 3} - {fileID: 1871071288925904272, guid: add4d1bc2d874d94782d6b8c912af5e2, type: 3} @@ -27,4 +28,5 @@ MonoBehaviour: - {fileID: 1019513474262773944, guid: 06c946c7c639138488b814e4448b82e4, type: 3} - {fileID: 4819234911439508660, guid: 11f824c472e04854e95065dda095e8f4, type: 3} - {fileID: 4819234911439508660, guid: 1ae18785d74e9fa4699b6f6de889c243, type: 3} + - {fileID: 3258417366846669140, guid: 264ea51d92067c14ebc6633999afac78, type: 3} - {fileID: 3206407796921847736, guid: 3335d001fdfff824aa859b98f2fe564e, type: 3} diff --git a/Assets/Content/Entities/Human/Human_Temporary.prefab b/Assets/Content/Entities/Human/Human_Temporary.prefab index f53eacf146..6da0531e90 100644 --- a/Assets/Content/Entities/Human/Human_Temporary.prefab +++ b/Assets/Content/Entities/Human/Human_Temporary.prefab @@ -3033,7 +3033,7 @@ MonoBehaviour: _isGlobal: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: 2 + k__BackingField: 3 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 3682879707339158369 @@ -3155,11 +3155,11 @@ MonoBehaviour: _addedNetworkObject: {fileID: 2930813178971533500} _networkObjectCache: {fileID: 2930813178971533500} _characterController: {fileID: 3812744165389046210} - _playerControllable: {fileID: 8336170331735268562} - _staminaController: {fileID: 6791200117061487242} + _entity: {fileID: 8336170331735268562} _movementSpeed: 5 _lerpMultiplier: 2 _rotationLerpMultiplier: 6 + _staminaController: {fileID: 6791200117061487242} _movementTarget: {fileID: 282733360052666326} --- !u!114 &6706577840954258383 MonoBehaviour: @@ -3191,7 +3191,7 @@ MonoBehaviour: _componentIndexCache: 3 _addedNetworkObject: {fileID: 2930813178971533500} _networkObjectCache: {fileID: 2930813178971533500} - _controllingSoul: {fileID: 0} + _mind: {fileID: 0} --- !u!114 &5293420320943344825 MonoBehaviour: m_ObjectHideFlags: 0 @@ -3267,7 +3267,7 @@ MonoBehaviour: _addedNetworkObject: {fileID: 2930813178971533500} _networkObjectCache: {fileID: 2930813178971533500} _player: {fileID: 1872721284991216642} - playerControllable: {fileID: 8336170331735268562} + _entity: {fileID: 8336170331735268562} --- !u!1 &6530700040387722453 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Content/Entities/Mind.prefab b/Assets/Content/Entities/Mind.prefab new file mode 100644 index 0000000000..dc9601335a --- /dev/null +++ b/Assets/Content/Entities/Mind.prefab @@ -0,0 +1,138 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8103066686919155798 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4873977336851923621} + - component: {fileID: 562230263738288595} + - component: {fileID: 3486636391395698902} + - component: {fileID: 3363661164123955675} + - component: {fileID: 1256239026443271520} + m_Layer: 0 + m_Name: Mind + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4873977336851923621 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8103066686919155798} + 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: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &562230263738288595 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8103066686919155798} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 26b716c41e9b56b4baafaf13a523ba2e, type: 3} + m_Name: + m_EditorClassIdentifier: + k__BackingField: 0 + k__BackingField: 0 + _networkBehaviours: + - {fileID: 0} + - {fileID: 3486636391395698902} + k__BackingField: {fileID: 0} + k__BackingField: [] + _isNetworked: 1 + _isGlobal: 0 + _defaultDespawnType: 0 + NetworkObserver: {fileID: 0} + k__BackingField: -1 + _scenePathHash: 0 + k__BackingField: 0 + k__BackingField: 17065920712306154591 + _sceneNetworkObjects: [] +--- !u!114 &3486636391395698902 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8103066686919155798} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a2836e36774ca1c4bbbee976e17b649c, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 1 + _addedNetworkObject: {fileID: 562230263738288595} + _networkObjectCache: {fileID: 562230263738288595} + _synchronizeParent: 0 + _packing: + Position: 1 + Rotation: 1 + Scale: 0 + _interpolation: 2 + _extrapolation: 2 + _enableTeleport: 0 + _teleportThreshold: 1 + _clientAuthoritative: 1 + _sendToOwner: 1 + _interval: 1 + _synchronizePosition: 1 + _positionSnapping: + X: 0 + Y: 0 + Z: 0 + _synchronizeRotation: 1 + _rotationSnapping: + X: 0 + Y: 0 + Z: 0 + _synchronizeScale: 1 + _scaleSnapping: + X: 0 + Y: 0 + Z: 0 +--- !u!114 &3363661164123955675 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8103066686919155798} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7d331f979d46e8e4a9fc90070c596d44, type: 3} + m_Name: + m_EditorClassIdentifier: + _updateHostVisibility: 1 + _defaultConditions: + - {fileID: 11400000, guid: 2033f54fd2794464bae08fa5a55c8996, type: 2} +--- !u!114 &1256239026443271520 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8103066686919155798} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 29d089bc254643d3bbb0c93cdd6c0b82, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 255 + _addedNetworkObject: {fileID: 562230263738288595} + _networkObjectCache: {fileID: 0} + Soul: {fileID: 0} diff --git a/Assets/Content/Entities/Mind.prefab.meta b/Assets/Content/Entities/Mind.prefab.meta new file mode 100644 index 0000000000..7d9b1b5f64 --- /dev/null +++ b/Assets/Content/Entities/Mind.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 06a27ffa07c1c754c9590607a5a80030 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Content/Entities/Silicon/Engineer Borg/Engi Borg.prefab b/Assets/Content/Entities/Silicon/Engineer Borg/Engi Borg.prefab index c131925b72..379ea79e2c 100644 --- a/Assets/Content/Entities/Silicon/Engineer Borg/Engi Borg.prefab +++ b/Assets/Content/Entities/Silicon/Engineer Borg/Engi Borg.prefab @@ -1402,7 +1402,7 @@ MonoBehaviour: _isGlobal: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: 9 + k__BackingField: 10 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 9988794035435604749 @@ -1551,7 +1551,7 @@ MonoBehaviour: _addedNetworkObject: {fileID: 1019513474262773944} _networkObjectCache: {fileID: 1019513474262773944} _characterController: {fileID: 8159127053265572578} - _playerControllable: {fileID: 1234979698125959994} + _entity: {fileID: 1234979698125959994} _movementSpeed: 2 _lerpMultiplier: 2 _rotationLerpMultiplier: 8 @@ -1571,7 +1571,7 @@ MonoBehaviour: _componentIndexCache: 3 _addedNetworkObject: {fileID: 1019513474262773944} _networkObjectCache: {fileID: 1019513474262773944} - _controllingSoul: {fileID: 0} + _mind: {fileID: 0} --- !u!1 &6250850031364791032 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Content/Items/Generic/ToolBoxes/Toolbox.asset b/Assets/Content/Items/Generic/ToolBoxes/Toolbox.asset deleted file mode 100644 index 1075e99d5b..0000000000 --- a/Assets/Content/Items/Generic/ToolBoxes/Toolbox.asset +++ /dev/null @@ -1,20 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 48bc3e6256e003f49b038fe30c1d9be6, type: 3} - m_Name: Toolbox - m_EditorClassIdentifier: - bulkSize: 3 - mustHaveAll: 0 - acceptedTraits: - - {fileID: 11400000, guid: 7f22e87f08452654f8f20ace0b1e0fa3, type: 2} - deniedTraits: [] - hash: -556379684 diff --git a/Assets/Content/Items/Generic/ToolBoxes/RedToolbox.prefab b/Assets/Content/Items/Generic/ToolBoxes/ToolboxBlue.prefab similarity index 94% rename from Assets/Content/Items/Generic/ToolBoxes/RedToolbox.prefab rename to Assets/Content/Items/Generic/ToolBoxes/ToolboxBlue.prefab index dce102f990..e3caa86dda 100644 --- a/Assets/Content/Items/Generic/ToolBoxes/RedToolbox.prefab +++ b/Assets/Content/Items/Generic/ToolBoxes/ToolboxBlue.prefab @@ -93,7 +93,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: e6b9b44320f4448d9d5e0ee634259966, type: 2} + - {fileID: 2100000, guid: 695c4de41b9578049a93f19b1eef7213, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -190,7 +190,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: 22262639920f43d6be32430e4e58350d, type: 2} + - {fileID: 2100000, guid: 695c4de41b9578049a93f19b1eef7213, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -245,7 +245,7 @@ GameObject: - component: {fileID: 5747472693690594541} - component: {fileID: 1094090079819989120} m_Layer: 10 - m_Name: RedToolbox + m_Name: ToolboxBlue m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -311,9 +311,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: b8e907cf58c0ce0439d34cd7cf644216, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 255 + _componentIndexCache: 0 _addedNetworkObject: {fileID: 3258417366846669140} - _networkObjectCache: {fileID: 0} + _networkObjectCache: {fileID: 3258417366846669140} _itemId: _name: _sprite: {fileID: 0} @@ -355,9 +355,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: a2836e36774ca1c4bbbee976e17b649c, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 255 + _componentIndexCache: 1 _addedNetworkObject: {fileID: 3258417366846669140} - _networkObjectCache: {fileID: 0} + _networkObjectCache: {fileID: 3258417366846669140} _synchronizeParent: 0 _packing: Position: 1 @@ -399,7 +399,12 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 - _networkBehaviours: [] + _networkBehaviours: + - {fileID: 2884915648782529247} + - {fileID: 3298710121668139635} + - {fileID: 7082293104205752709} + - {fileID: 5747472693690594541} + - {fileID: 1094090079819989120} k__BackingField: {fileID: 0} k__BackingField: [] _isNetworked: 1 @@ -409,7 +414,7 @@ MonoBehaviour: k__BackingField: -1 _scenePathHash: 0 k__BackingField: 0 - k__BackingField: 2804125510250307982 + k__BackingField: 4937251580671274826 _sceneNetworkObjects: [] --- !u!114 &9136074542965640709 MonoBehaviour: @@ -449,6 +454,8 @@ MonoBehaviour: HasCustomDisplay: 0 Displays: [] NumberDisplay: 0 + StartFilter: {fileID: 0} + Type: -1 --- !u!114 &7082293104205752709 MonoBehaviour: m_ObjectHideFlags: 0 @@ -461,9 +468,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: cf2e1e93bb2b4f2eac8df7a07b518352, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 255 + _componentIndexCache: 2 _addedNetworkObject: {fileID: 3258417366846669140} - _networkObjectCache: {fileID: 0} + _networkObjectCache: {fileID: 3258417366846669140} Size: {x: 10, y: 10} --- !u!114 &5747472693690594541 MonoBehaviour: @@ -477,9 +484,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 72bfc9c5e18140bc9dbf232d3a7c2ff6, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 255 + _componentIndexCache: 3 _addedNetworkObject: {fileID: 3258417366846669140} - _networkObjectCache: {fileID: 0} + _networkObjectCache: {fileID: 3258417366846669140} ContainerDescriptor: {fileID: 9136074542965640709} _container: {fileID: 7082293104205752709} --- !u!114 &1094090079819989120 @@ -494,10 +501,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 3c75d17834848bb4f83ee6e730a65519, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 255 + _componentIndexCache: 4 _addedNetworkObject: {fileID: 3258417366846669140} - _networkObjectCache: {fileID: 0} - OpenIcon: {fileID: 0} + _networkObjectCache: {fileID: 3258417366846669140} + OverrideOpenIcon: {fileID: 0} containerDescriptor: {fileID: 9136074542965640709} --- !u!1 &8066562249021099569 GameObject: diff --git a/Assets/Content/Items/Generic/ToolBoxes/RedToolbox.prefab.meta b/Assets/Content/Items/Generic/ToolBoxes/ToolboxBlue.prefab.meta similarity index 100% rename from Assets/Content/Items/Generic/ToolBoxes/RedToolbox.prefab.meta rename to Assets/Content/Items/Generic/ToolBoxes/ToolboxBlue.prefab.meta diff --git a/Assets/Content/UI/HumanoidInventory.prefab b/Assets/Content/UI/HumanoidInventory.prefab index 137d294985..a4042c4d68 100644 --- a/Assets/Content/UI/HumanoidInventory.prefab +++ b/Assets/Content/UI/HumanoidInventory.prefab @@ -1,5 +1,84 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &1395738564 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1395738565} + - component: {fileID: 1395738567} + - component: {fileID: 1395738566} + m_Layer: 5 + m_Name: Holder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &1395738565 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1395738564} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.7, y: 0.7, z: 0.7} + m_ConstrainProportionsScale: 1 + m_Children: + - {fileID: 4007119672446955943} + - {fileID: 5623785714001817106} + - {fileID: 3647870726543537181} + - {fileID: 4834630309877844804} + - {fileID: 3545617241486444212} + - {fileID: 6849294283287287193} + - {fileID: 3675586706731916380} + m_Father: {fileID: 8250136937507568774} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 800, y: 96.629974} + m_Pivot: {x: 0.5, y: 0} +--- !u!222 &1395738567 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1395738564} + m_CullTransparentMesh: 1 +--- !u!114 &1395738566 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1395738564} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 5 + m_Bottom: 0 + m_ChildAlignment: 4 + m_Spacing: 2 + m_ChildForceExpandWidth: 0 + m_ChildForceExpandHeight: 0 + m_ChildControlWidth: 0 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 --- !u!1 &796880000136680634 GameObject: m_ObjectHideFlags: 0 @@ -108,12 +187,12 @@ RectTransform: m_Children: - {fileID: 1879018833858922843} - {fileID: 2886238234609558939} - m_Father: {fileID: 8250136937507568774} + m_Father: {fileID: 1395738565} m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 441.15155, y: -50.814987} m_SizeDelta: {x: 132, y: 65} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2741423934693967894 @@ -152,8 +231,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 01c7c41a40c34de1a517fe250a0c1b0a, type: 3} m_Name: m_EditorClassIdentifier: - LeftHandPrefab: {fileID: 8813745938857574655, guid: 86eee6fc580238d479b0cfb176ec03be, type: 3} - RightHandPrefab: {fileID: 8813745938857574655, guid: 8457bef4221b0a645bd1b56e8e9db193, type: 3} + LeftHandPrefab: {fileID: -7378768192968544479, guid: 86eee6fc580238d479b0cfb176ec03be, type: 3} + RightHandPrefab: {fileID: -7378768192968544479, guid: 8457bef4221b0a645bd1b56e8e9db193, type: 3} HandsContainer: {fileID: 3545617241486444212} SelectedColor: {r: 1, g: 1, b: 1, a: 1} --- !u!1 &8250136937507568777 @@ -166,7 +245,6 @@ GameObject: m_Component: - component: {fileID: 8250136937507568774} - component: {fileID: 8250136937507568772} - - component: {fileID: 8250136937507568775} - component: {fileID: 8561134315023059762} - component: {fileID: -1906626332709311754} - component: {fileID: 3962283478476174122} @@ -186,16 +264,10 @@ RectTransform: m_GameObject: {fileID: 8250136937507568777} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 0.7, y: 0.7, z: 1} - m_ConstrainProportionsScale: 1 + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 4007119672446955943} - - {fileID: 5623785714001817106} - - {fileID: 3647870726543537181} - - {fileID: 4834630309877844804} - - {fileID: 3545617241486444212} - - {fileID: 6849294283287287193} - - {fileID: 3675586706731916380} + - {fileID: 1395738565} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -212,32 +284,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8250136937507568777} m_CullTransparentMesh: 1 ---- !u!114 &8250136937507568775 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8250136937507568777} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 5 - m_Bottom: 5 - m_ChildAlignment: 4 - m_Spacing: 2 - m_ChildForceExpandWidth: 0 - m_ChildForceExpandHeight: 0 - m_ChildControlWidth: 0 - m_ChildControlHeight: 0 - m_ChildScaleWidth: 0 - m_ChildScaleHeight: 0 - m_ReverseArrangement: 0 --- !u!114 &8561134315023059762 MonoBehaviour: m_ObjectHideFlags: 0 @@ -280,10 +326,11 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: ba383503fe724a81937f02158f6a7ba8, type: 3} m_Name: m_EditorClassIdentifier: - HandsUi: {fileID: 5715483787937385449} + HandsView: {fileID: 5715483787937385449} PocketPrefab: {fileID: 3500707531626207298, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} PocketParent: {fileID: 8250136937507568774} ContainerUiPrefab: {fileID: 176838957447208628, guid: c706a5a7a16b7bc4788469385ac24801, type: 3} + _uiPanel: {fileID: 1395738564} --- !u!114 &3962283478476174122 MonoBehaviour: m_ObjectHideFlags: 0 @@ -323,18 +370,18 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 9077724464359231712} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + 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: 7020193438404052836} - m_Father: {fileID: 8250136937507568774} + m_Father: {fileID: 1395738565} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 361.5, y: -50.814987} m_SizeDelta: {x: 23.3031, y: 55} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &5312692836641384059 @@ -350,7 +397,7 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: - m_TransformParent: {fileID: 8250136937507568774} + m_TransformParent: {fileID: 1395738565} m_Modifications: - target: {fileID: 2842198251171595269, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} propertyPath: m_TargetGraphic @@ -378,7 +425,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3500707531626207299, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3500707531626207299, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} propertyPath: m_AnchorMin.x @@ -386,7 +433,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3500707531626207299, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3500707531626207299, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} propertyPath: m_SizeDelta.x @@ -414,23 +461,23 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3500707531626207299, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} propertyPath: m_LocalRotation.x - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 3500707531626207299, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} propertyPath: m_LocalRotation.y - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 3500707531626207299, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} propertyPath: m_LocalRotation.z - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 3500707531626207299, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 593.65155 objectReference: {fileID: 0} - target: {fileID: 3500707531626207299, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -50.814987 objectReference: {fileID: 0} - target: {fileID: 3500707531626207299, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -472,7 +519,7 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: - m_TransformParent: {fileID: 8250136937507568774} + m_TransformParent: {fileID: 1395738565} m_Modifications: - target: {fileID: 2063989993203335462, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_Sprite @@ -540,7 +587,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_AnchorMin.x @@ -548,7 +595,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_SizeDelta.x @@ -576,23 +623,23 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_LocalRotation.x - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_LocalRotation.y - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_LocalRotation.z - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 206.34845 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -50.814987 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -706,7 +753,7 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: - m_TransformParent: {fileID: 8250136937507568774} + m_TransformParent: {fileID: 1395738565} m_Modifications: - target: {fileID: 2063989993203335462, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_Sprite @@ -742,7 +789,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_AnchorMin.x @@ -750,7 +797,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_SizeDelta.x @@ -778,23 +825,23 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_LocalRotation.x - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_LocalRotation.y - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_LocalRotation.z - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 320.34845 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -50.814987 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -928,7 +975,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8813745938857574654, guid: 8457bef4221b0a645bd1b56e8e9db193, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8813745938857574654, guid: 8457bef4221b0a645bd1b56e8e9db193, type: 3} propertyPath: m_AnchorMin.x @@ -936,15 +983,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8813745938857574654, guid: 8457bef4221b0a645bd1b56e8e9db193, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8813745938857574654, guid: 8457bef4221b0a645bd1b56e8e9db193, type: 3} propertyPath: m_SizeDelta.x - value: 0 + value: 65 objectReference: {fileID: 0} - target: {fileID: 8813745938857574654, guid: 8457bef4221b0a645bd1b56e8e9db193, type: 3} propertyPath: m_SizeDelta.y - value: 0 + value: 65 objectReference: {fileID: 0} - target: {fileID: 8813745938857574654, guid: 8457bef4221b0a645bd1b56e8e9db193, type: 3} propertyPath: m_LocalPosition.x @@ -976,11 +1023,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8813745938857574654, guid: 8457bef4221b0a645bd1b56e8e9db193, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 99.5 objectReference: {fileID: 0} - target: {fileID: 8813745938857574654, guid: 8457bef4221b0a645bd1b56e8e9db193, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -32.5 objectReference: {fileID: 0} - target: {fileID: 8813745938857574654, guid: 8457bef4221b0a645bd1b56e8e9db193, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -1010,7 +1057,7 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: - m_TransformParent: {fileID: 8250136937507568774} + m_TransformParent: {fileID: 1395738565} m_Modifications: - target: {fileID: 2063989993203335462, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_Sprite @@ -1046,7 +1093,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_AnchorMin.x @@ -1054,7 +1101,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_SizeDelta.x @@ -1082,23 +1129,23 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_LocalRotation.x - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_LocalRotation.y - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_LocalRotation.z - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 263.34845 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -50.814987 objectReference: {fileID: 0} - target: {fileID: 2063989993270087811, guid: 1fd282cd3862b2848a83fe40030cf431, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -1232,7 +1279,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8813745938857574654, guid: 86eee6fc580238d479b0cfb176ec03be, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8813745938857574654, guid: 86eee6fc580238d479b0cfb176ec03be, type: 3} propertyPath: m_AnchorMin.x @@ -1240,15 +1287,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8813745938857574654, guid: 86eee6fc580238d479b0cfb176ec03be, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8813745938857574654, guid: 86eee6fc580238d479b0cfb176ec03be, type: 3} propertyPath: m_SizeDelta.x - value: 0 + value: 65 objectReference: {fileID: 0} - target: {fileID: 8813745938857574654, guid: 86eee6fc580238d479b0cfb176ec03be, type: 3} propertyPath: m_SizeDelta.y - value: 0 + value: 65 objectReference: {fileID: 0} - target: {fileID: 8813745938857574654, guid: 86eee6fc580238d479b0cfb176ec03be, type: 3} propertyPath: m_LocalPosition.x @@ -1280,11 +1327,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8813745938857574654, guid: 86eee6fc580238d479b0cfb176ec03be, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 32.5 objectReference: {fileID: 0} - target: {fileID: 8813745938857574654, guid: 86eee6fc580238d479b0cfb176ec03be, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -32.5 objectReference: {fileID: 0} - target: {fileID: 8813745938857574654, guid: 86eee6fc580238d479b0cfb176ec03be, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -1314,7 +1361,7 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: - m_TransformParent: {fileID: 8250136937507568774} + m_TransformParent: {fileID: 1395738565} m_Modifications: - target: {fileID: 2842198251171595269, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} propertyPath: m_TargetGraphic @@ -1346,7 +1393,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3500707531626207299, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3500707531626207299, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} propertyPath: m_AnchorMin.x @@ -1354,7 +1401,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3500707531626207299, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3500707531626207299, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} propertyPath: m_SizeDelta.x @@ -1398,11 +1445,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3500707531626207299, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 536.65155 objectReference: {fileID: 0} - target: {fileID: 3500707531626207299, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -50.814987 objectReference: {fileID: 0} - target: {fileID: 3500707531626207299, guid: 4730e300b844e184dbfddb8ae7171204, type: 3} propertyPath: m_LocalEulerAnglesHint.x diff --git a/Assets/Content/UI/Lobby/Canvas/Player Canvas.prefab b/Assets/Content/UI/Lobby/Canvas/Player Canvas.prefab index 4eb43742d7..c9a9ef90ba 100644 --- a/Assets/Content/UI/Lobby/Canvas/Player Canvas.prefab +++ b/Assets/Content/UI/Lobby/Canvas/Player Canvas.prefab @@ -110,93 +110,13 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 3810371244597919609} m_Modifications: - - target: {fileID: 4007119672446955943, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchorMax.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4007119672446955943, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchorMin.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4007119672446955943, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchoredPosition.x - value: 415.45642 - objectReference: {fileID: 0} - - target: {fileID: 4007119672446955943, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchoredPosition.y - value: -37.7561 - objectReference: {fileID: 0} - - target: {fileID: 4024923543185803786, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchorMax.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4024923543185803786, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchorMin.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4024923543185803786, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchoredPosition.x - value: 611.7595 - objectReference: {fileID: 0} - - target: {fileID: 4024923543185803786, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchoredPosition.y - value: -37.7561 - objectReference: {fileID: 0} - - target: {fileID: 4834630309877844804, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchorMax.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4834630309877844804, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchorMin.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4834630309877844804, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchoredPosition.x - value: 513.608 - objectReference: {fileID: 0} - - target: {fileID: 4834630309877844804, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchoredPosition.y - value: -37.7561 - objectReference: {fileID: 0} - - target: {fileID: 5623785714001817106, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchorMax.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 5623785714001817106, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchorMin.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 5623785714001817106, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchoredPosition.x - value: 472.45642 - objectReference: {fileID: 0} - - target: {fileID: 5623785714001817106, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchoredPosition.y - value: -37.7561 - objectReference: {fileID: 0} - - target: {fileID: 7987868565707349356, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchorMax.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 7987868565707349356, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchorMin.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 7987868565707349356, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchoredPosition.x - value: 554.7595 - objectReference: {fileID: 0} - - target: {fileID: 7987868565707349356, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_AnchoredPosition.y - value: -37.7561 - objectReference: {fileID: 0} - target: {fileID: 8250136937507568774, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} propertyPath: m_Pivot.x value: 0.5 objectReference: {fileID: 0} - target: {fileID: 8250136937507568774, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} propertyPath: m_Pivot.y - value: 0 + value: 0.5 objectReference: {fileID: 0} - target: {fileID: 8250136937507568774, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} propertyPath: m_RootOrder @@ -208,7 +128,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8250136937507568774, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8250136937507568774, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} propertyPath: m_AnchorMin.x @@ -224,7 +144,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8250136937507568774, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} propertyPath: m_SizeDelta.y - value: 75.5122 + value: 0 objectReference: {fileID: 0} - target: {fileID: 8250136937507568774, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} propertyPath: m_LocalPosition.x @@ -278,10 +198,6 @@ PrefabInstance: propertyPath: m_Name value: HumanoidInventory objectReference: {fileID: 0} - - target: {fileID: 8250136937507568777, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} - propertyPath: m_IsActive - value: 0 - objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 40bc053ef2ba6d74fb3ebcf645b4925f, type: 3} --- !u!224 &3810371244518108023 stripped diff --git a/Assets/Content/UI/StaminaBar/StaminaBar.prefab b/Assets/Content/UI/StaminaBar/StaminaBar.prefab index 04dbd0c108..041f86a89e 100644 --- a/Assets/Content/UI/StaminaBar/StaminaBar.prefab +++ b/Assets/Content/UI/StaminaBar/StaminaBar.prefab @@ -102,7 +102,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: fc2bcd7d98bf5a74f9bd9e9f48200cf9, type: 3} m_Name: m_EditorClassIdentifier: - slider: {fileID: 1207808949249932453} + _slider: {fileID: 1207808949249932453} --- !u!1 &2863616519028749816 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/Lobby.unity b/Assets/Scenes/Lobby.unity index 42247b069a..4322a47f8c 100644 --- a/Assets/Scenes/Lobby.unity +++ b/Assets/Scenes/Lobby.unity @@ -196,9 +196,11 @@ MonoBehaviour: - {fileID: 661652618} - {fileID: 771589493} - {fileID: 859488918} + - {fileID: 878406322} - {fileID: 913757968} - {fileID: 914529552} - {fileID: 990295462} + - {fileID: 1000564558} - {fileID: 1494334785} - {fileID: 1927660778} - {fileID: 2044936706} @@ -272,9 +274,11 @@ MonoBehaviour: - {fileID: 661652618} - {fileID: 771589493} - {fileID: 859488918} + - {fileID: 878406322} - {fileID: 913757968} - {fileID: 914529552} - {fileID: 990295462} + - {fileID: 1000564558} - {fileID: 1494334785} - {fileID: 1927660778} - {fileID: 2044936706} @@ -914,9 +918,11 @@ MonoBehaviour: - {fileID: 661652618} - {fileID: 771589493} - {fileID: 859488918} + - {fileID: 878406322} - {fileID: 913757968} - {fileID: 914529552} - {fileID: 990295462} + - {fileID: 1000564558} - {fileID: 1494334785} - {fileID: 1927660778} - {fileID: 2044936706} @@ -1279,9 +1285,11 @@ MonoBehaviour: - {fileID: 661652618} - {fileID: 771589493} - {fileID: 859488918} + - {fileID: 878406322} - {fileID: 913757968} - {fileID: 914529552} - {fileID: 990295462} + - {fileID: 1000564558} - {fileID: 1494334785} - {fileID: 1927660778} - {fileID: 2044936706} @@ -1367,9 +1375,11 @@ MonoBehaviour: - {fileID: 661652618} - {fileID: 771589493} - {fileID: 859488918} + - {fileID: 878406322} - {fileID: 913757968} - {fileID: 914529552} - {fileID: 990295462} + - {fileID: 1000564558} - {fileID: 1494334785} - {fileID: 1927660778} - {fileID: 2044936706} @@ -1410,6 +1420,11 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 26b716c41e9b56b4baafaf13a523ba2e, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!224 &576650548 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 5088917634584121396, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + m_PrefabInstance: {fileID: 3810371244444567007} + m_PrefabAsset: {fileID: 0} --- !u!1001 &600279199 PrefabInstance: m_ObjectHideFlags: 0 @@ -1712,7 +1727,7 @@ MonoBehaviour: _addedNetworkObject: {fileID: 616353825} _networkObjectCache: {fileID: 616353825} _unauthorizedUserPrefab: {fileID: 8203177977882359099, guid: 6ab4ce7059d374a4498481e1385c222e, type: 3} - _soulPrefab: {fileID: 562230263738288595, guid: 59f05e8a3a1d4b94eb5222aed605e260, type: 3} + _soulPrefab: {fileID: -3683743083778642796, guid: 59f05e8a3a1d4b94eb5222aed605e260, type: 3} --- !u!114 &616353825 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1751,9 +1766,11 @@ MonoBehaviour: - {fileID: 661652618} - {fileID: 771589493} - {fileID: 859488918} + - {fileID: 878406322} - {fileID: 913757968} - {fileID: 914529552} - {fileID: 990295462} + - {fileID: 1000564558} - {fileID: 1494334785} - {fileID: 1927660778} - {fileID: 2044936706} @@ -1820,7 +1837,7 @@ GameObject: - component: {fileID: 661652618} - component: {fileID: 661652617} m_Layer: 0 - m_Name: EntitySpawnSystem + m_Name: EntitySystem m_TagString: Untagged m_Icon: {fileID: 2800000, guid: 4d92845251442a542933ea1c7502d8d9, type: 3} m_NavMeshLayer: 0 @@ -1839,7 +1856,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1506918115} - m_RootOrder: 5 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &661652617 MonoBehaviour: @@ -1856,9 +1873,9 @@ MonoBehaviour: _componentIndexCache: 0 _addedNetworkObject: {fileID: 661652618} _networkObjectCache: {fileID: 661652618} - _tempHuman: + _humanPrefab: - {fileID: 8336170331735268562, guid: 1c3eed1ea37ecc1448e41270cdc63486, type: 3} - _tempSpawnPoint: {fileID: 1544788595} + _spawnPoint: {fileID: 1544788595} --- !u!114 &661652618 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1897,104 +1914,25 @@ MonoBehaviour: - {fileID: 661652618} - {fileID: 771589493} - {fileID: 859488918} + - {fileID: 878406322} - {fileID: 913757968} - {fileID: 914529552} - {fileID: 990295462} + - {fileID: 1000564558} - {fileID: 1494334785} - {fileID: 1927660778} - {fileID: 2044936706} ---- !u!21 &674170186 -Material: - serializedVersion: 8 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} +--- !u!114 &676448448 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 8098506172083102939, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + m_PrefabInstance: {fileID: 3810371244444567007} m_PrefabAsset: {fileID: 0} - m_Name: Palette Emission - m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} - m_ValidKeywords: - - _EMISSION - - _GLOSSYREFLECTIONS_OFF - - _SPECULARHIGHLIGHTS_OFF - m_InvalidKeywords: [] - m_LightmapFlags: 2 - m_EnableInstancingVariants: 1 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: [] - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: - - _BumpMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _Detail: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailAlbedoMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailMask: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailNormalMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _EmissionMap: - m_Texture: {fileID: 2800000, guid: 133dea153b15ed1418cfbadaf99ba3e1, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MainTex: - m_Texture: {fileID: 2800000, guid: 133dea153b15ed1418cfbadaf99ba3e1, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MetallicGlossMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _OcclusionMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _ParallaxMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _SpecGlossMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Ints: [] - m_Floats: - - _BumpScale: 1 - - _Cutoff: 0.5 - - _DetailNormalMapScale: 1 - - _DstBlend: 0 - - _GlossMapScale: 0 - - _Glossiness: 0 - - _GlossyReflections: 0 - - _Metallic: 0 - - _Mode: 0 - - _OcclusionStrength: 1 - - _Parallax: 0.02 - - _Shininess: 0.7 - - _SmoothnessTextureChannel: 0 - - _SpecularHighlights: 0 - - _SrcBlend: 1 - - _UVSec: 0 - - _ZWrite: 1 - m_Colors: - - _Color: {r: 1, g: 1, b: 1, a: 1} - - _Emission: {r: 0, g: 0, b: 0, a: 0} - - _EmissionColor: {r: 0, g: 0, b: 0, a: 0} - - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} - m_BuildTextureStacks: [] + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d16d9c9e1fac9c84da0a1db31c0c4294, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1001 &735173298 PrefabInstance: m_ObjectHideFlags: 0 @@ -2148,6 +2086,98 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 06c946c7c639138488b814e4448b82e4, type: 3} +--- !u!21 &750749079 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Palette Emission + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ValidKeywords: + - _EMISSION + - _GLOSSYREFLECTIONS_OFF + - _SPECULARHIGHLIGHTS_OFF + m_InvalidKeywords: [] + m_LightmapFlags: 2 + m_EnableInstancingVariants: 1 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Detail: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 2800000, guid: 133dea153b15ed1418cfbadaf99ba3e1, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 133dea153b15ed1418cfbadaf99ba3e1, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _Shininess: 0.7 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 0 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _Emission: {r: 0, g: 0, b: 0, a: 0} + - _EmissionColor: {r: 2, g: 2, b: 2, a: 2} + - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_BuildTextureStacks: [] --- !u!65 &756894443 BoxCollider: m_ObjectHideFlags: 0 @@ -2161,6 +2191,97 @@ BoxCollider: serializedVersion: 2 m_Size: {x: 0.043264836, y: 0.051917817, z: 0} m_Center: {x: -0.017305933, y: 0.004326485, z: 0} +--- !u!21 &759619921 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Palette Emission + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ValidKeywords: + - _GLOSSYREFLECTIONS_OFF + - _SPECULARHIGHLIGHTS_OFF + m_InvalidKeywords: [] + m_LightmapFlags: 6 + m_EnableInstancingVariants: 1 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Detail: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 2800000, guid: 133dea153b15ed1418cfbadaf99ba3e1, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 133dea153b15ed1418cfbadaf99ba3e1, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _Shininess: 0.7 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 0 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _Emission: {r: 0, g: 0, b: 0, a: 0} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 0} + - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_BuildTextureStacks: [] --- !u!1 &771589491 GameObject: m_ObjectHideFlags: 0 @@ -2235,9 +2356,11 @@ MonoBehaviour: - {fileID: 661652618} - {fileID: 771589493} - {fileID: 859488918} + - {fileID: 878406322} - {fileID: 913757968} - {fileID: 914529552} - {fileID: 990295462} + - {fileID: 1000564558} - {fileID: 1494334785} - {fileID: 1927660778} - {fileID: 2044936706} @@ -2268,6 +2391,205 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 26b716c41e9b56b4baafaf13a523ba2e, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1001 &878406318 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1000564556} + m_Modifications: + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _scenePathHash + value: 952082934 + objectReference: {fileID: 0} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: k__BackingField + value: 4089165067404399205 + objectReference: {fileID: 0} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _sceneNetworkObjects.Array.size + value: 18 + objectReference: {fileID: 0} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _networkBehaviours.Array.data[0] + value: + objectReference: {fileID: 878406321} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _networkBehaviours.Array.data[1] + value: + objectReference: {fileID: 878406320} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[0] + value: + objectReference: {fileID: 878406322} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[1] + value: + objectReference: {fileID: 36466130} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[2] + value: + objectReference: {fileID: 36811087} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[3] + value: + objectReference: {fileID: 246961643} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[4] + value: + objectReference: {fileID: 474682044} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[5] + value: + objectReference: {fileID: 495596408} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[6] + value: + objectReference: {fileID: 516802435} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[7] + value: + objectReference: {fileID: 574756904} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[8] + value: + objectReference: {fileID: 616353825} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[9] + value: + objectReference: {fileID: 661652618} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[10] + value: + objectReference: {fileID: 771589493} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[11] + value: + objectReference: {fileID: 859488918} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[12] + value: + objectReference: {fileID: 913757968} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[13] + value: + objectReference: {fileID: 914529552} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[14] + value: + objectReference: {fileID: 990295462} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[15] + value: + objectReference: {fileID: 1000564558} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[16] + value: + objectReference: {fileID: 1494334785} + - target: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[17] + value: + objectReference: {fileID: 1927660778} + - target: {fileID: 1256239026443271520, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _networkObjectCache + value: + objectReference: {fileID: 878406322} + - target: {fileID: 1256239026443271520, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _componentIndexCache + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3486636391395698902, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: _componentIndexCache + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4873977336851923621, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4873977336851923621, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4873977336851923621, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4873977336851923621, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4873977336851923621, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4873977336851923621, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4873977336851923621, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4873977336851923621, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4873977336851923621, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4873977336851923621, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4873977336851923621, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8103066686919155798, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + propertyPath: m_Name + value: Empty Mind + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} +--- !u!4 &878406319 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 4873977336851923621, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + m_PrefabInstance: {fileID: 878406318} + m_PrefabAsset: {fileID: 0} +--- !u!114 &878406320 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1256239026443271520, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + m_PrefabInstance: {fileID: 878406318} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 29d089bc254643d3bbb0c93cdd6c0b82, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &878406321 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 3486636391395698902, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + m_PrefabInstance: {fileID: 878406318} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a2836e36774ca1c4bbbee976e17b649c, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &878406322 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 562230263738288595, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} + m_PrefabInstance: {fileID: 878406318} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 26b716c41e9b56b4baafaf13a523ba2e, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &886594307 GameObject: m_ObjectHideFlags: 0 @@ -2446,9 +2768,11 @@ MonoBehaviour: - {fileID: 661652618} - {fileID: 771589493} - {fileID: 859488918} + - {fileID: 878406322} - {fileID: 913757968} - {fileID: 914529552} - {fileID: 990295462} + - {fileID: 1000564558} - {fileID: 1494334785} - {fileID: 1927660778} - {fileID: 2044936706} @@ -2531,9 +2855,11 @@ MonoBehaviour: - {fileID: 661652618} - {fileID: 771589493} - {fileID: 859488918} + - {fileID: 878406322} - {fileID: 913757968} - {fileID: 914529552} - {fileID: 990295462} + - {fileID: 1000564558} - {fileID: 1494334785} - {fileID: 1927660778} - {fileID: 2044936706} @@ -2797,9 +3123,109 @@ MonoBehaviour: - {fileID: 661652618} - {fileID: 771589493} - {fileID: 859488918} + - {fileID: 878406322} + - {fileID: 913757968} + - {fileID: 914529552} + - {fileID: 990295462} + - {fileID: 1000564558} + - {fileID: 1494334785} + - {fileID: 1927660778} + - {fileID: 2044936706} +--- !u!1 &1000564555 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1000564556} + - component: {fileID: 1000564558} + - component: {fileID: 1000564557} + m_Layer: 0 + m_Name: MindSystem + m_TagString: Untagged + m_Icon: {fileID: 2800000, guid: 4d92845251442a542933ea1c7502d8d9, type: 3} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1000564556 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1000564555} + 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: 878406319} + m_Father: {fileID: 1506918115} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1000564557 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1000564555} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1d92e98e20bf43dabd1dde2edaeb9c92, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 0 + _addedNetworkObject: {fileID: 1000564558} + _networkObjectCache: {fileID: 1000564558} + _mindPrefab: {fileID: 878406320} + _emptyMind: {fileID: 1256239026443271520, guid: 06a27ffa07c1c754c9590607a5a80030, type: 3} +--- !u!114 &1000564558 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1000564555} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 26b716c41e9b56b4baafaf13a523ba2e, type: 3} + m_Name: + m_EditorClassIdentifier: + k__BackingField: 0 + k__BackingField: 0 + _networkBehaviours: + - {fileID: 1000564557} + k__BackingField: {fileID: 0} + k__BackingField: + - {fileID: 878406322} + _isNetworked: 1 + _isGlobal: 0 + _defaultDespawnType: 0 + NetworkObserver: {fileID: 0} + k__BackingField: -1 + _scenePathHash: 952082934 + k__BackingField: 4089165065474179058 + k__BackingField: 0 + _sceneNetworkObjects: + - {fileID: 36466130} + - {fileID: 36811087} + - {fileID: 246961643} + - {fileID: 474682044} + - {fileID: 495596408} + - {fileID: 516802435} + - {fileID: 574756904} + - {fileID: 616353825} + - {fileID: 661652618} + - {fileID: 771589493} + - {fileID: 859488918} + - {fileID: 878406322} - {fileID: 913757968} - {fileID: 914529552} - {fileID: 990295462} + - {fileID: 1000564558} - {fileID: 1494334785} - {fileID: 1927660778} - {fileID: 2044936706} @@ -2903,98 +3329,6 @@ Canvas: m_SortingLayerID: 0 m_SortingOrder: 4 m_TargetDisplay: 0 ---- !u!21 &1034206380 -Material: - serializedVersion: 8 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Palette Emission - m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} - m_ValidKeywords: - - _EMISSION - - _GLOSSYREFLECTIONS_OFF - - _SPECULARHIGHLIGHTS_OFF - m_InvalidKeywords: [] - m_LightmapFlags: 2 - m_EnableInstancingVariants: 1 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: [] - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: - - _BumpMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _Detail: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailAlbedoMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailMask: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailNormalMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _EmissionMap: - m_Texture: {fileID: 2800000, guid: 133dea153b15ed1418cfbadaf99ba3e1, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MainTex: - m_Texture: {fileID: 2800000, guid: 133dea153b15ed1418cfbadaf99ba3e1, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MetallicGlossMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _OcclusionMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _ParallaxMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _SpecGlossMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Ints: [] - m_Floats: - - _BumpScale: 1 - - _Cutoff: 0.5 - - _DetailNormalMapScale: 1 - - _DstBlend: 0 - - _GlossMapScale: 0 - - _Glossiness: 0 - - _GlossyReflections: 0 - - _Metallic: 0 - - _Mode: 0 - - _OcclusionStrength: 1 - - _Parallax: 0.02 - - _Shininess: 0.7 - - _SmoothnessTextureChannel: 0 - - _SpecularHighlights: 0 - - _SrcBlend: 1 - - _UVSec: 0 - - _ZWrite: 1 - m_Colors: - - _Color: {r: 1, g: 1, b: 1, a: 1} - - _Emission: {r: 0, g: 0, b: 0, a: 0} - - _EmissionColor: {r: 2, g: 2, b: 2, a: 2} - - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} - m_BuildTextureStacks: [] --- !u!1 &1127411102 GameObject: m_ObjectHideFlags: 0 @@ -3300,7 +3634,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1506918115} - m_RootOrder: 6 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1196595940 MonoBehaviour: @@ -3669,7 +4003,7 @@ GameObject: m_Component: - component: {fileID: 1506918115} m_Layer: 0 - m_Name: Lobby Managers + m_Name: Systems m_TagString: Untagged m_Icon: {fileID: 2800000, guid: 826ed57d18f5733488130a90866d52e1, type: 3} m_NavMeshLayer: 0 @@ -3692,8 +4026,9 @@ Transform: - {fileID: 246961639} - {fileID: 1927660777} - {fileID: 474682043} - - {fileID: 661652616} - {fileID: 1196595939} + - {fileID: 661652616} + - {fileID: 1000564556} m_Father: {fileID: 0} m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -4584,9 +4919,11 @@ MonoBehaviour: - {fileID: 661652618} - {fileID: 771589493} - {fileID: 859488918} + - {fileID: 878406322} - {fileID: 913757968} - {fileID: 914529552} - {fileID: 990295462} + - {fileID: 1000564558} - {fileID: 1494334785} - {fileID: 1927660778} - {fileID: 2044936706} @@ -4784,7 +5121,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3258417366846669140, guid: 264ea51d92067c14ebc6633999afac78, type: 3} propertyPath: _sceneNetworkObjects.Array.size - value: 17 + value: 19 objectReference: {fileID: 0} - target: {fileID: 3258417366846669140, guid: 264ea51d92067c14ebc6633999afac78, type: 3} propertyPath: _networkBehaviours.Array.data[0] @@ -4853,26 +5190,34 @@ PrefabInstance: - target: {fileID: 3258417366846669140, guid: 264ea51d92067c14ebc6633999afac78, type: 3} propertyPath: _sceneNetworkObjects.Array.data[11] value: - objectReference: {fileID: 913757968} + objectReference: {fileID: 878406322} - target: {fileID: 3258417366846669140, guid: 264ea51d92067c14ebc6633999afac78, type: 3} propertyPath: _sceneNetworkObjects.Array.data[12] value: - objectReference: {fileID: 914529552} + objectReference: {fileID: 913757968} - target: {fileID: 3258417366846669140, guid: 264ea51d92067c14ebc6633999afac78, type: 3} propertyPath: _sceneNetworkObjects.Array.data[13] value: - objectReference: {fileID: 990295462} + objectReference: {fileID: 914529552} - target: {fileID: 3258417366846669140, guid: 264ea51d92067c14ebc6633999afac78, type: 3} propertyPath: _sceneNetworkObjects.Array.data[14] value: - objectReference: {fileID: 1494334785} + objectReference: {fileID: 990295462} - target: {fileID: 3258417366846669140, guid: 264ea51d92067c14ebc6633999afac78, type: 3} propertyPath: _sceneNetworkObjects.Array.data[15] value: - objectReference: {fileID: 1927660778} + objectReference: {fileID: 1000564558} - target: {fileID: 3258417366846669140, guid: 264ea51d92067c14ebc6633999afac78, type: 3} propertyPath: _sceneNetworkObjects.Array.data[16] value: + objectReference: {fileID: 1494334785} + - target: {fileID: 3258417366846669140, guid: 264ea51d92067c14ebc6633999afac78, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[17] + value: + objectReference: {fileID: 1927660778} + - target: {fileID: 3258417366846669140, guid: 264ea51d92067c14ebc6633999afac78, type: 3} + propertyPath: _sceneNetworkObjects.Array.data[18] + value: objectReference: {fileID: 2044936706} - target: {fileID: 3298710121668139635, guid: 264ea51d92067c14ebc6633999afac78, type: 3} propertyPath: _networkObjectCache @@ -49244,6 +49589,38 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 398420162735365301, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 398420162735365301, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 398420162735365301, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 398420162735365301, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 618335581785848291, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 618335581785848291, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 618335581785848291, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 618335581785848291, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 1363088853413571436, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} propertyPath: m_AnchorMax.x value: 0 @@ -49252,6 +49629,26 @@ PrefabInstance: propertyPath: m_AnchorMax.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 1842785321458664040, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1842785321458664040, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1842785321458664040, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1842785321458664040, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2527991446718283015, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: PocketView + value: + objectReference: {fileID: 676448448} - target: {fileID: 3810371244597919609, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} propertyPath: m_Pivot.x value: 0 @@ -49344,6 +49741,126 @@ PrefabInstance: propertyPath: m_Name value: Player Canvas objectReference: {fileID: 0} + - target: {fileID: 3810371244597919613, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6668962487800749738, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6668962487800749738, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6668962487800749738, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6668962487800749738, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6668962487800749738, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6668962487800749738, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7967586554743321194, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7967586554743321194, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7967586554743321194, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7967586554743321194, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7967586554743321194, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7967586554743321194, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8098506172083102939, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: TransformParent + value: + objectReference: {fileID: 576650548} + - target: {fileID: 8143442421376935510, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8143442421376935510, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8143442421376935510, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8143442421376935510, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8358857625727050732, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8358857625727050732, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8358857625727050732, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8358857625727050732, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8474992757558840237, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8474992757558840237, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8474992757558840237, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8474992757558840237, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8623240690935402821, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8623240690935402821, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8623240690935402821, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8623240690935402821, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: df2268f4f5f6669459174c6d7e2043ce, type: 3} --- !u!23 &3811857806287679634 diff --git a/Assets/Scenes/Startup.unity b/Assets/Scenes/Startup.unity index f28ec8b9f9..91062416c6 100644 --- a/Assets/Scenes/Startup.unity +++ b/Assets/Scenes/Startup.unity @@ -1058,6 +1058,10 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 1928667160} m_Modifications: + - target: {fileID: 1160312076, guid: 83e602c09f6d862428c09d7503632bfd, type: 3} + propertyPath: m_Alpha + value: 0 + objectReference: {fileID: 0} - target: {fileID: 1042289194392677491, guid: 83e602c09f6d862428c09d7503632bfd, type: 3} propertyPath: m_Name value: SS3D @@ -1218,6 +1222,14 @@ PrefabInstance: propertyPath: m_SizeDelta.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 6064092890518086050, guid: 83e602c09f6d862428c09d7503632bfd, type: 3} + propertyPath: m_Sprite + value: + objectReference: {fileID: 21300000, guid: 886e4060d55daf74e9512d9555ca9b8f, type: 3} + - target: {fileID: 6064092890518086050, guid: 83e602c09f6d862428c09d7503632bfd, type: 3} + propertyPath: m_PreserveAspect + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: - {fileID: 1160312077, guid: 83e602c09f6d862428c09d7503632bfd, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 83e602c09f6d862428c09d7503632bfd, type: 3} @@ -1862,7 +1874,7 @@ RectTransform: m_ConstrainProportionsScale: 1 m_Children: [] m_Father: {fileID: 794261410} - m_RootOrder: 3 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} @@ -2081,6 +2093,22 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 6150087420938704148, guid: 92d2bc3037e4add468512b90d3e1ed43, type: 3} + propertyPath: m_Sprite + value: + objectReference: {fileID: 21300000, guid: dfdc99339da4f3d45b058a426ba8d516, type: 3} + - target: {fileID: 6150087420938704148, guid: 92d2bc3037e4add468512b90d3e1ed43, type: 3} + propertyPath: m_Color.b + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6150087420938704148, guid: 92d2bc3037e4add468512b90d3e1ed43, type: 3} + propertyPath: m_Color.g + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6150087420938704148, guid: 92d2bc3037e4add468512b90d3e1ed43, type: 3} + propertyPath: m_Color.r + value: 1 + objectReference: {fileID: 0} - target: {fileID: 7619658171493412490, guid: 92d2bc3037e4add468512b90d3e1ed43, type: 3} propertyPath: m_Camera value: @@ -2173,5 +2201,9 @@ PrefabInstance: propertyPath: m_Name value: Intro Canvas objectReference: {fileID: 0} + - target: {fileID: 7619658171493412503, guid: 92d2bc3037e4add468512b90d3e1ed43, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 92d2bc3037e4add468512b90d3e1ed43, type: 3} diff --git a/Assets/Scripts/EditorTests/HealthTests.cs b/Assets/Scripts/EditorTests/HealthTests.cs index 970c566ea2..e9a5b916c8 100644 --- a/Assets/Scripts/EditorTests/HealthTests.cs +++ b/Assets/Scripts/EditorTests/HealthTests.cs @@ -27,7 +27,7 @@ public void TearDown() [TestCase(10.01f, false)] public void CanCommenceInteractionOnlyWhenStaminaIsGreaterThatZero(float staminaToDeplete, bool expectedResult) { - IStamina sut = StaminaHelper.Create(10f); + IStamina sut = StaminaFactory.Create(10f); sut.ConsumeStamina(staminaToDeplete); @@ -43,7 +43,7 @@ public void CanCommenceInteractionOnlyWhenStaminaIsGreaterThatZero(float stamina [TestCase(11.01f, false)] public void CanContinueInteractionWithNegativeStaminaUntilNegativeTenPercent(float staminaToDeplete, bool expectedResult) { - IStamina sut = StaminaHelper.Create(10f); + IStamina sut = StaminaFactory.Create(10f); sut.ConsumeStamina(staminaToDeplete); @@ -60,7 +60,7 @@ public void CanContinueInteractionWithNegativeStaminaUntilNegativeTenPercent(flo [TestCase(100f, 0f)] public void ConsumeStaminaCorrectlyReducesTheStaminaValue(float staminaToDeplete, float expectedResult) { - IStamina sut = StaminaHelper.Create(10f); + IStamina sut = StaminaFactory.Create(10f); sut.ConsumeStamina(staminaToDeplete); @@ -77,7 +77,7 @@ public void ConsumeStaminaCorrectlyReducesTheStaminaValue(float staminaToDeplete [TestCase(100f, 1f)] public void RechargingStaminaCorrectlyReducesTheStaminaValue(float secondsToRecharge, float expectedResult) { - IStamina sut = StaminaHelper.Create(10f, 1f); // Set up stamina to fully recharge after 1 second. + IStamina sut = StaminaFactory.Create(10f, 1f); // Set up stamina to fully recharge after 1 second. sut.ConsumeStamina(10f); // Deplete all of the stamina sut.RechargeStamina(secondsToRecharge); diff --git a/Assets/Scripts/SS3D/Core/ApplicationStateSystem.cs.meta b/Assets/Scripts/SS3D/Core/ApplicationStateSystem.cs.meta index 1e938f9d29..6f2c26d6aa 100644 --- a/Assets/Scripts/SS3D/Core/ApplicationStateSystem.cs.meta +++ b/Assets/Scripts/SS3D/Core/ApplicationStateSystem.cs.meta @@ -4,7 +4,7 @@ MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] - executionOrder: 5 + executionOrder: -2 icon: {fileID: 2800000, guid: 1bce13c2663afd54382ddd17e34235cd, type: 3} userData: assetBundleName: diff --git a/Assets/Scripts/SS3D/Core/Behaviours/NetworkActor.cs b/Assets/Scripts/SS3D/Core/Behaviours/NetworkActor.cs index 2346634b85..86968f5f2a 100644 --- a/Assets/Scripts/SS3D/Core/Behaviours/NetworkActor.cs +++ b/Assets/Scripts/SS3D/Core/Behaviours/NetworkActor.cs @@ -19,7 +19,7 @@ public class NetworkActor : NetworkBehaviour private bool _initialized; - protected readonly List _eventHandles = new(); + private readonly List _eventHandles = new(); public Transform TransformCache { @@ -161,7 +161,7 @@ private void RemoveEventListeners() foreach (EventHandle eventHandle in _eventHandles) { eventService?.RemoveListener(eventHandle); - } + } } #endregion diff --git a/Assets/Scripts/SS3D/Core/Behaviours/NetworkView.cs b/Assets/Scripts/SS3D/Core/Behaviours/NetworkView.cs new file mode 100644 index 0000000000..2dad500cb4 --- /dev/null +++ b/Assets/Scripts/SS3D/Core/Behaviours/NetworkView.cs @@ -0,0 +1,19 @@ +namespace SS3D.Core.Behaviours +{ + public class NetworkView : NetworkActor + { + protected override void OnAwake() + { + base.OnAwake(); + + ViewLocator.Register(this); + } + + protected override void OnDestroyed() + { + base.OnDestroyed(); + + ViewLocator.Unregister(this); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Core/Behaviours/NetworkView.cs.meta b/Assets/Scripts/SS3D/Core/Behaviours/NetworkView.cs.meta new file mode 100644 index 0000000000..6f39f6feb3 --- /dev/null +++ b/Assets/Scripts/SS3D/Core/Behaviours/NetworkView.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 125c91d626804b6987d0462ed2bab2ba +timeCreated: 1673798205 \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Core/Behaviours/View.cs b/Assets/Scripts/SS3D/Core/Behaviours/View.cs new file mode 100644 index 0000000000..f72a6ad165 --- /dev/null +++ b/Assets/Scripts/SS3D/Core/Behaviours/View.cs @@ -0,0 +1,22 @@ +namespace SS3D.Core.Behaviours +{ + /// + /// Base class for a UI that is Unique + /// + public class View : Actor + { + protected override void OnAwake() + { + base.OnAwake(); + + ViewLocator.Register(this); + } + + protected override void OnDestroyed() + { + base.OnDestroyed(); + + ViewLocator.Unregister(this); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Core/Behaviours/View.cs.meta b/Assets/Scripts/SS3D/Core/Behaviours/View.cs.meta new file mode 100644 index 0000000000..e3213f8fdb --- /dev/null +++ b/Assets/Scripts/SS3D/Core/Behaviours/View.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7e52157795604664b266f60cfddf23b8 +timeCreated: 1673798197 \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Core/SessionNetworkSystem.cs b/Assets/Scripts/SS3D/Core/SessionNetworkSystem.cs index 70d39e1033..b4d55a45ad 100644 --- a/Assets/Scripts/SS3D/Core/SessionNetworkSystem.cs +++ b/Assets/Scripts/SS3D/Core/SessionNetworkSystem.cs @@ -36,16 +36,15 @@ public void InitializeNetworkSession() switch (networkType) { case NetworkType.ServerOnly: - Debug.Log($"[{nameof(SessionNetworkSystem)}] - Hosting a new headless server"); + Punpun.Say(this, "Hosting a new headless server"); networkManager.ServerManager.StartConnection(); break; case NetworkType.Client: - Punpun.Say(this, $"Joining server {serverAddress} as {ckey}", Logs.Important); networkManager.ClientManager.StartConnection(serverAddress); break; case NetworkType.Host: - Debug.Log($"[{nameof(SessionNetworkSystem)}] - Hosting a new server"); + Punpun.Say(this, "Hosting a new server"); networkManager.ServerManager.StartConnection(); networkManager.ClientManager.StartConnection(); break; diff --git a/Assets/Scripts/SS3D/Core/Settings/ApplicationSettings.cs b/Assets/Scripts/SS3D/Core/Settings/ApplicationSettings.cs index c9b8e337d9..f7b3579999 100644 --- a/Assets/Scripts/SS3D/Core/Settings/ApplicationSettings.cs +++ b/Assets/Scripts/SS3D/Core/Settings/ApplicationSettings.cs @@ -1,5 +1,4 @@ -using System; -using Coimbra; +using Coimbra; using UnityEngine; namespace SS3D.Core.Settings diff --git a/Assets/Scripts/SS3D/Core/SystemLocator.cs b/Assets/Scripts/SS3D/Core/SystemLocator.cs index a74bc72a4e..aeb19b03c4 100644 --- a/Assets/Scripts/SS3D/Core/SystemLocator.cs +++ b/Assets/Scripts/SS3D/Core/SystemLocator.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using SS3D.Logging; using UnityEngine; -using Object = UnityEngine.Object; namespace SS3D.Core { @@ -20,7 +19,6 @@ public static class SystemLocator /// Registers a system in the dictionary so we don't have to use find object of type. /// /// The object to be stored. - /// The Type of that object. public static void Register(MonoBehaviour system) { Type type = system.GetType(); diff --git a/Assets/Scripts/SS3D/Core/ViewLocator.cs b/Assets/Scripts/SS3D/Core/ViewLocator.cs new file mode 100644 index 0000000000..fba3bf35e9 --- /dev/null +++ b/Assets/Scripts/SS3D/Core/ViewLocator.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SS3D.Logging; +using UnityEngine; + +namespace SS3D.Core +{ + /// + /// Class used to get game systems, using generics and then making cache of said systems. + /// + public static class ViewLocator + { + /// + /// A dictionary containing all the objects that registered themselves. + /// + private static readonly Dictionary> Views = new(); + + /// + /// Registers a view into a view list. + /// + /// The object to be stored. + public static void Register(MonoBehaviour view) + { + Type type = view.GetType(); + + if (!Views.TryGetValue(type, out List viewList)) + { + Views.Add(type, new List { view }); + } + + else + { + viewList.Add(view); + } + } + + /// + /// Removes a view from the view list. + /// + /// + public static void Unregister(MonoBehaviour view) + { + Type type = view.GetType(); + + if (Views.TryGetValue(type, out List viewList)) + { + viewList.Remove(view); + } + } + + /// + /// Gets a list of view of type T. + /// + /// The Type of object you want to get. + /// + public static List Get() where T : MonoBehaviour + { + if (Views.TryGetValue(typeof(T), out List match)) + { + return match.Cast().ToList(); + } + + string message = $"No views of type {typeof(T).Name} found."; + // ReSharper disable once Unity.PerformanceCriticalCodeInvocation + Punpun.Panic(typeof(SystemLocator), message, Logs.Important); + + return null; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Core/ViewLocator.cs.meta b/Assets/Scripts/SS3D/Core/ViewLocator.cs.meta new file mode 100644 index 0000000000..601143147c --- /dev/null +++ b/Assets/Scripts/SS3D/Core/ViewLocator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 493f4fbbf38b427490f3a760e270d924 +timeCreated: 1673798228 \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Data/AssetDatabases/InteractionIconsAssetDatabaseInspectorEditor.cs b/Assets/Scripts/SS3D/Data/AssetDatabases/InteractionIconsAssetDatabaseInspectorEditor.cs new file mode 100644 index 0000000000..9a74c092a8 --- /dev/null +++ b/Assets/Scripts/SS3D/Data/AssetDatabases/InteractionIconsAssetDatabaseInspectorEditor.cs @@ -0,0 +1,87 @@ +#if UNITY_EDITOR +using System; +using System.IO; +using System.Text.RegularExpressions; +using SS3D.CodeGeneration; +using UnityEditor; +using UnityEngine; + +namespace SS3D.Data.AssetDatabases +{ + [CustomEditor(typeof(InteractionIconsAssetDatabase))] + public class InteractionIconsAssetDatabaseInspectorEditor : Editor + { + private InteractionIconsAssetDatabase _assetDatabase; + private static GUIContent _folderIcon; + + private static readonly Regex SlashRegex = new(@"[\\//]"); + + private void OnEnable() + { + _assetDatabase = (InteractionIconsAssetDatabase)target; + _folderIcon = EditorGUIUtility.IconContent("d_FolderOpened Icon"); + } + + public override void OnInspectorGUI() + { + GUILayoutOption iconWidthConstraint = GUILayout.MaxWidth(200.0f); + GUILayoutOption iconHeightConstraint = GUILayout.MaxHeight(EditorGUIUtility.singleLineHeight); + + GUIStyle labelStyle = new() + { + fontStyle = FontStyle.Bold, + normal = + { + textColor = Color.white + }, + padding = new RectOffset(0, 0, 10, 10), + }; + + GUILayout.Label("Enum writer settings", labelStyle); + + if (GUILayout.Button($"Set enum creation path", iconWidthConstraint, iconHeightConstraint)) + { + if (TryOpenFolderPathInsideAssetsFolder(null, Application.dataPath, null, out string result)) + { + _assetDatabase.EnumPath = result; + + } + else + { + EditorWindow.focusedWindow.ShowNotification(new GUIContent($"{result} must be inside the Assets folder.")); + } + } + + GUILayout.Space(5); + + if (GUILayout.Button($"Create enum", GUILayout.Width(200))) + { + EnumCreator.CreateAtPath(_assetDatabase.EnumPath, _assetDatabase.EnumName, _assetDatabase.Assets, _assetDatabase.EnumNamespaceName); + } + + GUILayout.Label("Asset database settings", labelStyle); + + base.OnInspectorGUI(); + } + + private static bool TryOpenFolderPathInsideAssetsFolder(string title, string folder, string name, out string result) + { + result = null; + + string selectedPath = EditorUtility.OpenFolderPanel(title, folder, name); + + if (selectedPath.StartsWith(Application.dataPath, StringComparison.OrdinalIgnoreCase)) + { + Debug.Log(Application.dataPath); + Debug.Log(selectedPath); + + result = SlashRegex.Replace(selectedPath.Remove(0, Application.dataPath.Length), Path.DirectorySeparatorChar.ToString()); + + return true; + } + + return false; + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Data/AssetDatabases/InteractionIconsAssetDatabaseInspectorEditor.cs.meta b/Assets/Scripts/SS3D/Data/AssetDatabases/InteractionIconsAssetDatabaseInspectorEditor.cs.meta new file mode 100644 index 0000000000..6b5acba6c1 --- /dev/null +++ b/Assets/Scripts/SS3D/Data/AssetDatabases/InteractionIconsAssetDatabaseInspectorEditor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 02c5d7a1f75c4388ba992dfa76bbcbce +timeCreated: 1673810721 \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Networking/SS3D.Networking.asmdef b/Assets/Scripts/SS3D/Networking/SS3D.Networking.asmdef index 26cfcc272e..82a08e074a 100644 --- a/Assets/Scripts/SS3D/Networking/SS3D.Networking.asmdef +++ b/Assets/Scripts/SS3D/Networking/SS3D.Networking.asmdef @@ -9,7 +9,9 @@ "GUID:92a1e40b8cccf8645adbdd275ac6371a", "GUID:6e00473804df0f0468c07310fbce5737", "GUID:6055be8ebefd69e48b49212b09b47b2f", - "GUID:f51ebe6a0ceec4240a699833d6309b23" + "GUID:f51ebe6a0ceec4240a699833d6309b23", + "GUID:2aa873da5672f9c418c3d5556aaa7ca8", + "GUID:6aabbee860c32c64d9bbd52d0704ed2c" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Assets/Scripts/SS3D/Networking/UnauthorizedPlayer.cs b/Assets/Scripts/SS3D/Networking/UnauthorizedPlayer.cs index 718951a934..b9072b7b9c 100644 --- a/Assets/Scripts/SS3D/Networking/UnauthorizedPlayer.cs +++ b/Assets/Scripts/SS3D/Networking/UnauthorizedPlayer.cs @@ -1,7 +1,7 @@ -using FishNet; +using Coimbra; using FishNet.Object; using SS3D.Core.Settings; -using SS3D.Core.Utils; +using SS3D.Logging; using SS3D.Systems.PlayerControl.Messages; using UnityEngine; @@ -15,11 +15,11 @@ public sealed class UnauthorizedPlayer : NetworkBehaviour public override void OnStartClient() { base.OnStartClient(); - + Setup(); } - [Client] + [Client(RequireOwnership = true)] private void Setup() { string ckey = LocalPlayer.Ckey; @@ -30,10 +30,11 @@ private void Setup() return; } + Punpun.Say(this, $"Attempting authentication for user {ckey}", Logs.ClientOnly); + UserAuthorizationMessage userAuthorizationMessage = new(ckey); - InstanceFinder.ClientManager.Broadcast(userAuthorizationMessage); + ClientManager.Broadcast(userAuthorizationMessage); - CmdRemoveConnectionAfterLogin(); CmdDestroyObjectAfterLogin(); } @@ -42,11 +43,5 @@ private void CmdDestroyObjectAfterLogin() { ServerManager.Despawn(gameObject); } - - [ServerRpc(RequireOwnership = false)] - private void CmdRemoveConnectionAfterLogin() - { - NetworkObject.RemoveOwnership(); - } } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Networking/UnauthorizedPlayer.cs.meta b/Assets/Scripts/SS3D/Networking/UnauthorizedPlayer.cs.meta index 4769da5df4..74b99f8297 100644 --- a/Assets/Scripts/SS3D/Networking/UnauthorizedPlayer.cs.meta +++ b/Assets/Scripts/SS3D/Networking/UnauthorizedPlayer.cs.meta @@ -4,7 +4,7 @@ MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] - executionOrder: 100 + executionOrder: -3 icon: {instanceID: 0} userData: assetBundleName: diff --git a/Assets/Scripts/SS3D/Systems/Entities/Debug/MindSwapDebug.cs b/Assets/Scripts/SS3D/Systems/Entities/Debug/MindSwapDebug.cs index 859101fe7b..0c37dc0f34 100644 --- a/Assets/Scripts/SS3D/Systems/Entities/Debug/MindSwapDebug.cs +++ b/Assets/Scripts/SS3D/Systems/Entities/Debug/MindSwapDebug.cs @@ -1,13 +1,13 @@ +using SS3D.Core; using SS3D.Core.Behaviours; -using SS3D.Systems.Entities.Messages; using UnityEngine; namespace SS3D.Systems.Entities.Debug { public class MindSwapDebug : NetworkActor { - public GameObject Origin; - public GameObject Target; + public Entity Origin; + public Entity Target; protected override void HandleUpdate(in float deltaTime) { @@ -27,11 +27,11 @@ public void DoMindSwap() return; } - RequestMindSwap mindSwap = new(Origin, Target); - ClientManager.Broadcast(mindSwap); + MindSystem mindSystem = SystemLocator.Get(); + mindSystem.CmdSwapMinds(Origin, Target); - Origin = mindSwap.Target; - Target = mindSwap.Origin; + Origin = Target; + Target = Origin; } } } diff --git a/Assets/Scripts/SS3D/Systems/Entities/Entity.cs b/Assets/Scripts/SS3D/Systems/Entities/Entity.cs new file mode 100644 index 0000000000..5d51af2eae --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Entities/Entity.cs @@ -0,0 +1,82 @@ +using System; +using FishNet.Object; +using FishNet.Object.Synchronizing; +using SS3D.Core.Behaviours; +using SS3D.Systems.Entities.Events; +using UnityEngine; + +namespace SS3D.Systems.Entities +{ + /// + /// Base class for all things that can be controlled by a player. + /// + [Serializable] + public class Entity : NetworkActor + { + public event Action OnMindChanged; + + [SerializeField] + [SyncVar(OnChange = nameof(SyncMind))] + private Mind _mind = Mind.Empty; + + public Mind Mind + { + get => _mind; + set => _mind = value; + } + + public string Ckey => _mind.Soul.Ckey; + + protected override void OnStart() + { + base.OnStart(); + + OnSpawn(); + } + + private void OnSpawn() + { + OnMindChanged?.Invoke(Mind); + } + + private void InvokeLocalPlayerObjectChanged() + { + if (!Mind.Soul.IsLocalConnection) + { + return; + } + + LocalPlayerObjectChanged localPlayerObjectChanged = new(GameObjectCache); + localPlayerObjectChanged.Invoke(this); + } + + /// + /// Called by FishNet when the value of _mind is synced. + /// + /// Value before sync + /// Value after sync + /// Is the sync is being called as the server (host and server only) + public void SyncMind(Mind oldMind, Mind newSoul, bool asServer) + { + if (!asServer && IsHost) + { + return; + } + + OnMindChanged?.Invoke(_mind); + InvokeLocalPlayerObjectChanged(); + } + + /// + /// Updates the mind of this entity. + /// + /// The new mind. + [Server] + public void SetMind(Mind mind) + { + _mind = mind; + + GiveOwnership(mind.Owner); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Entities/PlayerControllable.cs.meta b/Assets/Scripts/SS3D/Systems/Entities/Entity.cs.meta similarity index 100% rename from Assets/Scripts/SS3D/Systems/Entities/PlayerControllable.cs.meta rename to Assets/Scripts/SS3D/Systems/Entities/Entity.cs.meta diff --git a/Assets/Scripts/SS3D/Systems/Entities/EntitySpawnSystem.cs b/Assets/Scripts/SS3D/Systems/Entities/EntitySpawnSystem.cs deleted file mode 100644 index 3cffd0cd32..0000000000 --- a/Assets/Scripts/SS3D/Systems/Entities/EntitySpawnSystem.cs +++ /dev/null @@ -1,247 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Coimbra; -using Coimbra.Services.Events; -using FishNet.Connection; -using FishNet.Object; -using FishNet.Object.Synchronizing; -using SS3D.Core; -using SS3D.Core.Behaviours; -using SS3D.Logging; -using SS3D.Systems.Entities; -using SS3D.Systems.Entities.Events; -using SS3D.Systems.Entities.Messages; -using SS3D.Systems.PlayerControl; -using SS3D.Systems.Rounds; -using SS3D.Systems.Rounds.Events; -using SS3D.Systems.Rounds.Messages; -using UnityEngine; - -namespace SS3D.Systems.Entities -{ - /// - /// Controls player spawning. - /// - public class EntitySpawnSystem : NetworkSystem - { - [Header("Settings")] - [SerializeField] - private List _tempHuman; - - [SerializeField] - private Transform _tempSpawnPoint; - - [SyncObject] - private readonly SyncList _spawnedPlayers = new(); - - private bool _alreadySpawnedInitialPlayers; - - public bool IsPlayedSpawned(string ckey) => _spawnedPlayers.Find(controllable => controllable.ControllingSoul.Ckey == ckey); - public bool IsPlayedSpawned(NetworkConnection networkConnection) => _spawnedPlayers.Find(controllable => controllable.Owner == networkConnection); - public List SpawnedPlayers => _spawnedPlayers.ToList(); - public PlayerControllable LastSpawned => _spawnedPlayers.Count != 0 ? _spawnedPlayers.Last() : null; - - protected override void OnStart() - { - base.OnStart(); - - _spawnedPlayers.OnChange += HandleSpawnedPlayersChanged; - } - - public override void OnStartClient() - { - base.OnStartClient(); - - SyncSpawnedPlayers(); - } - - public override void OnStartServer() - { - base.OnStartServer(); - - ServerManager.RegisterBroadcast(HandleRequestEmbark); - ServerManager.RegisterBroadcast(HandleRequestMindSwap); - - SpawnReadyPlayersEvent.AddListener(HandleSpawnReadyPlayers); - RoundStateUpdated.AddListener(HandleRoundStateUpdated); - } - - private void HandleRequestMindSwap(NetworkConnection conn, RequestMindSwap m) - { - ProcessMindSwap(m.Origin, m.Target); - } - - [Server] - private void ProcessMindSwap(GameObject origin, GameObject target) - { - PlayerControllable originControllable = origin.GetComponent(); - PlayerControllable targetControllable = target.GetComponent(); - - Soul originSoul = originControllable.ControllingSoul; - Soul targetSoul = targetControllable.ControllingSoul; - - originControllable.SetControllingSoul(targetSoul); - targetControllable.SetControllingSoul(originSoul); - } - - [Server] - private void HandleRoundStateUpdated(ref EventContext context, in RoundStateUpdated e) - { - RoundState roundState = e.RoundState; - - if (roundState != RoundState.Stopped) - { - return; - } - - DestroySpawnedPlayers(); - } - - [Server] - private void HandleSpawnReadyPlayers(ref EventContext context, in SpawnReadyPlayersEvent e) - { - List playersToSpawn = e.ReadyPlayers; - - SpawnReadyPlayers(playersToSpawn); - } - - [Server] - private void HandleRequestEmbark(NetworkConnection conn, RequestEmbarkMessage m) - { - string ckey = m.Ckey; - - SpawnLatePlayer(ckey); - } - - /// - /// Spawns a player after the round has started - /// - /// - [Server] - private void SpawnLatePlayer(string ckey) - { - if (!_spawnedPlayers.Find(controllable => controllable.ControllingSoul.Ckey == ckey) && _alreadySpawnedInitialPlayers) - { - SpawnPlayer(ckey); - } - } - - /// - /// Spawns all the players that are ready when the round starts - /// - /// - [Server] - private void SpawnReadyPlayers(List players) - { - if (_alreadySpawnedInitialPlayers) - { - return; - } - - if (players.Count == 0) - { - Punpun.Say(this, "No players to spawn", Logs.ServerOnly); - } - - foreach (string ckey in players) - { - SpawnPlayer(ckey); - } - - _alreadySpawnedInitialPlayers = true; - InitialPlayersSpawnedEvent initialPlayersSpawnedEvent = new(SpawnedPlayers); - initialPlayersSpawnedEvent.Invoke(this); - } - - /// - /// Destroys all spawned players - /// - [Server] - private void DestroySpawnedPlayers() - { - foreach (PlayerControllable player in SpawnedPlayers) - { - ServerManager.Despawn(player.NetworkObject); - player.GameObjectCache.Destroy(); - } - - _alreadySpawnedInitialPlayers = false; - _spawnedPlayers.Clear(); - } - - /// - /// Spawns a player with a Ckey - /// - /// Unique user key - [Server] - private void SpawnPlayer(string ckey) - { - PlayerControlSystem playerControlSystem = SystemLocator.Get(); - - Soul soul = playerControlSystem.GetSoul(ckey); - PlayerControllable controllable = Instantiate(_tempHuman[Random.Range(0, _tempHuman.Count)], _tempSpawnPoint.position, Quaternion.identity); - - ServerManager.Spawn(controllable.NetworkObject, soul.Owner); - controllable.SetControllingSoul(soul); - - _spawnedPlayers.Add(controllable); - - var humanNames = new List(); - foreach (PlayerControllable player in SpawnedPlayers) - { - humanNames.Add(player.gameObject.name); - } - // Rename the current PlayerControllable game object, - // and send to the client the updated name of the other playerControllables already spawned. - RpcSetPlayerControllableName(ckey, controllable, humanNames); - - string message = $"Spawning player {soul.Ckey} on {controllable.name}"; - Punpun.Say(this, message, Logs.ServerOnly); - } - - - - /// - /// Rename HumanTemp game object, instantiated from the Human_Temporary prefab, with a name corresponding to their "soul" name. - /// This has no other purpose than to facilitate debugging by giving a quick way to differentiate between - /// two PlayerControllable game objects. Please change this summary if it's used elsewhere. - /// - /// Unique user key, representing the name of the player. - /// The last PlayerControllable instantiated. - /// The new names of the PlayerControllable game object. The order of the name in the list - /// must be the same as the order of the PlayerControllable objects in _spawnedPlayers SyncList - [ObserversRpc] - private void RpcSetPlayerControllableName(string ckey, PlayerControllable controllable, List humanNames) - { - int nameIndex = 0; - - foreach (PlayerControllable controllableAlreadySpawned in _spawnedPlayers) - { - controllableAlreadySpawned.gameObject.name = humanNames.ElementAt(nameIndex); - nameIndex++; - } - controllable.gameObject.name = $"Player - {ckey}"; - } - - private void HandleSpawnedPlayersChanged(SyncListOperation op, int index, PlayerControllable old, PlayerControllable @new, bool asServer) - { - if (op == SyncListOperation.Complete) - { - return; - } - - if (!asServer && IsHost) - { - return; - } - - SyncSpawnedPlayers(); - } - - private void SyncSpawnedPlayers() - { - SpawnedPlayersUpdated spawnedPlayersUpdated = new(SpawnedPlayers); - spawnedPlayersUpdated.Invoke(this); - } - } -} diff --git a/Assets/Scripts/SS3D/Systems/Entities/EntitySystem.cs b/Assets/Scripts/SS3D/Systems/Entities/EntitySystem.cs new file mode 100644 index 0000000000..9cc53bc165 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Entities/EntitySystem.cs @@ -0,0 +1,276 @@ +using System.Collections.Generic; +using System.Linq; +using Coimbra; +using Coimbra.Services.Events; +using FishNet.Connection; +using FishNet.Object; +using FishNet.Object.Synchronizing; +using SS3D.Core; +using SS3D.Core.Behaviours; +using SS3D.Logging; +using SS3D.Systems.Entities.Events; +using SS3D.Systems.Rounds; +using SS3D.Systems.Rounds.Events; +using SS3D.Utils; +using UnityEngine; + +namespace SS3D.Systems.Entities +{ + /// + /// Controls player spawning. + /// + public class EntitySystem : NetworkSystem + { + /// + /// The prefab used for the player object. + /// + [Header("Settings")] + [SerializeField] + private List _humanPrefab; + + /// + /// The point used to place spawned players + /// + [SerializeField] + private Transform _spawnPoint; + + /// + /// List of the spawned players in the round + /// + [SyncObject] + private readonly SyncList _spawnedPlayers = new(); + + /// + /// If the system already spawned all the players that were ready when the round started + /// + [SyncVar(OnChange = nameof(SyncHasSpawnedInitialPlayers))] + private bool _hasSpawnedInitialPlayers; + + /// + /// Returns true if the player is controlling an entity. + /// + /// The player's ckey + /// Is the player is controlling an entity + public bool IsPlayerSpawned(Soul soul) + { + Entity spawnedPlayer = _spawnedPlayers.Find(entity => entity.Mind.Soul == soul); + + bool isPlayerSpawned; + if (spawnedPlayer == null || spawnedPlayer.Mind == Mind.Empty) + { + isPlayerSpawned = false; + } + else + { + isPlayerSpawned = true; + } + + return isPlayerSpawned; + } + + /// + /// Returns true if the networkConnection is controlling an entity. + /// + /// The player's connection + /// Is the player is controlling an entity + public bool IsPlayerSpawned(NetworkConnection networkConnection) + { + Entity spawnedPlayer = _spawnedPlayers.Find(entity => entity.Mind?.Soul?.Owner == networkConnection); + + bool isPlayerSpawned; + + if (spawnedPlayer == null) + { + isPlayerSpawned = false; + } + else if (spawnedPlayer.Mind == Mind.Empty) + { + isPlayerSpawned = false; + } + else + { + isPlayerSpawned = true; + } + + return isPlayerSpawned; + } + + /// + /// List of currently spawned players in the round. + /// + public List SpawnedPlayers => _spawnedPlayers.ToList(); + + /// + /// Returns the last spawned player. + /// + public Entity LastSpawned => _spawnedPlayers.Count != 0 ? _spawnedPlayers.Last() : null; + + protected override void OnStart() + { + base.OnStart(); + + _spawnedPlayers.OnChange += HandleSpawnedPlayersChanged; + } + + public override void OnStartClient() + { + base.OnStartClient(); + + SyncSpawnedPlayers(); + } + + public override void OnStartServer() + { + base.OnStartServer(); + + ServerAddEventListeners(); + } + + private void ServerAddEventListeners() + { + AddHandle(SpawnReadyPlayersEvent.AddListener(HandleSpawnReadyPlayers)); + AddHandle(RoundStateUpdated.AddListener(HandleRoundStateUpdated)); + } + + /// + /// Asks the server to spawn a player. + /// + /// + /// + [ServerRpc(RequireOwnership = false)] + public void CmdSpawnLatePlayer(Soul soul, NetworkConnection networkConnection = null) + { + SpawnLatePlayer(soul); + } + + /// + /// Spawns a player after the round has started + /// + /// The player's ckey + [Server] + private void SpawnLatePlayer(Soul soul) + { + if (!IsPlayerSpawned(soul) && _hasSpawnedInitialPlayers) + { + SpawnPlayer(soul); + } + } + + /// + /// Spawns a player with a Ckey + /// + /// Unique user object + [Server] + private void SpawnPlayer(Soul soul) + { + MindSystem mindSystem = SystemLocator.Get(); + mindSystem.TryCreateMind(soul, out Mind createdMind); + + Entity entity = Instantiate(_humanPrefab[Random.Range(0, _humanPrefab.Count)], _spawnPoint.position, Quaternion.identity); + ServerManager.Spawn(entity.NetworkObject, soul.Owner); + + createdMind.SetSoul(soul); + entity.SetMind(createdMind); + + _spawnedPlayers.Add(entity); + + string message = $"Spawning mind {createdMind.name} on {entity.name}"; + Punpun.Say(this, message, Logs.ServerOnly); + } + + /// + /// Spawns all the players that are ready when the round starts + /// + /// + [Server] + private void SpawnReadyPlayers(List players) + { + if (_hasSpawnedInitialPlayers) return; + + if (players.Count == 0) + { + Punpun.Say(this, "No players to spawn", Logs.ServerOnly); + } + + foreach (Soul ckey in players) + { + SpawnPlayer(ckey); + } + + _hasSpawnedInitialPlayers = true; + + new InitialPlayersSpawned(SpawnedPlayers).Invoke(this); + } + + /// + /// Destroys all spawned players + /// + [Server] + private void DestroySpawnedPlayers() + { + foreach (Entity player in SpawnedPlayers) + { + ServerManager.Despawn(player.NetworkObject); + player.GameObjectCache.Destroy(); + } + + _hasSpawnedInitialPlayers = false; + _spawnedPlayers.Clear(); + } + + [Server] + private void HandleRoundStateUpdated(ref EventContext context, in RoundStateUpdated e) + { + RoundState roundState = e.RoundState; + + if (roundState != RoundState.Stopped) + { + return; + } + + DestroySpawnedPlayers(); + } + + [Server] + private void HandleSpawnReadyPlayers(ref EventContext context, in SpawnReadyPlayersEvent e) + { + List playersToSpawn = e.ReadyPlayers; + + SpawnReadyPlayers(playersToSpawn); + } + + private void HandleSpawnedPlayersChanged(SyncListOperation op, int index, Entity old, Entity @new, bool asServer) + { + if (op == SyncListOperation.Complete) + { + return; + } + + if (!asServer && IsHost) + { + return; + } + + SyncSpawnedPlayers(); + } + + private void SyncSpawnedPlayers() + { + if (SpawnedPlayers.IsNullOrEmpty()) + { + return; + } + + SpawnedPlayersUpdated spawnedPlayersUpdated = new(SpawnedPlayers); + spawnedPlayersUpdated.Invoke(this); + } + + private void SyncHasSpawnedInitialPlayers(bool oldValue, bool newValue, bool asServer) + { + if (!asServer && IsHost) + { + return; + } + } + } +} diff --git a/Assets/Scripts/SS3D/Systems/Entities/EntitySpawnSystem.cs.meta b/Assets/Scripts/SS3D/Systems/Entities/EntitySystem.cs.meta similarity index 100% rename from Assets/Scripts/SS3D/Systems/Entities/EntitySpawnSystem.cs.meta rename to Assets/Scripts/SS3D/Systems/Entities/EntitySystem.cs.meta diff --git a/Assets/Scripts/SS3D/Systems/Entities/Events/InitialPlayersSpawned.cs b/Assets/Scripts/SS3D/Systems/Entities/Events/InitialPlayersSpawned.cs new file mode 100644 index 0000000000..540b48830a --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Entities/Events/InitialPlayersSpawned.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using Coimbra.Services.Events; + +namespace SS3D.Systems.Entities.Events +{ + public partial struct InitialPlayersSpawned : IEvent + { + public readonly List Players; + + public InitialPlayersSpawned(List players) + { + Players = players; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Entities/Events/InitialPlayersSpawnedEvent.cs.meta b/Assets/Scripts/SS3D/Systems/Entities/Events/InitialPlayersSpawned.cs.meta similarity index 100% rename from Assets/Scripts/SS3D/Systems/Entities/Events/InitialPlayersSpawnedEvent.cs.meta rename to Assets/Scripts/SS3D/Systems/Entities/Events/InitialPlayersSpawned.cs.meta diff --git a/Assets/Scripts/SS3D/Systems/Entities/Events/InitialPlayersSpawnedEvent.cs b/Assets/Scripts/SS3D/Systems/Entities/Events/InitialPlayersSpawnedEvent.cs deleted file mode 100644 index 8d327d21f1..0000000000 --- a/Assets/Scripts/SS3D/Systems/Entities/Events/InitialPlayersSpawnedEvent.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Collections.Generic; -using Coimbra.Services.Events; - -namespace SS3D.Systems.Entities.Events -{ - public partial struct InitialPlayersSpawnedEvent : IEvent - { - public readonly List Players; - - public InitialPlayersSpawnedEvent(List players) - { - Players = players; - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Entities/Events/LocalPlayerObjectChanged.cs b/Assets/Scripts/SS3D/Systems/Entities/Events/LocalPlayerObjectChanged.cs new file mode 100644 index 0000000000..dbe9d3107e --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Entities/Events/LocalPlayerObjectChanged.cs @@ -0,0 +1,15 @@ +using Coimbra.Services.Events; +using UnityEngine; + +namespace SS3D.Systems.Entities.Events +{ + public partial struct LocalPlayerObjectChanged : IEvent + { + public readonly GameObject Target; + + public LocalPlayerObjectChanged(GameObject target) + { + Target = target; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Entities/Events/LocalPlayerObjectChanged.cs.meta b/Assets/Scripts/SS3D/Systems/Entities/Events/LocalPlayerObjectChanged.cs.meta new file mode 100644 index 0000000000..b73194844f --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Entities/Events/LocalPlayerObjectChanged.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4e9b155bd29a460ea88af95125eefffc +timeCreated: 1673360821 \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Entities/Events/SpawnedPlayersUpdated.cs b/Assets/Scripts/SS3D/Systems/Entities/Events/SpawnedPlayersUpdated.cs index c17ea2a88c..d8b640581b 100644 --- a/Assets/Scripts/SS3D/Systems/Entities/Events/SpawnedPlayersUpdated.cs +++ b/Assets/Scripts/SS3D/Systems/Entities/Events/SpawnedPlayersUpdated.cs @@ -5,9 +5,9 @@ namespace SS3D.Systems.Entities.Events { public partial struct SpawnedPlayersUpdated : IEvent { - public readonly List SpawnedPlayers; + public readonly List SpawnedPlayers; - public SpawnedPlayersUpdated(List spawnedPlayers) + public SpawnedPlayersUpdated(List spawnedPlayers) { SpawnedPlayers = spawnedPlayers; } diff --git a/Assets/Scripts/SS3D/Systems/Entities/Humanoid/HumanoidController.cs b/Assets/Scripts/SS3D/Systems/Entities/Humanoid/HumanoidController.cs index 9c3147e9b3..497d46206e 100644 --- a/Assets/Scripts/SS3D/Systems/Entities/Humanoid/HumanoidController.cs +++ b/Assets/Scripts/SS3D/Systems/Entities/Humanoid/HumanoidController.cs @@ -11,7 +11,7 @@ namespace SS3D.Systems.Entities.Humanoid /// Controls the movement for biped characters that use the same armature /// as the human model uses. /// - [RequireComponent(typeof(PlayerControllable))] + [RequireComponent(typeof(Entity))] [RequireComponent(typeof(HumanoidAnimatorController))] [RequireComponent(typeof(CharacterController))] [RequireComponent(typeof(Animator))] @@ -20,25 +20,24 @@ public class HumanoidController : NetworkActor { public event Action OnSpeedChanged; - [Header("Components")] + [Header("Components")] [SerializeField] private CharacterController _characterController; - [SerializeField] private PlayerControllable _playerControllable; - [SerializeField] private StaminaController _staminaController; + [SerializeField] private Entity _entity; [Header("Movement Settings")] [SerializeField] private float _movementSpeed; [SerializeField] private float _lerpMultiplier; [SerializeField] private float _rotationLerpMultiplier; - [Header("Movement IK Targets")] + [SerializeField] private StaminaController _staminaController; + + [Header("Movement IK Targets")] [SerializeField] private Transform _movementTarget; - // [SerializeField] private Transform _mousePositionTransform; - // [SerializeField] private Transform _mouseDirectionTransform; [Header("Run/Walk")] private bool _isRunning; - [Header("Debug Info")] + [Header("Debug Info")] private Vector3 _absoluteMovement; private Vector2 _input; private Vector2 _smoothedInput; @@ -63,10 +62,10 @@ private void Setup() { _camera = SystemLocator.Get().PlayerCamera; - _playerControllable.ControllingSoulChanged += HandleControllingSoulChanged; + _entity.OnMindChanged += HandleControllingSoulChanged; } - private void HandleControllingSoulChanged(Soul soul) + private void HandleControllingSoulChanged(Mind mind) { OnSpeedChanged?.Invoke(0); } @@ -92,7 +91,7 @@ private void ProcessCharacterMovement() ProcessPlayerInput(); _characterController.Move(Physics.gravity); - + if (_input.magnitude != 0) { MoveMovementTarget(_input); @@ -100,41 +99,27 @@ private void ProcessCharacterMovement() MovePlayer(); } else - { - MovePlayer(); - MoveMovementTarget(Vector2.zero, 5); + { + MovePlayer(); + MoveMovementTarget(Vector2.zero, 5); } - - UpdateMousePositionTransforms(); - } - - /// - /// Gets the mouse position and updates the mouse IK targets while maintaining the player height - /// - private void UpdateMousePositionTransforms() - { - // Ray ray = _camera.ScreenPointToRay(Input.mousePosition); - // Vector3 mousePos = ray.origin - ray.direction * (ray.origin.y / ray.direction.y); - // mousePos = new Vector3(mousePos.x, transform.position.y, mousePos.z); - - // _mouseDirectionTransform.LookAt(mousePos); - // _mousePositionTransform.position = mousePos; } - + /// /// Moves the movement targets with the given input /// /// - private void MoveMovementTarget(Vector2 movementInput, float multiplier = 1) + /// + private void MoveMovementTarget(Vector2 movementInput, float multiplier = 1) { //makes the movement align to the camera view Vector3 newTargetMovement = movementInput.y * Vector3.Cross(_camera.Right, Vector3.up).normalized + movementInput.x * Vector3.Cross(Vector3.up, _camera.Forward).normalized; - + // smoothly changes the target movement _targetMovement = Vector3.Lerp(_targetMovement, newTargetMovement, Time.deltaTime * (_lerpMultiplier * multiplier)); - + Vector3 resultingMovement = _targetMovement + Position; _absoluteMovement = resultingMovement; @@ -148,7 +133,7 @@ private void RotatePlayerToMovement() { Quaternion lookRotation = Quaternion.LookRotation(_targetMovement); - transform.rotation = + transform.rotation = Quaternion.Slerp(Rotation, lookRotation, Time.deltaTime * _rotationLerpMultiplier); } @@ -159,27 +144,27 @@ private void MovePlayer() { _characterController.Move(_targetMovement * ((_movementSpeed) * Time.deltaTime)); } - + /// - /// Process the player movement input, smoothing it + /// Process the player movement input, smoothing it /// /// private void ProcessPlayerInput() { float x = Input.GetAxisRaw("Horizontal"); float y = Input.GetAxisRaw("Vertical"); - + float inputFilteredSpeed = _isRunning && _staminaController.CanContinueInteraction ? RunAnimatorValue : WalkAnimatorValue; - + x = Mathf.Clamp(x, -inputFilteredSpeed, inputFilteredSpeed); y = Mathf.Clamp(y, -inputFilteredSpeed, inputFilteredSpeed); - + _input = new Vector2(x, y); _smoothedInput = Vector2.Lerp(_smoothedInput, _input, Time.deltaTime * (_lerpMultiplier / 10)); OnSpeedChanged?.Invoke(_input.magnitude != 0 ? inputFilteredSpeed : 0); } - + /// /// Toggles your movement between run/walk /// @@ -191,5 +176,5 @@ private void ProcessToggleRun() } } } - + } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Entities/Messages.meta b/Assets/Scripts/SS3D/Systems/Entities/Messages.meta deleted file mode 100644 index f1ce37638a..0000000000 --- a/Assets/Scripts/SS3D/Systems/Entities/Messages.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: c78a8e0badb2426fae5a06069b4157db -timeCreated: 1665372901 \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Entities/Messages/RequestMindSwap.cs b/Assets/Scripts/SS3D/Systems/Entities/Messages/RequestMindSwap.cs deleted file mode 100644 index 8d2f14a43e..0000000000 --- a/Assets/Scripts/SS3D/Systems/Entities/Messages/RequestMindSwap.cs +++ /dev/null @@ -1,17 +0,0 @@ -using FishNet.Broadcast; -using UnityEngine; - -namespace SS3D.Systems.Entities.Messages -{ - public struct RequestMindSwap : IBroadcast - { - public readonly GameObject Origin; - public readonly GameObject Target; - - public RequestMindSwap(GameObject origin, GameObject target) - { - Origin = origin; - Target = target; - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Entities/Messages/RequestMindSwap.cs.meta b/Assets/Scripts/SS3D/Systems/Entities/Messages/RequestMindSwap.cs.meta deleted file mode 100644 index f4cac51d96..0000000000 --- a/Assets/Scripts/SS3D/Systems/Entities/Messages/RequestMindSwap.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 26dbde422dc84465971d4aa562b400c8 -timeCreated: 1665372914 \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Entities/Mind.cs b/Assets/Scripts/SS3D/Systems/Entities/Mind.cs index 37bb04528c..910e551889 100644 --- a/Assets/Scripts/SS3D/Systems/Entities/Mind.cs +++ b/Assets/Scripts/SS3D/Systems/Entities/Mind.cs @@ -1,15 +1,42 @@ using FishNet.Object; -using UnityEngine; +using FishNet.Object.Synchronizing; +using SS3D.Core; +using SS3D.Core.Behaviours; namespace SS3D.Systems.Entities { /// /// Representation of a mind, it is what "owns" an entity (player controllable). - /// /// A mind is controlled by a Soul, a Soul can control multiple minds (not at the same time). /// - public class Mind : NetworkBehaviour + public class Mind : NetworkActor { - [SerializeField] private PlayerControllable _entity; + [SyncVar(OnChange = nameof(SyncSoul))] + public Soul Soul; + + public static Mind Empty { get; private set; } + + protected override void OnStart() + { + base.OnStart(); + + Empty = SystemLocator.Get().EmptyMind; + } + + [Server] + public void SetSoul(Soul soul) + { + Soul = soul; + } + + public void SyncSoul(Soul oldSoul, Soul newSoul, bool asServer) + { + if (!IsServer && IsHost) + { + return; + } + + name = $"Mind - {newSoul.Ckey}"; + } } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Entities/Mind.cs.meta b/Assets/Scripts/SS3D/Systems/Entities/Mind.cs.meta index e07bd32b44..9a9ca5fd63 100644 --- a/Assets/Scripts/SS3D/Systems/Entities/Mind.cs.meta +++ b/Assets/Scripts/SS3D/Systems/Entities/Mind.cs.meta @@ -1,11 +1,3 @@ -fileFormatVersion: 2 -guid: c4172a0b31a14fbfbf4a8b9bc86b2065 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 9e89894392ee65f45bd559d4619cbade, type: 3} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 29d089bc254643d3bbb0c93cdd6c0b82 +timeCreated: 1673203601 \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Entities/MindSystem.cs b/Assets/Scripts/SS3D/Systems/Entities/MindSystem.cs new file mode 100644 index 0000000000..d5166126ec --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Entities/MindSystem.cs @@ -0,0 +1,111 @@ +using FishNet.Connection; +using FishNet.Object; +using FishNet.Object.Synchronizing; +using SS3D.Core; +using SS3D.Core.Behaviours; +using SS3D.Systems.PlayerControl; +using UnityEngine; + +namespace SS3D.Systems.Entities +{ + /// + /// Manages all minds in the game. + /// + public class MindSystem : NetworkSystem + { + [SerializeField] + private Mind _mindPrefab; + + [SerializeField] + private Mind _emptyMind; + + [SyncObject] + private readonly SyncList _spawnedMinds = new(); + + public Mind EmptyMind => _emptyMind; + + /// + /// Tried to get the player's mind. + /// + /// + /// + /// + public bool TryGetMind(Soul player, out Mind mind) + { + PlayerSystem playerSystem = SystemLocator.Get(); + Soul soul = playerSystem.GetSoul(player.Owner); + + mind = _spawnedMinds.Find(mind => mind.Soul == soul); + + if (mind != null) + { + return true; + } + + mind = null; + return false; + } + + /// + /// Returns if a user has a mind or not. + /// + /// + /// + public bool HasMind(Soul soul) + { + Mind mind = _spawnedMinds.Find(mind => mind.Soul == soul); + + return mind != null; + } + + /// + /// Tries to create a mind for an user. + /// + /// + /// + /// + [Server] + public bool TryCreateMind(Soul soul, out Mind createdMind) + { + if (HasMind(soul)) + { + createdMind = null; + return false; + } + + Mind mind = Instantiate(_mindPrefab); + ServerManager.Spawn(mind.GameObjectCache, soul.Owner); + + mind.SetSoul(soul); + + createdMind = mind; + return true; + } + + /// + /// Asks the server to execute a mind swap. + /// + /// + /// + [ServerRpc] + public void CmdSwapMinds(Entity origin, Entity target, NetworkConnection networkConnection = null) + { + SwapMinds(origin, target); + } + + /// + /// Executes a mind swap. + /// + /// + /// + [Server] + private void SwapMinds(Entity origin, Entity target) + { + Mind originSoul = origin.Mind; + Mind targetSoul = target.Mind; + + origin.SetMind(targetSoul); + target.SetMind(originSoul); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Entities/MindSystem.cs.meta b/Assets/Scripts/SS3D/Systems/Entities/MindSystem.cs.meta new file mode 100644 index 0000000000..27fd9c7590 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Entities/MindSystem.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1d92e98e20bf43dabd1dde2edaeb9c92 +timeCreated: 1673195680 \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Entities/PlayerControllable.cs b/Assets/Scripts/SS3D/Systems/Entities/PlayerControllable.cs deleted file mode 100644 index aa10919caa..0000000000 --- a/Assets/Scripts/SS3D/Systems/Entities/PlayerControllable.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using DG.Tweening; -using FishNet.Connection; -using FishNet.Object; -using FishNet.Object.Synchronizing; -using SS3D.Core.Behaviours; -using SS3D.Systems.Screens.Events; -using UnityEngine; - -namespace SS3D.Systems.Entities -{ - /// - /// Base class for all things that can be controlled by a player - /// - [Serializable] - public class PlayerControllable : NetworkActor - { - public Action ControllingSoulChanged; - - [SerializeField] [SyncVar(OnChange = "SyncControllingSoul")] private Soul _controllingSoul; - - public Soul ControllingSoul - { - get => _controllingSoul; - set => _controllingSoul = value; - } - - private const float ScaleInDuration = .6f; - - protected override void OnStart() - { - base.OnStart(); - - OnSpawn(); - } - - private void OnSpawn() - { - ControllingSoulChanged?.Invoke(ControllingSoul); - } - - private void UpdateCameraFollow() - { - if (!IsOwner) - { - return; - } - - ChangeCameraEvent changeCameraEvent = new(GameObjectCache); - changeCameraEvent.Invoke(this); - } - - public void SyncControllingSoul(Soul oldSoul, Soul newSoul, bool asServer) - { - _controllingSoul = newSoul; - - ControllingSoulChanged?.Invoke(_controllingSoul); - UpdateCameraFollow(); - } - - [Server] - public void SetControllingSoul(Soul soul) - { - _controllingSoul = soul; - - if (soul == null) - { - RemoveOwnership(); - } - else - { - GiveOwnership(soul.Owner); - } - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Entities/Silicon/ThreadController.cs b/Assets/Scripts/SS3D/Systems/Entities/Silicon/ThreadController.cs index 0056b44069..0d5402c621 100644 --- a/Assets/Scripts/SS3D/Systems/Entities/Silicon/ThreadController.cs +++ b/Assets/Scripts/SS3D/Systems/Entities/Silicon/ThreadController.cs @@ -3,6 +3,7 @@ using SS3D.Core.Behaviours; using SS3D.Systems.Screens; using UnityEngine; +using UnityEngine.Serialization; namespace SS3D.Systems.Entities.Silicon { @@ -14,26 +15,26 @@ namespace SS3D.Systems.Entities.Silicon public class ThreadController : NetworkActor { public event Action OnSpeedChanged; - public event Action OnPowerChanged; + public event Action OnPowerChanged; - [Header("Components")] + [Header("Components")] [SerializeField] private CharacterController _characterController; - [SerializeField] private PlayerControllable _playerControllable; - + [FormerlySerializedAs("_playerControllable")] [SerializeField] private Entity _entity; + [Header("Movement Settings")] [SerializeField] private float _movementSpeed; [SerializeField] private float _lerpMultiplier; [SerializeField] private float _rotationLerpMultiplier; - + [SerializeField] private Transform _movementTarget; - - [Header("Debug Info")] + + [Header("Debug Info")] private Vector3 _absoluteMovement; private Vector2 _input; private Vector2 _smoothedInput; - + private Vector3 _targetMovement; - + private float _smoothedX; private float _smoothedY; private Actor _camera; @@ -49,21 +50,21 @@ private void Setup() { _camera = SystemLocator.Get().PlayerCamera; - _playerControllable.ControllingSoulChanged += HandleControllingSoulChanged; + _entity.OnMindChanged += HandleControllingSoulChanged; } - + protected override void HandleUpdate(in float deltaTime) { base.HandleUpdate(in deltaTime); - + if (!IsOwner) { return; } - + ProcessCharacterMovement(); } - + /// /// Executes the movement code and updates the IK targets /// @@ -71,7 +72,7 @@ private void ProcessCharacterMovement() { ProcessPlayerInput(); _characterController.Move(Physics.gravity); - + if (_input.magnitude != 0) { MoveMovementTarget(_input); @@ -79,12 +80,12 @@ private void ProcessCharacterMovement() MovePlayer(); } else - { - MovePlayer(); - MoveMovementTarget(Vector2.zero, 5); + { + MovePlayer(); + MoveMovementTarget(Vector2.zero, 5); } } - + /// /// Moves the movement targets with the given input /// @@ -95,25 +96,25 @@ private void MoveMovementTarget(Vector2 movementInput, float multiplier = 1) Vector3 newTargetMovement = movementInput.y * Vector3.Cross(_camera.Right, Vector3.up).normalized + movementInput.x * Vector3.Cross(Vector3.up, _camera.Forward).normalized; - + // smoothly changes the target movement _targetMovement = Vector3.Lerp(_targetMovement, newTargetMovement, Time.deltaTime * (_lerpMultiplier * multiplier)); - + Vector3 resultingMovement = _targetMovement + transform.position; _absoluteMovement = resultingMovement; - + _movementTarget.position = _absoluteMovement; } - + /// /// Rotates the player to the target movement /// private void RotatePlayerToMovement() { - transform.rotation = + transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(_targetMovement), Time.deltaTime * _rotationLerpMultiplier); } - + /// /// Moves the player to the target movement /// @@ -121,25 +122,25 @@ private void MovePlayer() { _characterController.Move(_targetMovement * ((_movementSpeed) * Time.deltaTime)); } - + /// - /// Process the player movement input, smoothing it + /// Process the player movement input, smoothing it /// /// private void ProcessPlayerInput() { float x = Input.GetAxisRaw("Horizontal"); float y = Input.GetAxisRaw("Vertical"); - + _input = new Vector2(x, y); OnSpeedChanged?.Invoke(_input.magnitude != 0 ? _input.magnitude : 0); - + _smoothedInput = Vector2.Lerp(_smoothedInput, _input, Time.deltaTime * (_lerpMultiplier / 10)); } - private void HandleControllingSoulChanged(Soul soul) + private void HandleControllingSoulChanged(Mind mind) { - OnPowerChanged?.Invoke(soul != null); + OnPowerChanged?.Invoke(mind != null); } } } diff --git a/Assets/Scripts/SS3D/Systems/Entities/Soul.cs b/Assets/Scripts/SS3D/Systems/Entities/Soul.cs index 57e334a8f6..2fc19b0b08 100644 --- a/Assets/Scripts/SS3D/Systems/Entities/Soul.cs +++ b/Assets/Scripts/SS3D/Systems/Entities/Soul.cs @@ -1,43 +1,40 @@ -using System; -using FishNet.Connection; using FishNet.Object; using FishNet.Object.Synchronizing; using SS3D.Core.Behaviours; -using SS3D.Logging; namespace SS3D.Systems.Entities { /// - /// Unique, persistent object that the player owns, it manages what character it is controlling and stores other player data. + /// Unique, persistent object that the player owns. Server purpose of holding relevant data of a specific player. /// - [Serializable] public sealed class Soul : NetworkActor { - [SyncVar(OnChange = nameof(UpdateCkey))] private string _ckey; + [SyncVar(OnChange = nameof(SyncCkey))] + private string _ckey = string.Empty; /// /// Unique client key, originally used in BYOND's user management, nostalgically used. /// public string Ckey => _ckey; + /// + /// This the owner of this object is the local connection. + /// + public bool IsLocalConnection => Owner == LocalConnection; + + [Server] + public void SetCkey(string ckey) + { + _ckey = ckey; + } + /// /// Used by FishNet Networking to update the variable and sync it across instances. /// This is also called by the server when the client enters the server to update his data. /// - public void UpdateCkey(string oldCkey, string newCkey, bool asServer) + public void SyncCkey(string oldCkey, string newCkey, bool asServer) { - if (!asServer && IsHost) - { - return; - } - - if (oldCkey != newCkey) - { - Punpun.Say(this, $"Updating player ckey {newCkey}"); - } - - _ckey = newCkey; - gameObject.name = "Soul: " + _ckey; + gameObject.name = "Soul - " + _ckey; } } } diff --git a/Assets/Scripts/SS3D/Systems/Furniture/Nuke.cs b/Assets/Scripts/SS3D/Systems/Furniture/Nuke.cs index 72995c7335..4486b6d55b 100644 --- a/Assets/Scripts/SS3D/Systems/Furniture/Nuke.cs +++ b/Assets/Scripts/SS3D/Systems/Furniture/Nuke.cs @@ -4,7 +4,6 @@ using FishNet.Object; using SS3D.Core; using SS3D.Data; -using SS3D.Data.AssetDatabases; using SS3D.Data.Enums; using SS3D.Systems.Gamemodes; using UnityEngine; diff --git a/Assets/Scripts/SS3D/Systems/Gamemodes/GamemodeSystem.cs b/Assets/Scripts/SS3D/Systems/Gamemodes/GamemodeSystem.cs index 9018d31c38..485db3f010 100644 --- a/Assets/Scripts/SS3D/Systems/Gamemodes/GamemodeSystem.cs +++ b/Assets/Scripts/SS3D/Systems/Gamemodes/GamemodeSystem.cs @@ -55,7 +55,7 @@ private void Setup() { AddHandle(RoundStateUpdated.AddListener(HandleRoundStateUpdated)); AddHandle(SpawnedPlayersUpdated.AddListener(HandleSpawnedPlayersChanged)); - AddHandle(InitialPlayersSpawnedEvent.AddListener(HandleInitialPlayersSpawned)); + AddHandle(InitialPlayersSpawned.AddListener(HandleInitialPlayersSpawned)); } /// @@ -72,15 +72,15 @@ private void InitializeGamemode() _gamemode.OnFinished += HandleGamemodeFinalized; // Get systems we need to load player data - EntitySpawnSystem entitySpawnSystem = SystemLocator.Get(); - PlayerControlSystem playerControlSystem = SystemLocator.Get(); + EntitySystem entitySystem = SystemLocator.Get(); + PlayerSystem playerSystem = SystemLocator.Get(); // Get list of players ready to spawn (by Ckey). - List playersToAssign = entitySpawnSystem.SpawnedPlayers; + List playersToAssign = entitySystem.SpawnedPlayers; List playerCkeys = new List(); for (int i = 0; i < playersToAssign.Count; i++) { - playerCkeys.Add(playerControlSystem.GetCkey(playersToAssign[i].Owner)); + playerCkeys.Add(playerSystem.GetCkey(playersToAssign[i].Owner)); } // Actually initialize the gamemode @@ -142,9 +142,9 @@ public void EndRound() [Server] private void SendObjectiveToClients(GamemodeObjective objective) { - PlayerControlSystem playerControlSystem = SystemLocator.Get(); + PlayerSystem playerSystem = SystemLocator.Get(); - NetworkConnection author = playerControlSystem.GetSoul(objective.AssigneeCkey).Owner; + NetworkConnection author = playerSystem.GetSoul(objective.AssigneeCkey).Owner; GamemodeObjectiveUpdatedMessage message = new(objective); // TODO Add admins as receivers of this message @@ -169,9 +169,9 @@ private void CmdGetCurrentClientObjectives(NetworkConnection sender = null) return; } - PlayerControlSystem playerControlSystem = SystemLocator.Get(); + PlayerSystem playerSystem = SystemLocator.Get(); - List gamemodeObjectives = _gamemode.GetPlayerObjectives(playerControlSystem.GetCkey(sender)); + List gamemodeObjectives = _gamemode.GetPlayerObjectives(playerSystem.GetCkey(sender)); if (gamemodeObjectives == null) { @@ -188,7 +188,7 @@ private void CmdGetCurrentClientObjectives(NetworkConnection sender = null) /// Called whenever the ready players are spawned at the start of the round. /// [Server] - private void HandleInitialPlayersSpawned(ref EventContext context, in InitialPlayersSpawnedEvent e) + private void HandleInitialPlayersSpawned(ref EventContext context, in InitialPlayersSpawned e) { InitializeGamemode(); } @@ -206,8 +206,8 @@ private void HandleSpawnedPlayersChanged(ref EventContext context, in SpawnedPla } // Retrieve the Ckey of the newly spawned player. - EntitySpawnSystem entitySpawnSystem = SystemLocator.Get(); - string newPlayerCkey = SystemLocator.Get()?.GetCkey(entitySpawnSystem.LastSpawned.Owner); + EntitySystem entitySystem = SystemLocator.Get(); + string newPlayerCkey = SystemLocator.Get()?.GetCkey(entitySystem.LastSpawned.Owner); // Assign late join objectives to the new player if (newPlayerCkey != null) diff --git a/Assets/Scripts/SS3D/Systems/Health/Stamina.cs b/Assets/Scripts/SS3D/Systems/Health/Stamina.cs index bd86997763..d2abd7a3ac 100644 --- a/Assets/Scripts/SS3D/Systems/Health/Stamina.cs +++ b/Assets/Scripts/SS3D/Systems/Health/Stamina.cs @@ -9,42 +9,51 @@ namespace SS3D.Systems.Health public class Stamina : IStamina { /// - /// Allows stamina to be overdrawn for existing interactions; however, new interactions requiring stamina cannot - /// be started while overdrawn. This prevents rapid transition between walk and run animations (for example). + /// The current stamina of the entity. This can vary between a lower limit of negative ALLOWABLE_OVERDRAW times _max, + /// and an upper limit of _max. /// - private const float ALLOWABLE_OVERDRAW = 0.1f; + private float _current; /// - /// Amount of stamina (multiplied by _max) that must be spent to train stamina, leading to a permanent increase in _max. + /// The maximum stamina of the entity. /// - private const float TRAINING_CONSUMPTION_REQUIREMENT = 2f; + private float _max; /// - /// How much _max is multiplied by every time it is trained. - /// in _max. + /// Recovery rate of stamina, measured as proportion per second. /// - private const float TRAINING_MULTIPLIER = 1.05f; + private readonly float _recoveryRate; /// - /// The current stamina of the entity. This can vary between a lower limit of negative ALLOWABLE_OVERDRAW times _max, - /// and an upper limit of _max. + /// Record of the total amount of stamina spent by the player. /// - private float _current; + private float _spent; /// - /// The maximum stamina of the entity. + /// Allows stamina to be overdrawn for existing interactions; however, new interactions requiring stamina cannot + /// be started while overdrawn. This prevents rapid transition between walk and run animations (for example). /// - private float _max; + private const float AllowableOverdraw = 0.1f; /// - /// Recovery rate of stamina, measured as proportion per second. + /// Amount of stamina (multiplied by _max) that must be spent to train stamina, leading to a permanent increase in _max. /// - private float _recoveryRate; + private const float TrainingConsumptionRequirement = 2f; /// - /// Record of the total amount of stamina spent by the player. + /// How much _max is multiplied by every time it is trained. + /// in _max. /// - private float _spent; + private const float TrainingMultiplier = 1.05f; + + /// + public float Current => Mathf.Max(_current / _max, 0f); + + /// + public bool CanCommenceInteraction => _current > 0f; + + /// + public bool CanContinueInteraction => _current > -1f * AllowableOverdraw * _max; /// /// Constructor. Should only be created through the StaminaHelper Create() method. @@ -59,24 +68,6 @@ public Stamina (float max, float recoveryRate) _spent = 0; } - /// - public float Current - { - get => Mathf.Max(_current / _max, 0f); - } - - /// - public bool CanCommenceInteraction - { - get => _current > 0f; - } - - /// - public bool CanContinueInteraction - { - get => _current > -1f * ALLOWABLE_OVERDRAW * _max; - } - /// public void ConsumeStamina(float amount) { @@ -96,23 +87,33 @@ public void RechargeStamina(float deltaTime) _current = Mathf.Min(_current + deltaTime * _max * _recoveryRate, _max); } + /// + /// Part of the design was that by using stamina, your max stamina can increase i.e. be trained. + /// So it records all the stamina used and "levels up" the player whenever they use enough. + /// TODO: Improve: It's a pretty basic and inflexible implementation, just had to put something in there to meet the PR requirements. + /// + /// private void TrainStamina(float staminaConsumed) { // Add the consumed stamina to our tally. We only record stamina that we have, not any overdraw. _spent += Mathf.Max(Mathf.Min(staminaConsumed, _current), 0f); + bool hasSpentSufficientStamina = _spent > TrainingConsumptionRequirement * _max; + // If we have spent sufficient stamina, increase our max capacity. - if (_spent > TRAINING_CONSUMPTION_REQUIREMENT * _max) + if (!hasSpentSufficientStamina) { - // Reset the spend counter - _spent -= TRAINING_MULTIPLIER * _max; + return; + } - // Increase our max stamina capacity - _max *= TRAINING_MULTIPLIER; + // Reset the spend counter + _spent -= TrainingMultiplier * _max; - // Scale up our current stamina. This is done to prevent visible stamina gap when training. - _current *= TRAINING_MULTIPLIER; - } + // Increase our max stamina capacity + _max *= TrainingMultiplier; + + // Scale up our current stamina. This is done to prevent visible stamina gap when training. + _current *= TrainingMultiplier; } } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Health/StaminaBarView.cs b/Assets/Scripts/SS3D/Systems/Health/StaminaBarView.cs index f377111f09..eaf655a6ee 100644 --- a/Assets/Scripts/SS3D/Systems/Health/StaminaBarView.cs +++ b/Assets/Scripts/SS3D/Systems/Health/StaminaBarView.cs @@ -1,21 +1,17 @@ using SS3D.Attributes; -using SS3D.Core; using SS3D.Core.Behaviours; -using SS3D.Core.Utils; -using SS3D.Systems.Entities; -using SS3D.Systems.PlayerControl; using UnityEngine; using UnityEngine.UI; -namespace SS3D.Systems.Health.UI +namespace SS3D.Systems.Health { [RequiredLayer("UI")] - public class StaminaBarView : Actor + public class StaminaBarView : View { /// /// The actual UI bar /// - [SerializeField] private Slider slider; + [SerializeField] private Slider _slider; /// /// Reference to the stamina controller that this view is supporting @@ -28,17 +24,12 @@ public class StaminaBarView : Actor /// Proportion of stamina available (in range of 0f to 1f) private void SetStamina(float stamina) { - slider.value = stamina; - } - - protected override void OnStart() - { - base.OnStart(); + _slider.value = stamina; } protected override void HandleUpdate(in float deltaTime) { - SetStamina(_controller ? _controller.Current : 0f); + SetStamina(_controller ? _controller.CurrentStamina : 0f); } public void AssignViewToPlayer(StaminaController staminaController) diff --git a/Assets/Scripts/SS3D/Systems/Health/StaminaController.cs b/Assets/Scripts/SS3D/Systems/Health/StaminaController.cs index fa00d50170..9179f87284 100644 --- a/Assets/Scripts/SS3D/Systems/Health/StaminaController.cs +++ b/Assets/Scripts/SS3D/Systems/Health/StaminaController.cs @@ -1,10 +1,10 @@ +using System.Linq; using FishNet.Object; using FishNet.Object.Synchronizing; +using SS3D.Core; using SS3D.Core.Behaviours; using SS3D.Systems.Entities; using SS3D.Systems.Entities.Humanoid; -using SS3D.Systems.Health.UI; -using System; using UnityEngine; namespace SS3D.Systems.Health @@ -18,7 +18,7 @@ public class StaminaController : NetworkActor /// /// The stamina bar UI. It should only be modified on the client. /// - private StaminaBarView UI; + private StaminaBarView _staminaBarView; /// /// The controller for this entity. @@ -28,86 +28,94 @@ public class StaminaController : NetworkActor /// /// The PlayerControllable component for this entity. /// - [SerializeField] private PlayerControllable playerControllable; + [SerializeField] private Entity _entity; /// /// Provides a way for the client to access the current player stamina. /// - [SyncVar] private float _current; - - public float Current - { - get { return _current; } - } + [SyncVar(OnChange = nameof(SyncCurrentStamina))] private float _currentStamina; /// /// Actual stamina data. Will only exist on the server. /// private IStamina _stamina; - protected override void OnStart() + /// + /// The current stamina proportion of the entity (scaled between zero and one). + /// + public float CurrentStamina => _currentStamina; + + public bool CanCommenceInteraction => IsServerOnly ? _stamina.CanCommenceInteraction : _currentStamina > 0f; + + /// + /// TODO: Refactor how this works. + /// This is very much a hack while we are waiting for movement to be server authoritative. + /// Note that the server and client responses are not equivalent. The server will let you + /// continue an interaction while slightly in negative stamina, whereas the client will + /// require that you stop as soon as you hit zero stamina. This problem will go away once + /// movement is server authoritative because this will only be needed on the server. + /// + public bool CanContinueInteraction => IsServerOnly ? _stamina.CanContinueInteraction : _currentStamina > 0f; + + public override void OnStartServer() { - base.OnStart(); + base.OnStartServer(); // The server manages the stamina data for each entity. - if (IsServer) - { - _stamina = StaminaHelper.Create(10f); - _current = _stamina.Current; - } + _stamina = StaminaFactory.Create(); + _currentStamina = _stamina.Current; + } - if (IsClient) - { - UI = FindObjectOfType(); - playerControllable.ControllingSoulChanged += AssignViewToControllable; - } + public override void OnStartClient() + { + base.OnStartClient(); - // Currently movement is client-authoritative, so we need to subscribe to events on the client only. - if (IsClient) - { - SubscribeToEvents(); + _staminaBarView = ViewLocator.Get().First(); + _entity.OnMindChanged += AssignViewToControllable; - if (playerControllable.ControllingSoul.IsOwner) - { - UI?.AssignViewToPlayer(this); - } - } + // Currently movement is client-authoritative, so we need to subscribe to events on the client only. + SubscribeToEvents(); } - [Client] - public void AssignViewToControllable(Soul newSoul) + protected override void HandleUpdate(in float deltaTime) { - if (newSoul == null || !newSoul.IsOwner) - { - UI.UnassignViewFromPlayer(this); - } - else + base.HandleUpdate(in deltaTime); + + if (IsServer) { - UI?.AssignViewToPlayer(this); + _stamina.RechargeStamina(deltaTime); } } - public bool CanCommenceInteraction + private void OnDestroy() { - get => IsServerOnly ? _stamina.CanCommenceInteraction : _current > 0f; + UnsubscribeFromEvents(); } - public bool CanContinueInteraction + private void SubscribeToEvents() { - // This is very much a hack while we are waiting for movement to be server authoritative. - // Note that the server and client responses are not equivalent. The server will let you - // continue an interaction while slightly in negative stamina, whereas the client will - // require that you stop as soon as you hit zero stamina. This problem will go away once - // movement is server authoritative because this will only be needed on the server. - get => IsServerOnly ? _stamina.CanContinueInteraction : _current > 0f; + _player.OnSpeedChanged += DepleteStamina; + _entity.OnMindChanged += AssignViewToControllable; } - /// - /// The current stamina proportion of the entity (scaled between zero and one). - /// - public float CurrentStamina + private void UnsubscribeFromEvents() + { + _player.OnSpeedChanged -= DepleteStamina; + _entity.OnMindChanged -= AssignViewToControllable; + + } + + [Client] + private void AssignViewToControllable(Mind mind) { - get => _current; + if (mind == null || !mind.IsOwner) + { + _staminaBarView.UnassignViewFromPlayer(this); + } + else + { + _staminaBarView.AssignViewToPlayer(this); + } } /// @@ -115,10 +123,10 @@ public float CurrentStamina /// /// /// The amount of stamina to reduce [Server] - public void DepleteStaminaServer(float amountToDeplete) + public void ServerDepleteStamina(float amountToDeplete) { _stamina.ConsumeStamina(amountToDeplete); - _current = _stamina.Current; + _currentStamina = _stamina.Current; } /// @@ -130,7 +138,7 @@ private void DepleteStamina(float rawAmountToDeplete) { if (IsOwner) { - DepleteStaminaScaled(rawAmountToDeplete * Time.deltaTime); + CmdDepleteStaminaScaled(rawAmountToDeplete * Time.deltaTime); } } @@ -139,37 +147,14 @@ private void DepleteStamina(float rawAmountToDeplete) /// /// The amount of stamina to reduce [ServerRpc] - private void DepleteStaminaScaled(float amountToDeplete) + private void CmdDepleteStaminaScaled(float amountToDeplete) { _stamina.ConsumeStamina(amountToDeplete); - _current = _stamina.Current; - } - - protected override void HandleUpdate(in float deltaTime) - { - base.HandleUpdate(in deltaTime); - - if (IsServer) - { - _stamina.RechargeStamina(deltaTime); - } - } - - private void OnDestroy() - { - UnsubscribeFromEvents(); + _currentStamina = _stamina.Current; } - private void SubscribeToEvents() + private void SyncCurrentStamina(float old, float value, bool asServer) { - _player.OnSpeedChanged += DepleteStamina; - playerControllable.ControllingSoulChanged += AssignViewToControllable; - } - - private void UnsubscribeFromEvents() - { - _player.OnSpeedChanged -= DepleteStamina; - playerControllable.ControllingSoulChanged -= AssignViewToControllable; } } diff --git a/Assets/Scripts/SS3D/Systems/Health/StaminaHelper.cs b/Assets/Scripts/SS3D/Systems/Health/StaminaFactory.cs similarity index 57% rename from Assets/Scripts/SS3D/Systems/Health/StaminaHelper.cs rename to Assets/Scripts/SS3D/Systems/Health/StaminaFactory.cs index 4ad46844d0..406f790255 100644 --- a/Assets/Scripts/SS3D/Systems/Health/StaminaHelper.cs +++ b/Assets/Scripts/SS3D/Systems/Health/StaminaFactory.cs @@ -1,6 +1,9 @@ namespace SS3D.Systems.Health { - public class StaminaHelper + /// + /// Factory used to create stamina. (AKA As Gatorade™ factory) + /// + public abstract class StaminaFactory { public static IStamina Create(float max = 10f, float rechargeRate = 0.05f) { diff --git a/Assets/Scripts/SS3D/Systems/Health/StaminaHelper.cs.meta b/Assets/Scripts/SS3D/Systems/Health/StaminaFactory.cs.meta similarity index 100% rename from Assets/Scripts/SS3D/Systems/Health/StaminaHelper.cs.meta rename to Assets/Scripts/SS3D/Systems/Health/StaminaFactory.cs.meta diff --git a/Assets/Scripts/SS3D/Systems/IngameConsoleSystem/CommandsContainer.cs b/Assets/Scripts/SS3D/Systems/IngameConsoleSystem/CommandsContainer.cs index f3465b67a7..73a3f68651 100644 --- a/Assets/Scripts/SS3D/Systems/IngameConsoleSystem/CommandsContainer.cs +++ b/Assets/Scripts/SS3D/Systems/IngameConsoleSystem/CommandsContainer.cs @@ -48,7 +48,7 @@ public static string Reconnect() public static string PlayerList() { string ret = ""; - List souls = SystemLocator.Get().OnlineSouls.ToList(); + List souls = SystemLocator.Get().OnlineSouls.ToList(); foreach (Soul i in souls) { ret += i.Ckey + "\t"; @@ -60,7 +60,7 @@ public static string PlayerList() public static string SoulList() { string ret = ""; - IList souls = SystemLocator.Get().ServerSouls; + IEnumerable souls = SystemLocator.Get().ServerSouls; foreach (Soul i in souls) { ret += i.Ckey + "\t"; diff --git a/Assets/Scripts/SS3D/Systems/Items/NukeDetonateInteraction.cs b/Assets/Scripts/SS3D/Systems/Items/NukeDetonateInteraction.cs index cf26db2619..e4ade57534 100644 --- a/Assets/Scripts/SS3D/Systems/Items/NukeDetonateInteraction.cs +++ b/Assets/Scripts/SS3D/Systems/Items/NukeDetonateInteraction.cs @@ -53,9 +53,9 @@ public override bool Start(InteractionEvent interactionEvent, InteractionReferen if (source is NukeCard _ && target is Nuke nuke) { nuke.Detonate(); - PlayerControlSystem playerControlSystem = SystemLocator.Get(); + PlayerSystem playerSystem = SystemLocator.Get(); - new NukeDetonateEvent(nuke, playerControlSystem.GetCkey(source.GetComponentInTree().Owner)).Invoke(this); + new NukeDetonateEvent(nuke, playerSystem.GetCkey(source.GetComponentInTree().Owner)).Invoke(this); } return false; } diff --git a/Assets/Scripts/SS3D/Systems/Lobby/UI/LobbyReadyView.cs b/Assets/Scripts/SS3D/Systems/Lobby/UI/LobbyReadyView.cs index 4c4414abb9..bc572687de 100644 --- a/Assets/Scripts/SS3D/Systems/Lobby/UI/LobbyReadyView.cs +++ b/Assets/Scripts/SS3D/Systems/Lobby/UI/LobbyReadyView.cs @@ -1,5 +1,4 @@ using Coimbra.Services.Events; -using Cysharp.Threading.Tasks; using SS3D.Core; using SS3D.Core.Behaviours; using SS3D.Systems.Entities; @@ -49,9 +48,9 @@ private void HandleRoundStateUpdated(ref EventContext context, in RoundStateUpda private void ProcessSpawnedPlayers() { - EntitySpawnSystem spawnSystem = SystemLocator.Get(); + EntitySystem system = SystemLocator.Get(); - bool isPlayedSpawned = spawnSystem.IsPlayedSpawned(LocalConnection); + bool isPlayedSpawned = system.IsPlayerSpawned(LocalConnection); if (isPlayedSpawned) { @@ -64,9 +63,9 @@ private void ProcessSpawnedPlayers() private void ProcessRoundState(RoundState roundState) { - EntitySpawnSystem spawnSystem = SystemLocator.Get(); + EntitySystem system = SystemLocator.Get(); - bool isPlayedSpawned = spawnSystem.IsPlayedSpawned(LocalConnection); + bool isPlayedSpawned = system.IsPlayerSpawned(LocalConnection); if (isPlayedSpawned && roundState == RoundState.Ongoing) { @@ -100,19 +99,18 @@ private void ProcessRoundState(RoundState roundState) private void HandleEmbarkButtonPressed(bool pressed) { - PlayerControlSystem playerControlSystem = SystemLocator.Get(); + PlayerSystem playerSystem = SystemLocator.Get(); + EntitySystem entitySystem = SystemLocator.Get(); - string ckey = playerControlSystem.GetCkey(LocalConnection); - RequestEmbarkMessage requestEmbarkMessage = new(ckey); - - ClientManager.Broadcast(requestEmbarkMessage); + Soul soul = playerSystem.GetSoul(LocalConnection); + entitySystem.CmdSpawnLatePlayer(soul); } private void HandleReadyButtonPressed(bool pressed) { - PlayerControlSystem playerControlSystem = SystemLocator.Get(); + PlayerSystem playerSystem = SystemLocator.Get(); - string ckey = playerControlSystem.GetCkey(LocalConnection); + string ckey = playerSystem.GetCkey(LocalConnection); ChangePlayerReadyMessage playerReadyMessage = new(ckey, pressed); ClientManager.Broadcast(playerReadyMessage); diff --git a/Assets/Scripts/SS3D/Systems/Lobby/UI/PlayerUsernameListView.cs b/Assets/Scripts/SS3D/Systems/Lobby/UI/PlayerUsernameListView.cs index ac1f2d16ec..d32f0d1891 100644 --- a/Assets/Scripts/SS3D/Systems/Lobby/UI/PlayerUsernameListView.cs +++ b/Assets/Scripts/SS3D/Systems/Lobby/UI/PlayerUsernameListView.cs @@ -21,10 +21,10 @@ public sealed class PlayerUsernameListView : NetworkActor { // The UI element this is linked to [SerializeField] [NotNull] private Transform _root; - + // Username list, local list that is "networked" by the SyncList on LobbyManager [SerializeField] [NotNull] private List _playerUsernames; - + // The username panel prefab [SerializeField] [NotNull] private GameObject _uiPrefab; [SerializeField] private Color _userReadyColor = PaletteColors.LightBlue; @@ -33,7 +33,7 @@ protected override void OnAwake() { base.OnAwake(); - ReadyPlayersChanged.AddListener(HandleReadyPlayersChanged); + AddHandle(ReadyPlayersChanged.AddListener(HandleReadyPlayersChanged)); } public override void OnStartClient() @@ -44,7 +44,7 @@ public override void OnStartClient() private void SubscribeToEvents() { - OnlineSoulsChanged.AddListener(HandleOnlineSoulsChanged); + AddHandle(OnlineSoulsChanged.AddListener(HandleOnlineSoulsChanged)); } private void HandleOnlineSoulsChanged(ref EventContext context, in OnlineSoulsChanged e) @@ -74,11 +74,11 @@ private void HandleOnlineSoulsChanged(ref EventContext context, in OnlineSoulsCh private void HandleReadyPlayersChanged(ref EventContext context, in ReadyPlayersChanged e) { - List readyPlayers = e.ReadyPlayers; + List readyPlayers = e.ReadyPlayers; foreach (PlayerUsernameView username in _playerUsernames) { - username.UpdateNameColor(readyPlayers.Contains(username.Name) ? _userReadyColor : PaletteColors.White); + username.UpdateNameColor(readyPlayers.Find(soul => soul.Ckey == username.Name) ? _userReadyColor : PaletteColors.White); } } @@ -94,7 +94,7 @@ private void AddUsernameUI(string ckey) { return; } - + // adds the UI element and updates the text GameObject uiInstance = Instantiate(_uiPrefab, _root); @@ -102,7 +102,7 @@ private void AddUsernameUI(string ckey) playerUsernameView.UpdateNameText(ckey); _playerUsernames.Add(playerUsernameView); } - + /// /// Removes the player from the list based on the Username /// diff --git a/Assets/Scripts/SS3D/Systems/PlayerControl/PlayerControlSystem.cs b/Assets/Scripts/SS3D/Systems/PlayerControl/PlayerSystem.cs similarity index 56% rename from Assets/Scripts/SS3D/Systems/PlayerControl/PlayerControlSystem.cs rename to Assets/Scripts/SS3D/Systems/PlayerControl/PlayerSystem.cs index bb09aee52e..1eb635c0a0 100644 --- a/Assets/Scripts/SS3D/Systems/PlayerControl/PlayerControlSystem.cs +++ b/Assets/Scripts/SS3D/Systems/PlayerControl/PlayerSystem.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Linq; using FishNet.Connection; @@ -17,23 +18,30 @@ namespace SS3D.Systems.PlayerControl /// /// Controls the player flux, when users want to authenticate, rejoin the game, leave the game /// - public sealed class PlayerControlSystem : NetworkSystem + public sealed class PlayerSystem : NetworkSystem { - [FormerlySerializedAs("_userPrefab")] [Header("Settings")] - [SerializeField] private NetworkObject _unauthorizedUserPrefab; - [SerializeField] private NetworkObject _soulPrefab; + [SerializeField] + private NetworkObject _unauthorizedUserPrefab; - [SyncObject] private readonly SyncList _serverSouls = new(); + [SerializeField] + private Soul _soulPrefab; - [SyncObject] private readonly SyncList _onlineSouls = new(); + [SyncObject] + private readonly SyncDictionary _serverSouls = new(); + [SyncObject] + private readonly SyncDictionary _onlineSouls = new(); - public IList ServerSouls => _serverSouls; - public IList OnlineSouls => _onlineSouls; + public IEnumerable ServerSouls => _serverSouls.Values; + public IEnumerable OnlineSouls => _onlineSouls.Values; protected override void OnStart() { base.OnStart(); + + LateSyncOnlineSouls(); + LateSyncServerSouls(); + AddEventListeners(); } @@ -49,8 +57,8 @@ public override void OnStartServer() private void AddEventListeners() { - _serverSouls.OnChange += HandleServerSoulsChanged; - _onlineSouls.OnChange += HandleOnlineSouls; + _serverSouls.OnChange += HandleSyncServerSoulsChanged; + _onlineSouls.OnChange += HandleSyncOnlineSouls; } private void HandleRemoteConnectionState(NetworkConnection conn, RemoteConnectionStateArgs remoteConnectionStateArgs) @@ -66,28 +74,66 @@ private void HandleClientLoadedStartScenes(NetworkConnection conn, bool asServer ProcessPlayerJoin(conn); } - private void HandleOnlineSouls(SyncListOperation op, int index, Soul oldItem, Soul newItem, bool asServer) + private void HandleSyncOnlineSouls(SyncDictionaryOperation op, string key, Soul value, bool asServer) { - ChangeType changeType = newItem != null ? ChangeType.Addition : ChangeType.Removal; + ChangeType changeType; - Soul soul = changeType == ChangeType.Addition ? newItem : oldItem; + switch (op) + { + case SyncDictionaryOperation.Add: + changeType = ChangeType.Addition; + break; + case SyncDictionaryOperation.Remove: + changeType = ChangeType.Removal; + break; + default: + changeType = ChangeType.Addition; + break; + } - OnlineSoulsChanged serverSoulsChanged = new(_onlineSouls.ToList(), changeType, soul); + OnlineSoulsChanged serverSoulsChanged = new(_onlineSouls.Values.ToList(), changeType, value); serverSoulsChanged.Invoke(this); } - private void HandleServerSoulsChanged(SyncListOperation op, int index, Soul oldItem, Soul newItem, bool asServer) + private void LateSyncOnlineSouls() { - ChangeType changeType = newItem != null ? ChangeType.Addition : ChangeType.Removal; + foreach (Soul soul in _onlineSouls.Values) + { + HandleSyncOnlineSouls(SyncDictionaryOperation.Add, soul.Ckey, soul, false); + } + } + + private void HandleSyncServerSoulsChanged(SyncDictionaryOperation op, string key, Soul value, bool asServer) + { + ChangeType changeType; - Soul soul = changeType == ChangeType.Addition ? newItem : oldItem; + switch (op) + { + case SyncDictionaryOperation.Add: + changeType = ChangeType.Addition; + break; + case SyncDictionaryOperation.Remove: + changeType = ChangeType.Removal; + break; + default: + changeType = ChangeType.Addition; + break; + } - ServerSoulsChanged serverSoulsChanged = new(_serverSouls.ToList(), changeType, soul); + ServerSoulsChanged serverSoulsChanged = new(_serverSouls.Values.ToList(), changeType, value); serverSoulsChanged.Invoke(this); } + private void LateSyncServerSouls() + { + foreach (Soul soul in _serverSouls.Values) + { + HandleSyncOnlineSouls(SyncDictionaryOperation.Add, soul.Ckey, soul, false); + } + } + /// - /// + /// /// /// [Server] @@ -95,7 +141,7 @@ private void ProcessPlayerJoin(NetworkConnection conn) { string message = $"Player joined the server - {conn.ClientId} {conn.GetAddress()}"; Punpun.Say(this, message, Logs.ServerOnly); - + NetworkObject unauthorizedUser = Instantiate(_unauthorizedUserPrefab, Vector3.zero, Quaternion.identity); ServerManager.Spawn(unauthorizedUser, conn); } @@ -110,74 +156,71 @@ private void ProcessPlayerJoin(NetworkConnection conn) private void ProcessAuthorizePlayer(NetworkConnection conn, UserAuthorizationMessage userAuthorizationMessage) { string ckey = userAuthorizationMessage.Ckey; + bool hasSoul = _serverSouls.TryGetValue(ckey, out Soul soul); - Soul match = GetSoul(ckey); - - if (match == null) + if (!hasSoul) { Punpun.Say(this, $"No Soul match for {ckey} found, creating a new one", Logs.ServerOnly); - match = Instantiate(_soulPrefab).GetComponent(); - match.UpdateCkey(string.Empty, ckey, true); + soul = Instantiate(_soulPrefab); + ServerManager.Spawn(soul.gameObject); - _serverSouls.Add(match); + soul.SetCkey(ckey); - ServerManager.Spawn(match.gameObject); + _serverSouls.Add(ckey, soul); } else { Punpun.Say(this, $"Soul match for {ckey} found, reassigning to client", Logs.ServerOnly); } - NetworkObject networkObject = match.NetworkObject; - networkObject.GiveOwnership(conn); - - _onlineSouls.Add(match); + soul.GiveOwnership(conn); + _onlineSouls.Add(ckey, soul); } [Server] private void ProcessPlayerDisconnect(NetworkConnection conn) { - string message = $"Client {conn.ClientId} {conn.GetAddress()} disconnected"; + string message = $"Client {conn.ClientId} {conn.GetAddress()} disconnected"; Punpun.Say(this, message, Logs.ServerOnly); - + NetworkObject[] ownedObjects = conn.Objects.ToArray(); if (ownedObjects.Length == 0) { - Punpun.Panic(this, "No clientOwnedObjects were found", Logs.ServerOnly); + Punpun.Yell(this, "No clientOwnedObjects were found", Logs.ServerOnly); return; } foreach (NetworkObject networkIdentity in ownedObjects) { Punpun.Say(this, $"Client {conn.GetAddress()}'s owned object: {networkIdentity.name}", Logs.ServerOnly); - + Soul soul = networkIdentity.GetComponent(); if (soul != null) { - _onlineSouls.Remove(soul); + _onlineSouls.Remove(soul.Ckey); soul.RemoveOwnership(); + Punpun.Say(this, $"Invoking the player server left event: {soul.Ckey}", Logs.ServerOnly); + return; } networkIdentity.RemoveOwnership(); - - Punpun.Say(this, $"Invoking the player server left event: {soul.Ckey}", Logs.ServerOnly); } } public string GetCkey(NetworkConnection conn) { - return _serverSouls.Find(soul => soul.Owner == conn)?.Ckey; + return ServerSouls.ToList().Find(soul => soul.Owner == conn)?.Ckey; } public Soul GetSoul(string ckey) { - return _serverSouls.Find(soul => soul.Ckey == ckey); + return ServerSouls.ToList().Find(soul => soul.Ckey == ckey); } public Soul GetSoul(NetworkConnection conn) { - return _serverSouls.Find(soul => soul.Owner == conn); + return ServerSouls.ToList().Find(soul => soul.Owner == conn); } } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/PlayerControl/PlayerControlSystem.cs.meta b/Assets/Scripts/SS3D/Systems/PlayerControl/PlayerSystem.cs.meta similarity index 100% rename from Assets/Scripts/SS3D/Systems/PlayerControl/PlayerControlSystem.cs.meta rename to Assets/Scripts/SS3D/Systems/PlayerControl/PlayerSystem.cs.meta diff --git a/Assets/Scripts/SS3D/Systems/Rounds/Events/ReadyPlayersChanged.cs b/Assets/Scripts/SS3D/Systems/Rounds/Events/ReadyPlayersChanged.cs index abb9916500..e776cfcf00 100644 --- a/Assets/Scripts/SS3D/Systems/Rounds/Events/ReadyPlayersChanged.cs +++ b/Assets/Scripts/SS3D/Systems/Rounds/Events/ReadyPlayersChanged.cs @@ -8,9 +8,9 @@ namespace SS3D.Systems.Rounds.Events { public partial struct ReadyPlayersChanged : IEvent { - public readonly List ReadyPlayers; + public readonly List ReadyPlayers; - public ReadyPlayersChanged(ListreadyPlayers) + public ReadyPlayersChanged(ListreadyPlayers) { ReadyPlayers = readyPlayers; } diff --git a/Assets/Scripts/SS3D/Systems/Rounds/Events/SpawnReadyPlayersEvent.cs b/Assets/Scripts/SS3D/Systems/Rounds/Events/SpawnReadyPlayersEvent.cs index 8a0a8c669a..8333a9a892 100644 --- a/Assets/Scripts/SS3D/Systems/Rounds/Events/SpawnReadyPlayersEvent.cs +++ b/Assets/Scripts/SS3D/Systems/Rounds/Events/SpawnReadyPlayersEvent.cs @@ -1,13 +1,14 @@ using System.Collections.Generic; using Coimbra.Services.Events; +using SS3D.Systems.Entities; namespace SS3D.Systems.Rounds.Events { public partial struct SpawnReadyPlayersEvent : IEvent { - public readonly List ReadyPlayers; + public readonly List ReadyPlayers; - public SpawnReadyPlayersEvent(ListreadyPlayers) + public SpawnReadyPlayersEvent(ListreadyPlayers) { ReadyPlayers = readyPlayers; } diff --git a/Assets/Scripts/SS3D/Systems/Rounds/Messages/RequestEmbarkMessage.cs b/Assets/Scripts/SS3D/Systems/Rounds/Messages/RequestEmbarkMessage.cs deleted file mode 100644 index af8dff6b84..0000000000 --- a/Assets/Scripts/SS3D/Systems/Rounds/Messages/RequestEmbarkMessage.cs +++ /dev/null @@ -1,14 +0,0 @@ -using FishNet.Broadcast; - -namespace SS3D.Systems.Rounds.Messages -{ - public struct RequestEmbarkMessage : IBroadcast - { - public readonly string Ckey; - - public RequestEmbarkMessage(string ckey) - { - Ckey = ckey; - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Rounds/Messages/RequestEmbarkMessage.cs.meta b/Assets/Scripts/SS3D/Systems/Rounds/Messages/RequestEmbarkMessage.cs.meta deleted file mode 100644 index 709b18993c..0000000000 --- a/Assets/Scripts/SS3D/Systems/Rounds/Messages/RequestEmbarkMessage.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 077ac59d621847488294c8c8d5bf317e -timeCreated: 1665296399 \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Rounds/ReadyPlayersSystem.cs b/Assets/Scripts/SS3D/Systems/Rounds/ReadyPlayersSystem.cs index c27cdad99d..bf704dd35a 100644 --- a/Assets/Scripts/SS3D/Systems/Rounds/ReadyPlayersSystem.cs +++ b/Assets/Scripts/SS3D/Systems/Rounds/ReadyPlayersSystem.cs @@ -21,7 +21,7 @@ namespace SS3D.Systems.Rounds /// public class ReadyPlayersSystem : NetworkSystem { - [SyncObject] private readonly SyncList _readyPlayers = new(); + [SyncObject] private readonly SyncList _readyPlayers = new(); public override void OnStartServer() { @@ -29,8 +29,8 @@ public override void OnStartServer() ServerManager.RegisterBroadcast(HandleChangePlayerReady); - OnlineSoulsChanged.AddListener(HandleUserLeftServer); - RoundStateUpdated.AddListener(HandleRoundStateUpdated); + AddHandle(OnlineSoulsChanged.AddListener(HandleUserLeftServer)); + AddHandle(RoundStateUpdated.AddListener(HandleRoundStateUpdated)); } public override void OnStartClient() @@ -41,11 +41,8 @@ public override void OnStartClient() SyncReadyPlayers(); } - [Server] - private void HandleRoundStateUpdated(ref EventContext context, in RoundStateUpdated e) + private void InvokeSpawnReadyPlayers(RoundState roundState) { - RoundState roundState = e.RoundState; - if (roundState != RoundState.Ongoing) { return; @@ -58,34 +55,24 @@ private void HandleRoundStateUpdated(ref EventContext context, in RoundStateUpda } [Server] - private void HandleUserLeftServer(ref EventContext context, in OnlineSoulsChanged e) + private void RemoveReadyPlayer(Soul soul, ChangeType changeType) { - if (e.ChangeType == ChangeType.Addition) + if (changeType == ChangeType.Addition) { return; } - Soul soul = e.Changed; - if (soul == null) { return; } - if (_readyPlayers.SingleOrDefault(match => match == soul.Ckey) != null) + if (_readyPlayers.SingleOrDefault(match => match == soul) != null) { - _readyPlayers.Remove(soul.Ckey); + _readyPlayers.Remove(soul); } } - [Server] - private void HandleChangePlayerReady(NetworkConnection sender, ChangePlayerReadyMessage m) - { - Soul soul = SystemLocator.Get().GetSoul(m.Ckey); - - SetPlayerReady(soul, m.Ready); - } - /// /// Sets the player ready state /// @@ -94,26 +81,49 @@ private void HandleChangePlayerReady(NetworkConnection sender, ChangePlayerReady [Server] private void SetPlayerReady(Soul soul, bool ready) { - bool soulIsReady = _readyPlayers.Contains(soul.Ckey); + bool soulIsReady = _readyPlayers.Contains(soul); switch (ready) { case true when !soulIsReady: Punpun.Say(this, $"player is {soul.Ckey} is ready", Logs.ServerOnly); - _readyPlayers.Add(soul.Ckey); + _readyPlayers.Add(soul); break; case false when soulIsReady: Punpun.Say(this, $"player is {soul.Ckey} is not ready", Logs.ServerOnly); - _readyPlayers.Remove(soul.Ckey); + _readyPlayers.Remove(soul); break; } } - private void HandleReadyPlayersChanged(SyncListOperation op, int index, string s, string newItem1, bool asServer) + [Server] + private void HandleChangePlayerReady(NetworkConnection sender, ChangePlayerReadyMessage m) + { + Soul soul = SystemLocator.Get().GetSoul(m.Ckey); + + SetPlayerReady(soul, m.Ready); + } + + private void HandleReadyPlayersChanged(SyncListOperation op, int index, Soul oldItem, Soul newItem, bool asServer) { SyncReadyPlayers(); } + [Server] + private void HandleRoundStateUpdated(ref EventContext context, in RoundStateUpdated e) + { + InvokeSpawnReadyPlayers(e.RoundState); + } + + [Server] + private void HandleUserLeftServer(ref EventContext context, in OnlineSoulsChanged e) + { + RemoveReadyPlayer(e.Changed, e.ChangeType); + } + + /// + /// Called by manually when the ready players are changed. + /// private void SyncReadyPlayers() { ReadyPlayersChanged readyPlayersChanged = new(_readyPlayers.ToList()); diff --git a/Assets/Scripts/SS3D/Systems/Rounds/RoundSystem.cs b/Assets/Scripts/SS3D/Systems/Rounds/RoundSystem.cs index f5ef3f9060..1ad63adca3 100644 --- a/Assets/Scripts/SS3D/Systems/Rounds/RoundSystem.cs +++ b/Assets/Scripts/SS3D/Systems/Rounds/RoundSystem.cs @@ -15,7 +15,6 @@ public sealed class RoundSystem : RoundSystemBase /// /// Round loop runner /// - /// [Server] protected override async UniTask ProcessChangeRoundState(ChangeRoundStateMessage m) { @@ -43,7 +42,7 @@ protected override async UniTask ProcessChangeRoundState(ChangeRoundStateMessage protected override async UniTask PrepareRound() { Punpun.Say(this, "Preparing round", Logs.ServerOnly); - + RoundState = RoundState.Preparing; TimeSpan second = TimeSpan.FromMilliseconds(500); diff --git a/Assets/Scripts/SS3D/Systems/Rounds/RoundSystemBase.cs b/Assets/Scripts/SS3D/Systems/Rounds/RoundSystemBase.cs index 4d69f4e701..fab43b61ef 100644 --- a/Assets/Scripts/SS3D/Systems/Rounds/RoundSystemBase.cs +++ b/Assets/Scripts/SS3D/Systems/Rounds/RoundSystemBase.cs @@ -1,9 +1,7 @@ using System; using System.Threading; using Cysharp.Threading.Tasks; -using FishNet; using FishNet.Connection; -using FishNet.Managing.Server; using FishNet.Object; using FishNet.Object.Synchronizing; using SS3D.Core; @@ -41,7 +39,8 @@ public class RoundSystemBase : NetworkSystem /// How many seconds of warmup. /// [Header("Warmup")] - [SyncVar] [SerializeField] protected int _warmupSeconds = 5; + [SyncVar] [SerializeField] + protected int _warmupSeconds = 5; /// /// The cancellation token for the round system, it cancels the tick count. @@ -102,17 +101,17 @@ private void HandleRequestStartRound(NetworkConnection conn, ChangeRoundStateMes /// Process the start round request. /// /// The connection that requested the round start. - /// The message received. + /// [Server] private void AuthorizeChangeRoundState(NetworkConnection conn, ChangeRoundStateMessage m) { const ServerRoleTypes requiredRole = ServerRoleTypes.Administrator; - PlayerControlSystem playerControlSystem = SystemLocator.Get(); + PlayerSystem playerSystem = SystemLocator.Get(); PermissionSystem permissionSystem = SystemLocator.Get(); // Gets the soul that matches the connection, uses the ckey as the user id - string userCkey = playerControlSystem.GetCkey(conn); + string userCkey = playerSystem.GetCkey(conn); // Checks if player can call a round start if (permissionSystem.TryGetUserRole(userCkey, out ServerRoleTypes role) && role != requiredRole) diff --git a/Assets/Scripts/SS3D/Systems/Screens/Events/ChangeCameraEvent.cs b/Assets/Scripts/SS3D/Systems/Screens/Events/CameraTargetChanged.cs similarity index 67% rename from Assets/Scripts/SS3D/Systems/Screens/Events/ChangeCameraEvent.cs rename to Assets/Scripts/SS3D/Systems/Screens/Events/CameraTargetChanged.cs index 4cece647a7..998f9df640 100644 --- a/Assets/Scripts/SS3D/Systems/Screens/Events/ChangeCameraEvent.cs +++ b/Assets/Scripts/SS3D/Systems/Screens/Events/CameraTargetChanged.cs @@ -4,11 +4,11 @@ namespace SS3D.Systems.Screens.Events { - public partial struct ChangeCameraEvent : IEvent + public partial struct CameraTargetChanged : IEvent { public readonly GameObject Target; - public ChangeCameraEvent(GameObject target) + public CameraTargetChanged(GameObject target) { Target = target; } diff --git a/Assets/Scripts/SS3D/Systems/Screens/Events/ChangeCameraEvent.cs.meta b/Assets/Scripts/SS3D/Systems/Screens/Events/CameraTargetChanged.cs.meta similarity index 100% rename from Assets/Scripts/SS3D/Systems/Screens/Events/ChangeCameraEvent.cs.meta rename to Assets/Scripts/SS3D/Systems/Screens/Events/CameraTargetChanged.cs.meta diff --git a/Assets/Scripts/SS3D/Systems/Screens/GameScreen.cs b/Assets/Scripts/SS3D/Systems/Screens/GameScreen.cs index 3ff8ef974e..76bf07f7c0 100644 --- a/Assets/Scripts/SS3D/Systems/Screens/GameScreen.cs +++ b/Assets/Scripts/SS3D/Systems/Screens/GameScreen.cs @@ -2,7 +2,6 @@ using DG.Tweening; using FishNet.Object; using SS3D.Core.Behaviours; -using SS3D.Logging; using SS3D.Systems.Screens.Events; using UnityEngine; @@ -45,8 +44,8 @@ private void Setup() SetScreenState(ScreenType.Lobby, true); - ChangeGameScreenEvent.AddListener(HandleChangeGameScreen); - ChangeCameraEvent.AddListener(HandleChangeCamera); + AddHandle(ChangeGameScreenEvent.AddListener(HandleChangeGameScreen)); + AddHandle(CameraTargetChanged.AddListener(HandleChangeCamera)); } [Client] @@ -58,7 +57,7 @@ private void HandleChangeGameScreen(ref EventContext context, in ChangeGameScree } [Client] - private void HandleChangeCamera(ref EventContext context, in ChangeCameraEvent e) + private void HandleChangeCamera(ref EventContext context, in CameraTargetChanged e) { ChangeGameScreenEvent changeGameScreenEvent = new(ScreenType.None); changeGameScreenEvent.Invoke(this); diff --git a/Assets/Scripts/SS3D/Systems/Screens/PlayerCameraSystem.cs b/Assets/Scripts/SS3D/Systems/Screens/PlayerCameraSystem.cs index 84db31c747..ea9c456caa 100644 --- a/Assets/Scripts/SS3D/Systems/Screens/PlayerCameraSystem.cs +++ b/Assets/Scripts/SS3D/Systems/Screens/PlayerCameraSystem.cs @@ -2,32 +2,48 @@ using DG.Tweening; using SS3D.Core.Behaviours; using SS3D.Logging; +using SS3D.Systems.Entities.Events; using SS3D.Systems.Screens.Events; using UnityEngine; namespace SS3D.Systems.Screens { + /// + /// Sets the camera follow for the local player. + /// public class PlayerCameraSystem : Core.Behaviours.System { [SerializeField] private Camera _camera; [SerializeField] private CameraFollow _cameraFollow; - protected override void OnStart() + private Sequence _fovSequence; + + protected override void OnAwake() { - base.OnStart(); + base.OnAwake(); - ChangeCameraEvent.AddListener(HandleChangeCameraEvent); + AddHandle(LocalPlayerObjectChanged.AddListener(HandlePlayerObjectChanged)); } - private void HandleChangeCameraEvent(ref EventContext context, in ChangeCameraEvent e) + /// + /// Called when the player object is changed. + /// + /// + /// + private void HandlePlayerObjectChanged(ref EventContext context, in LocalPlayerObjectChanged e) { GameObject target = e.Target; - _camera.DOFieldOfView(75, 0); - _camera.DOFieldOfView(65, .7F); + _fovSequence?.Kill(); + _fovSequence = DOTween.Sequence(); + + _fovSequence.Append(_camera.DOFieldOfView(75, 0.1f)); + _fovSequence.Append(_camera.DOFieldOfView(65, .7F)); Punpun.Say(this, $"setting new camera target {target.name}"); _cameraFollow.SetTarget(target); + + new CameraTargetChanged(GameObjectCache).Invoke(this); } } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Storage/Containers/AttachedContainer.cs b/Assets/Scripts/SS3D/Systems/Storage/Containers/AttachedContainer.cs index cb0d02c3a5..3b5ab9d739 100644 --- a/Assets/Scripts/SS3D/Systems/Storage/Containers/AttachedContainer.cs +++ b/Assets/Scripts/SS3D/Systems/Storage/Containers/AttachedContainer.cs @@ -15,13 +15,13 @@ public class AttachedContainer : NetworkActor /// /// The creatures looking at this container /// - public readonly HashSet ObservingPlayers = new(); + public readonly HashSet ObservingPlayers = new(); public ContainerDescriptor ContainerDescriptor; [SerializeField] private Container _container; - public delegate void ObserverHandler(AttachedContainer container, PlayerControllable observer); + public delegate void ObserverHandler(AttachedContainer container, Entity observer); public event EventHandler OnItemAttached; public event EventHandler OnItemDetached; @@ -66,7 +66,7 @@ public void OnDestroy() /// /// The creature which observes /// True if the creature was not already observing this container - public bool AddObserver(PlayerControllable observer) + public bool AddObserver(Entity observer) { bool newObserver = ObservingPlayers.Add(observer); if (newObserver) @@ -80,7 +80,7 @@ public bool AddObserver(PlayerControllable observer) /// Removes an observer /// /// The observer to remove - public void RemoveObserver(PlayerControllable observer) + public void RemoveObserver(Entity observer) { ObservingPlayers.Remove(observer); } @@ -100,7 +100,7 @@ private void ProcessItemDetached(Item e) OnItemDetached?.Invoke(this, e); } - private void ProcessNewObserver(PlayerControllable e) + private void ProcessNewObserver(Entity e) { OnNewObserver?.Invoke(this, e); } diff --git a/Assets/Scripts/SS3D/Systems/Storage/Containers/ContainerDescriptor.cs b/Assets/Scripts/SS3D/Systems/Storage/Containers/ContainerDescriptor.cs index 5642395779..001c99424f 100644 --- a/Assets/Scripts/SS3D/Systems/Storage/Containers/ContainerDescriptor.cs +++ b/Assets/Scripts/SS3D/Systems/Storage/Containers/ContainerDescriptor.cs @@ -7,6 +7,7 @@ using SS3D.Systems.Storage.UI; using UnityEngine; using UnityEngine.Assertions; +using UnityEngine.Serialization; namespace SS3D.Systems.Storage.Containers { @@ -22,11 +23,10 @@ namespace SS3D.Systems.Storage.Containers /// public class ContainerDescriptor : MonoBehaviour { - - public bool AutomaticContainerSetUp = false; + public bool AutomaticContainerSetUp = false; // References toward all container related scripts. public AttachedContainer AttachedContainer; - public Container Container; + public Container Container; public ContainerInteractive ContainerInteractive; public ContainerItemDisplay ContainerItemDisplay; @@ -70,11 +70,11 @@ public class ContainerDescriptor : MonoBehaviour public float MaxDistance = 5f; [Tooltip("If the container can be opened/closed, in the sense of having a close/open animation.")] public bool IsOpenable; - [Tooltip("If the container should have the container's default interactions setting script.")] + [Tooltip("If the container should have the container's default interactions setting script.")] public bool IsInteractive; [Tooltip("If stuff inside the container can be seen using an UI.")] public bool HasUi; - [Tooltip("If true, interactions in containerInteractive are ignored, instead, a script on the container's game object should implement IInteractionTarget.")] + [Tooltip("If true, interactions in containerInteractive are ignored, instead, a script on the container's game object should implement IInteractionTarget.")] public bool HasCustomInteraction; [Tooltip("If the container renders items in custom position on the container.")] public bool HasCustomDisplay; @@ -84,8 +84,8 @@ public class ContainerDescriptor : MonoBehaviour public int NumberDisplay; [Tooltip("The filter on the container.")] public Filter StartFilter; - [Tooltip("Container type mostly allow to discriminate between diffent containers on a single prefab.")] - public ContainerType ContainerType; + [FormerlySerializedAs("ContainerType")] [Tooltip("Container type mostly allow to discriminate between diffent containers on a single prefab.")] + public ContainerType Type; /// /// need some bool to override automatic setup and go manual instead. nat 01/10/23 /// diff --git a/Assets/Scripts/SS3D/Systems/Storage/Containers/ContainerInteractive.cs b/Assets/Scripts/SS3D/Systems/Storage/Containers/ContainerInteractive.cs index af47952a81..2421955729 100644 --- a/Assets/Scripts/SS3D/Systems/Storage/Containers/ContainerInteractive.cs +++ b/Assets/Scripts/SS3D/Systems/Storage/Containers/ContainerInteractive.cs @@ -9,13 +9,12 @@ namespace SS3D.Systems.Storage.Containers { /// - /// This allow a container to send back container related possible interactions, + /// This allow a container to send back container related possible interactions, /// including viewing the content, storing, opening and others. /// It also handle some UI stuff, such as closing the UI for all clients when someone close the container. /// public class ContainerInteractive : NetworkedOpenable { - public ContainerDescriptor containerDescriptor; private Sprite _viewContainerIcon; @@ -55,7 +54,7 @@ public override IInteraction[] CreateTargetInteractions(InteractionEvent interac { interactions.Add(storeInteraction); interactions.Add(takeFirstInteraction); - } + } } if (!containerDescriptor.IsOpenable) @@ -73,9 +72,9 @@ public override IInteraction[] CreateTargetInteractions(InteractionEvent interac return interactions.ToArray(); } - + protected override void OpenStateChanged(object sender, bool e) - { + { base.OpenStateChanged(sender, e); } @@ -91,7 +90,7 @@ private void CloseUis() { containerDescriptor.ContainerUi.Close(); } - + // We check for each item if they are interactive containers. foreach(Item item in containerDescriptor.AttachedContainer.Container.Items) { diff --git a/Assets/Scripts/SS3D/Systems/Storage/Containers/Editor/ContainerDescriptorEditor.cs b/Assets/Scripts/SS3D/Systems/Storage/Containers/Editor/ContainerDescriptorEditor.cs index 7c512db5a5..c040c08bff 100644 --- a/Assets/Scripts/SS3D/Systems/Storage/Containers/Editor/ContainerDescriptorEditor.cs +++ b/Assets/Scripts/SS3D/Systems/Storage/Containers/Editor/ContainerDescriptorEditor.cs @@ -19,7 +19,7 @@ public class ContainerDescriptorEditor : Editor private bool showIcon = false; // References to container related scripts to allow for automating set up and destroying. - private AttachedContainer attachedContainer; + private AttachedContainer attachedContainer; private ContainerInteractive containerInteractive; private ContainerItemDisplay containerItemDisplay; @@ -104,7 +104,7 @@ public override void OnInspectorGUI() bool onlyStoreWhenOpen = EditorGUILayout.Toggle( new GUIContent("Only store when open", "Set if objects can be stored in the container without using the open interaction first"), containerDescriptor.OnlyStoreWhenOpen); - HandleOnlyStoreWhenOpen(onlyStoreWhenOpen); + HandleOnlyStoreWhenOpen(onlyStoreWhenOpen); } if(containerDescriptor.HasUi) @@ -122,7 +122,7 @@ public override void OnInspectorGUI() containerDescriptor.OpenWhenContainerViewed); HandleOpenWhenContainerViewed(openWhenContainerViewed); } - } + } } if (containerDescriptor.HasUi) @@ -184,7 +184,7 @@ public override void OnInspectorGUI() ContainerType containerType = (ContainerType) EditorGUILayout.EnumFlagsField( new GUIContent("Container type", "Container type mostly allow to discriminate between diffent containers on a single prefab."), - containerDescriptor.ContainerType); + containerDescriptor.Type); HandleContainerType(containerType); ShowIcons(); @@ -243,7 +243,7 @@ public void AddBase() { AddContainer(); AddAttached(); - + HandleIsInteractive(true); //AddSync(); SerializedProperty sp = serializedObject.FindProperty("Initialized"); @@ -311,7 +311,7 @@ private void HandleOpenWhenContainerViewed(bool openWhenContainerViewed) private void HandleContainerType(ContainerType containerType) { - SerializedProperty sp = serializedObject.FindProperty("ContainerType"); + SerializedProperty sp = serializedObject.FindProperty("Type"); sp.enumValueFlag = (int) containerType; serializedObject.ApplyModifiedProperties(); } @@ -343,7 +343,7 @@ private void HandleAttachItems(bool attachItems) } private void HandleMaxDistance(float maxDistance) - { + { SerializedProperty sp = serializedObject.FindProperty("MaxDistance"); sp.floatValue = maxDistance; serializedObject.ApplyModifiedProperties(); @@ -364,7 +364,7 @@ private void HandleIsInteractive(bool isInteractive) } private void HandleCustomInteraction(bool hasCustomInteraction) - { + { SerializedProperty sp = serializedObject.FindProperty("HasCustomInteraction"); sp.boolValue = hasCustomInteraction; serializedObject.ApplyModifiedProperties(); @@ -378,7 +378,7 @@ private void HandleContainerName(string containerName) } private void HandleIsOpenable(bool isOpenable) { - + SerializedProperty sp = serializedObject.FindProperty("IsOpenable"); sp.boolValue = isOpenable; serializedObject.ApplyModifiedProperties(); @@ -387,7 +387,7 @@ private void HandleIsOpenable(bool isOpenable) if (isOpenable) { HandleIsInteractive(true); - } + } } private void HandleOnlyStoreWhenOpen(bool onlyStoreWhenOpen) @@ -469,4 +469,4 @@ private void OnDestroy() - + diff --git a/Assets/Scripts/SS3D/Systems/Storage/Containers/Hands.cs b/Assets/Scripts/SS3D/Systems/Storage/Containers/Hands.cs index 8a0af51fc7..49a6210f9f 100644 --- a/Assets/Scripts/SS3D/Systems/Storage/Containers/Hands.cs +++ b/Assets/Scripts/SS3D/Systems/Storage/Containers/Hands.cs @@ -47,13 +47,13 @@ public class Hands : InteractionSourceNetworkBehaviour, IToolHolder, IInteractio /// public bool SelectedHandEmpty => SelectedHandContainer.Empty; - public HandsUi HandsUI { get; private set; } + public HandsView HandsView { get; private set; } protected override void OnAwake() { base.OnAwake(); - HandsUI = FindObjectOfType(true); - HandsUI.Hands = this; + HandsView = FindObjectOfType(true); + HandsView.Hands = this; SupportsMultipleInteractions = true; } @@ -89,7 +89,7 @@ public void DropHeldItem() { return; } - + SelectedHandContainer.Dump(); } @@ -109,7 +109,7 @@ public void PlaceHeldItem(Vector3 position, Quaternion rotation) public override void Update() { base.Update(); - + if (!IsOwner) { return; @@ -130,7 +130,7 @@ public override void Update() } /// - /// Set the Active hand of the Player to be the AttachedContainer passed in parameter. + /// Set the Active hand of the Player to be the AttachedContainer passed in parameter. /// Do nothing if the parameter is the already active parameter. /// /// This AttachedContainer should only be a hand. @@ -168,7 +168,7 @@ private void CmdSetActiveHand(int selectedHand) } else { - Debug.Log($"Invalid hand index {selectedHand}"); + Debug.Log($"Invalid hand index {selectedHand}"); } } diff --git a/Assets/Scripts/SS3D/Systems/Storage/Containers/Inventory.cs b/Assets/Scripts/SS3D/Systems/Storage/Containers/Inventory.cs index 766b6b7712..39be0c2a51 100644 --- a/Assets/Scripts/SS3D/Systems/Storage/Containers/Inventory.cs +++ b/Assets/Scripts/SS3D/Systems/Storage/Containers/Inventory.cs @@ -2,6 +2,8 @@ using System.Linq; using FishNet.Connection; using FishNet.Object; +using SS3D.Core; +using SS3D.Core.Behaviours; using SS3D.Systems.Entities; using SS3D.Systems.Storage.Items; using SS3D.Systems.Storage.UI; @@ -15,8 +17,12 @@ namespace SS3D.Systems.Storage.Containers /// - Aggregating all containers on the player and accessible to the player. /// - The moving of items from one item-slot to another. /// - public sealed class Inventory : NetworkBehaviour + public sealed class Inventory : NetworkActor { + public delegate void ContainerEventHandler(AttachedContainer container); + + public event ContainerEventHandler OnContainerOpened; + public event ContainerEventHandler OnContainerClosed; /// /// The hands used by this inventory @@ -26,55 +32,62 @@ public sealed class Inventory : NetworkBehaviour /// /// The controllable body of the owning player /// - public PlayerControllable Body; + public Entity Body; private readonly List _openedContainers = new(); - private float _nextAccessCheck; - public delegate void ContainerEventHandler(AttachedContainer container); - - public event ContainerEventHandler ContainerOpened; - public event ContainerEventHandler ContainerClosed; + private float _nextAccessCheck; - public InventoryUi InventoryUi { get; private set; } + public InventoryView InventoryView { get; private set; } public override void OnStartClient() { base.OnStartClient(); - if(!IsOwner) return; - InventoryUi = FindObjectOfType(true); - InventoryUi.Inventory = this; - InventoryUi.gameObject.SetActive(true); - var pocketView = FindObjectOfType(true); - pocketView.Inventory= this; - pocketView.gameObject.SetActive(true); - } + if(!IsOwner) + { + return; + } + + InventoryView = ViewLocator.Get().First(); + InventoryView.Inventory = this; - public void Awake() + InventoryView.Setup(); + InventoryView.Enable(true); + } + + protected override void OnAwake() { + base.OnAwake(); + Hands.Inventory = this; } - public void Update() + protected override void HandleUpdate(in float deltaTime) { + base.HandleUpdate(in deltaTime); + float time = Time.time; - if (time > _nextAccessCheck) + if (!(time > _nextAccessCheck)) { - // Remove all containers from the inventory that can't be interacted with anymore. - Hands hands = GetComponent(); - for (var i = 0; i < _openedContainers.Count; i++) + return; + } + + // Remove all containers from the inventory that can't be interacted with anymore. + Hands hands = GetComponent(); + for (int i = 0; i < _openedContainers.Count; i++) + { + AttachedContainer attachedContainer = _openedContainers[i]; + if (hands.CanInteract(attachedContainer.gameObject)) { - AttachedContainer attachedContainer = _openedContainers[i]; - if (!hands.CanInteract(attachedContainer.gameObject)) - { - RemoveContainer(attachedContainer); - i--; - } + continue; } - _nextAccessCheck = time + 0.5f; + RemoveContainer(attachedContainer); + i--; } + + _nextAccessCheck = time + 0.5f; } /// @@ -179,7 +192,7 @@ private void CmdTransferItem(GameObject itemObject, Vector2Int position, Attache { return; } - + container.Container.AddItemPosition(item, position); } @@ -188,7 +201,7 @@ private void CmdTransferItem(GameObject itemObject, Vector2Int position, Attache /// public void OpenContainer(AttachedContainer container) { - container.AddObserver(GetComponent()); + container.AddObserver(GetComponent()); _openedContainers.Add(container); SetOpenState(container.gameObject, true); NetworkConnection client = Owner; @@ -255,7 +268,7 @@ private void CmdDropItem(GameObject gameObject) [TargetRpc] private void TargetOpenContainer(NetworkConnection target, AttachedContainer container) { - OnContainerOpened(container); + InvokeContainerOpened(container); } /// @@ -277,7 +290,7 @@ private void SetOpenState(GameObject containerObject, bool state) } Hands hands = GetComponent(); - foreach (PlayerControllable observer in container.ObservingPlayers) + foreach (Entity observer in container.ObservingPlayers) { // checks if the container is already viewed by another entity if (hands.Inventory.HasContainer(container) && observer != hands) @@ -293,11 +306,11 @@ private void SetOpenState(GameObject containerObject, bool state) [TargetRpc] private void TargetCloseContainer(NetworkConnection target, AttachedContainer container) { - OnContainerClosed(container); + InvokeContainerClosed(container); } - /// + /// /// Graphically adds the item back into the world(for server and all clients). /// Must be called from server initially. /// @@ -347,14 +360,14 @@ private void RpcSpawn(GameObject item, Vector3 position, Quaternion rotation) } } - private void OnContainerOpened(AttachedContainer container) + private void InvokeContainerOpened(AttachedContainer container) { - ContainerOpened?.Invoke(container); + OnContainerOpened?.Invoke(container); } - private void OnContainerClosed(AttachedContainer container) + private void InvokeContainerClosed(AttachedContainer container) { - ContainerClosed?.Invoke(container); + OnContainerClosed?.Invoke(container); } } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Storage/Containers/NetworkedOpenable.cs b/Assets/Scripts/SS3D/Systems/Storage/Containers/NetworkedOpenable.cs index 26fa21aa09..70bd7197a2 100644 --- a/Assets/Scripts/SS3D/Systems/Storage/Containers/NetworkedOpenable.cs +++ b/Assets/Scripts/SS3D/Systems/Storage/Containers/NetworkedOpenable.cs @@ -4,6 +4,7 @@ using SS3D.Interactions.Interfaces; using SS3D.Systems.Storage.Interactions; using UnityEngine; +using UnityEngine.Serialization; namespace SS3D.Systems.Storage.Containers { @@ -19,18 +20,18 @@ public class NetworkedOpenable : InteractionTargetNetworkBehaviour [SyncVar(OnChange = nameof(SyncOpenState))] private bool _openState; - [SerializeField] protected Sprite OpenIcon; + [FormerlySerializedAs("OpenIcon")] [SerializeField] protected Sprite OverrideOpenIcon; public override IInteraction[] CreateTargetInteractions(InteractionEvent interactionEvent) { OpenInteraction openInteraction = new() { - Icon = OpenIcon + Icon = OverrideOpenIcon }; openInteraction.OnOpenStateChanged += OpenStateChanged; return new IInteraction[] { openInteraction }; } - + public bool IsOpen() { return _openState; @@ -56,7 +57,7 @@ private void OpenAllOpenables(object sender, bool e) { NetworkedOpenable[] openables = gameObject.GetComponents(); - // If this is the top NetworkedOpenable in the inspector, tell the others to open too. + // If this is the top NetworkedOpenable in the inspector, tell the others to open too. if (openables[0] != this) { return; @@ -74,12 +75,12 @@ public void SetOpenState(bool e) _openState = e; UpdateAnimator(); } - + protected virtual void SyncOpenState(bool oldVal, bool newVal, bool asServer) { UpdateAnimator(); } - + private void UpdateAnimator() { Animator.SetBool(OpenAnimation, _openState); diff --git a/Assets/Scripts/SS3D/Systems/Storage/Interactions/OpenInteraction.cs b/Assets/Scripts/SS3D/Systems/Storage/Interactions/OpenInteraction.cs index 0ab2df1e8e..f893db8696 100644 --- a/Assets/Scripts/SS3D/Systems/Storage/Interactions/OpenInteraction.cs +++ b/Assets/Scripts/SS3D/Systems/Storage/Interactions/OpenInteraction.cs @@ -53,7 +53,7 @@ public override bool CanInteract(InteractionEvent interactionEvent) } // Confirm that there is an entity doing this interaction - PlayerControllable entity = interactionEvent.Source.GetComponent(); + Entity entity = interactionEvent.Source.GetComponent(); if (entity == null) { return false; diff --git a/Assets/Scripts/SS3D/Systems/Storage/Interactions/PickupInteraction.cs b/Assets/Scripts/SS3D/Systems/Storage/Interactions/PickupInteraction.cs index 0a2a5fd3d4..1c670379a4 100644 --- a/Assets/Scripts/SS3D/Systems/Storage/Interactions/PickupInteraction.cs +++ b/Assets/Scripts/SS3D/Systems/Storage/Interactions/PickupInteraction.cs @@ -69,7 +69,7 @@ public override bool Start(InteractionEvent interactionEvent, InteractionReferen try { - string ckey = hands.Inventory.Body.ControllingSoul.Ckey; + string ckey = hands.Inventory.Body.Mind.Soul.Ckey; // and call the event for picking up items for the Game Mode System new ItemPickedUpEvent(target, ckey).Invoke(this); diff --git a/Assets/Scripts/SS3D/Systems/Storage/Interactions/ViewContainerInteraction.cs b/Assets/Scripts/SS3D/Systems/Storage/Interactions/ViewContainerInteraction.cs index 129540810a..f46e9aff77 100644 --- a/Assets/Scripts/SS3D/Systems/Storage/Interactions/ViewContainerInteraction.cs +++ b/Assets/Scripts/SS3D/Systems/Storage/Interactions/ViewContainerInteraction.cs @@ -48,7 +48,7 @@ public override bool CanInteract(InteractionEvent interactionEvent) return false; } - PlayerControllable entity = interactionEvent.Source.GetComponentInTree(); + Entity entity = interactionEvent.Source.GetComponentInTree(); if (entity == null) { return false; diff --git a/Assets/Scripts/SS3D/Systems/Storage/Items/Item.cs b/Assets/Scripts/SS3D/Systems/Storage/Items/Item.cs index b5cc859b23..f7b1495298 100644 --- a/Assets/Scripts/SS3D/Systems/Storage/Items/Item.cs +++ b/Assets/Scripts/SS3D/Systems/Storage/Items/Item.cs @@ -286,11 +286,11 @@ public void GenerateNewIcon() _sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f), 100); _sprite.name = transform.name; } - catch (NullReferenceException e) + catch (NullReferenceException) { Debug.LogError("Null reference exception, reverting to default sprite for item " + name + "."); } - + } #if UNITY_EDITOR diff --git a/Assets/Scripts/SS3D/Systems/Storage/UI/ClothingUi.cs b/Assets/Scripts/SS3D/Systems/Storage/UI/ClothingUi.cs index 246f4ddcf4..2a0d561766 100644 --- a/Assets/Scripts/SS3D/Systems/Storage/UI/ClothingUi.cs +++ b/Assets/Scripts/SS3D/Systems/Storage/UI/ClothingUi.cs @@ -9,8 +9,8 @@ public class ClothingUi : MonoBehaviour public void Start() { // Connects ui clothing slots to containers on the creature - Inventory inventory = transform.GetComponentInParent().Inventory; - GameObject creature = inventory.Hands.GetComponentInParent().gameObject; + Inventory inventory = transform.GetComponentInParent().Inventory; + GameObject creature = inventory.Hands.GetComponentInParent().gameObject; ClothingContainers clothingContainers = creature.GetComponent(); SingleItemContainerSlot[] slots = GetComponentsInChildren(); foreach (SingleItemContainerSlot slot in slots) diff --git a/Assets/Scripts/SS3D/Systems/Storage/UI/ContainerDisplay.cs b/Assets/Scripts/SS3D/Systems/Storage/UI/ContainerDisplay.cs new file mode 100644 index 0000000000..063ead79bf --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Storage/UI/ContainerDisplay.cs @@ -0,0 +1,17 @@ +using SS3D.Systems.Storage.Containers; +using UnityEngine; + +namespace SS3D.Systems.Storage.UI +{ + public struct ContainerDisplay + { + public GameObject UiElement; + public AttachedContainer Container; + + public ContainerDisplay(GameObject uiElement, AttachedContainer container) + { + UiElement = uiElement; + Container = container; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Storage/UI/ContainerDisplay.cs.meta b/Assets/Scripts/SS3D/Systems/Storage/UI/ContainerDisplay.cs.meta new file mode 100644 index 0000000000..61639960e9 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Storage/UI/ContainerDisplay.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3185f0d240ea447bb54a634faa9e39f2 +timeCreated: 1673968621 \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Storage/UI/HandsUi.cs b/Assets/Scripts/SS3D/Systems/Storage/UI/HandsView.cs similarity index 88% rename from Assets/Scripts/SS3D/Systems/Storage/UI/HandsUi.cs rename to Assets/Scripts/SS3D/Systems/Storage/UI/HandsView.cs index 1b517e697c..051b246077 100644 --- a/Assets/Scripts/SS3D/Systems/Storage/UI/HandsUi.cs +++ b/Assets/Scripts/SS3D/Systems/Storage/UI/HandsView.cs @@ -1,4 +1,5 @@ using System; +using SS3D.Core.Behaviours; using SS3D.Systems.Storage.Containers; using UnityEngine; using UnityEngine.Assertions; @@ -10,12 +11,14 @@ namespace SS3D.Systems.Storage.UI /// This script instantiate the hand UI prefabs, and set up the SingleItemContainerSlot on each hand, /// such that the slots are displaying the right containers. It also handles setting the highlight of the active hand. /// - public class HandsUi : MonoBehaviour + public class HandsView : View { - public GameObject LeftHandPrefab; - public GameObject RightHandPrefab; + public SingleItemContainerSlot LeftHandPrefab; + public SingleItemContainerSlot RightHandPrefab; + public Transform HandsContainer; public Color SelectedColor; + /// /// The hands this ui displays /// @@ -25,8 +28,10 @@ public class HandsUi : MonoBehaviour private Color _defaultColor; private int _currentHandIndex = -1; - public void Start() + protected override void OnStart() { + base.OnStart(); + Assert.IsNotNull(Hands); CreateHandDisplays(); Hands.OnHandChanged += OnHandChanged; @@ -44,7 +49,7 @@ private void OnHandChanged(int index) { SetHandHighlight(_currentHandIndex, false); } - + SetHandHighlight(index, true); _currentHandIndex = index; } @@ -87,8 +92,7 @@ private void CreateHandDisplays() for (int i = 0; i < containers.Length; i++) { AttachedContainer attachedContainer = containers[i]; - GameObject handElement = Instantiate(i % 2 == 0 ? LeftHandPrefab : RightHandPrefab, HandsContainer, false); - SingleItemContainerSlot slot = handElement.GetComponent(); + SingleItemContainerSlot slot = Instantiate(i % 2 == 0 ? LeftHandPrefab : RightHandPrefab, HandsContainer, false); slot.Inventory = Hands.Inventory; slot.Container = attachedContainer; } diff --git a/Assets/Scripts/SS3D/Systems/Storage/UI/HandsUi.cs.meta b/Assets/Scripts/SS3D/Systems/Storage/UI/HandsView.cs.meta similarity index 100% rename from Assets/Scripts/SS3D/Systems/Storage/UI/HandsUi.cs.meta rename to Assets/Scripts/SS3D/Systems/Storage/UI/HandsView.cs.meta diff --git a/Assets/Scripts/SS3D/Systems/Storage/UI/InventoryUi.cs b/Assets/Scripts/SS3D/Systems/Storage/UI/InventoryView.cs similarity index 74% rename from Assets/Scripts/SS3D/Systems/Storage/UI/InventoryUi.cs rename to Assets/Scripts/SS3D/Systems/Storage/UI/InventoryView.cs index dfaa50c477..7520070ad4 100644 --- a/Assets/Scripts/SS3D/Systems/Storage/UI/InventoryUi.cs +++ b/Assets/Scripts/SS3D/Systems/Storage/UI/InventoryView.cs @@ -1,9 +1,13 @@ using System; using System.Collections.Generic; +using System.Linq; using Coimbra; +using SS3D.Core; +using SS3D.Core.Behaviours; using SS3D.Systems.Storage.Containers; using UnityEngine; using UnityEngine.Assertions; +using UnityEngine.Serialization; namespace SS3D.Systems.Storage.UI { @@ -12,11 +16,13 @@ namespace SS3D.Systems.Storage.UI /// It handles displaying all the containers opened by the player, and removing the display when a container is closed. /// It includes containers such as the one in the world the player interact with (toolbox, lockers) as well as the one /// - public class InventoryUi : MonoBehaviour + public class InventoryView : View { - [NonSerialized] public Inventory Inventory; - public HandsUi HandsUi; + + public HandsView HandsView; + public PocketView PocketView; + public GameObject PocketPrefab; public Transform PocketParent; /// @@ -24,19 +30,34 @@ public class InventoryUi : MonoBehaviour /// public GameObject ContainerUiPrefab; + [SerializeField] private GameObject _uiPanel; + private readonly List _containerDisplays = new(); - + // Maybe HandsUI should only handle selected hand highlight and inventory UI // should handle setting up containers to UI. - public void Start() + public void Setup() { - Assert.IsNotNull(HandsUi); + Assert.IsNotNull(HandsView); Assert.IsNotNull(Inventory); - HandsUi.Hands = Inventory.Hands; + HandsView.Hands = Inventory.Hands; - Inventory.ContainerOpened += InventoryOnContainerOpened; - Inventory.ContainerClosed += InventoryOnContainerClosed; + Inventory.OnContainerOpened += InventoryOnContainerOpened; + Inventory.OnContainerClosed += InventoryOnContainerClosed; + + PocketView pocketView = ViewLocator.Get().First(); + pocketView.Inventory = Inventory; + pocketView.Setup(); + } + + /// + /// Sets the UI enabled. + /// + /// + public void Enable(bool enabled) + { + _uiPanel.SetActive(enabled); } /// @@ -77,17 +98,5 @@ private void InventoryOnContainerOpened(AttachedContainer container) containerUi.Inventory = Inventory; _containerDisplays.Add(new ContainerDisplay(ui, container)); } - - private struct ContainerDisplay - { - public GameObject UiElement; - public AttachedContainer Container; - - public ContainerDisplay(GameObject uiElement, AttachedContainer container) - { - UiElement = uiElement; - Container = container; - } - } } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Storage/UI/InventoryUi.cs.meta b/Assets/Scripts/SS3D/Systems/Storage/UI/InventoryView.cs.meta similarity index 100% rename from Assets/Scripts/SS3D/Systems/Storage/UI/InventoryUi.cs.meta rename to Assets/Scripts/SS3D/Systems/Storage/UI/InventoryView.cs.meta diff --git a/Assets/Scripts/SS3D/Systems/Storage/UI/PocketView.cs b/Assets/Scripts/SS3D/Systems/Storage/UI/PocketView.cs index a90fdced37..d9fc7b7a3c 100644 --- a/Assets/Scripts/SS3D/Systems/Storage/UI/PocketView.cs +++ b/Assets/Scripts/SS3D/Systems/Storage/UI/PocketView.cs @@ -1,56 +1,52 @@ -using SS3D.Systems.Storage.Containers; -using SS3D.Systems.Storage.UI; using System; -using System.Collections; using System.Collections.Generic; +using System.Linq; +using SS3D.Core.Behaviours; +using SS3D.Systems.Storage.Containers; using UnityEngine; +using UnityEngine.Serialization; - - -/// -/// Handle setting up the UI of pocket containers. -/// -public class PocketView : MonoBehaviour +namespace SS3D.Systems.Storage.UI { - [NonSerialized] - public Inventory Inventory; - public GameObject PocketPrefab; - public GameObject DummyLeftPocketViewGameObject; - public GameObject DummyRightPocketViewGameObject; - // Start is called before the first frame update - void Start() + /// + /// Handle setting up the UI of pocket containers. + /// + public class PocketView : View { - SetUpPocketUI(); - } + [NonSerialized] + public Inventory Inventory; + public GameObject PocketPrefab; - private void SetUpPocketUI() - { - // Remove dummy slots in the prefab HumanoidInventory - DestroyImmediate(DummyRightPocketViewGameObject); - DestroyImmediate(DummyLeftPocketViewGameObject); - - // Find all containers with type Pocket on the Human prefab. - var InventoryContainers = Inventory.gameObject.GetComponentsInChildren(); - var PocketContainers = new List(); - foreach (var container in InventoryContainers) - { - if (container.ContainerType is ContainerType.Pocket) - PocketContainers.Add(container); - } - if (PocketContainers.Count == 0) - { - throw new ApplicationException("no container of type pocket is present on " + - "the inventory's game object or any of it's children."); - } + public Transform TransformParent; - // Set up the container that each pocket display. - foreach (var container in PocketContainers) + [FormerlySerializedAs("DummyLeftPocketViewGameObject")] public GameObject LeftPocketGameObject; + [FormerlySerializedAs("DummyRightPocketViewGameObject")] public GameObject RightPocketGameObject; + + public void Setup() { - var attachedContainer = container.AttachedContainer; - GameObject handElement = Instantiate(PocketPrefab, transform, false); - SingleItemContainerSlot slot = handElement.GetComponent(); - slot.Inventory = Inventory; - slot.Container = attachedContainer; + // Remove dummy slots in the prefab HumanoidInventory + DestroyImmediate(RightPocketGameObject); + DestroyImmediate(LeftPocketGameObject); + + // Find all containers with type Pocket on the Human prefab. + ContainerDescriptor[] inventoryContainers = Inventory.GetComponentsInChildren(true); + List pocketContainers = inventoryContainers.Where(container => container.Type is ContainerType.Pocket).ToList(); + + if (pocketContainers.Count == 0) + { + throw new ApplicationException("no container of type pocket is present on " + "the inventory's game object or any of it's children."); + } + + // Set up the container that each pocket display. + foreach (ContainerDescriptor container in pocketContainers) + { + AttachedContainer attachedContainer = container.AttachedContainer; + GameObject handElement = Instantiate(PocketPrefab, TransformParent, false); + + SingleItemContainerSlot slot = handElement.GetComponent(); + slot.Inventory = Inventory; + slot.Container = attachedContainer; + } } } } diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 1b33594878..d0a337b0f5 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -42,7 +42,7 @@ PlayerSettings: m_SplashScreenLogos: - logo: {fileID: 10404, guid: 0000000000000000e000000000000000, type: 0} duration: 3.7 - m_VirtualRealitySplashScreen: {fileID: 2800000, guid: bba52a77a645ac047b0869dd1c553457, type: 3} + m_VirtualRealitySplashScreen: {fileID: 2800000, guid: dfdc99339da4f3d45b058a426ba8d516, type: 3} m_HolographicTrackingLossScreen: {fileID: 0} defaultScreenWidth: 700 defaultScreenHeight: 700 @@ -586,8 +586,8 @@ PlayerSettings: ps4IncludedModules: [] ps4attribVROutputEnabled: 0 monoEnv: - splashScreenBackgroundSourceLandscape: {fileID: 21300000, guid: bba52a77a645ac047b0869dd1c553457, type: 3} - splashScreenBackgroundSourcePortrait: {fileID: 21300000, guid: ff2bd0879ba14cb499c8687f790834c7, type: 3} + splashScreenBackgroundSourceLandscape: {fileID: 21300000, guid: ebb09abadcceab143b95752e9ebd7f3f, type: 3} + splashScreenBackgroundSourcePortrait: {fileID: 21300000, guid: 9c970d03094536c42bec4cb20c86aa1c, type: 3} blurSplashScreenBackground: 0 spritePackerPolicy: webGLMemorySize: 16 diff --git a/SS3D.sln.DotSettings b/SS3D.sln.DotSettings index cbd1815fc3..4047df2f03 100644 --- a/SS3D.sln.DotSettings +++ b/SS3D.sln.DotSettings @@ -7,9 +7,13 @@ True True True + True + True True True True True True - True \ No newline at end of file + True + True + True \ No newline at end of file