From c990480bfb3022ae76b88790920f923ff65a9e53 Mon Sep 17 00:00:00 2001 From: ShutovKS Date: Wed, 24 May 2023 00:39:16 +0300 Subject: [PATCH] Refactor all project scripts --- .github/workflows/qodana_code_quality.yml | 20 + .../Data/Prefabs/Map/MainLocationMap.prefab | 216 +- .../Data/Prefabs/Objects/Weapon/Hammer.prefab | 5 + .../Data/Prefabs/Objects/Weapon/Sword.prefab | 5 + .../Prefabs/Screens/MainMenuScreen.prefab | 34 +- .../Screens/MenuInDungeonRoomScreen.prefab | 2 +- .../Screens/MenuInMainLocationScreen.prefab | 10 +- .../Prefabs/Screens/SkillsBookScreen.prefab | 2 +- Assets/Data/Prefabs/Units/Player.prefab | 86 +- .../Data/Settings/MainLocationSettings.asset | 16 +- Assets/Data/Settings/MainMenuSettings.asset | 4 +- .../SkillStatic_ HEALTH_Count.asset | 2 +- .../SkillStatic_ HEALTH_Percent.asset | 2 +- .../SkillStatic_ PROCTION_Count.asset | 2 +- .../SkillStatic_ PROCTION_Percent.asset | 2 +- .../SkillStatic_ STREANGHT_Count.asset | 2 +- .../SkillStatic_ STREANGHT_Percent.asset | 2 +- .../Editor/Plugin.cs | 6 +- .../Training_dummy/Mesh/idle.anim | 2 +- .../Training_dummy/Mesh/restart.anim | 18 +- .../Mesh/training_dummy.fbx.meta | 5 +- .../Scripts/BuildSetting/GameObjectDisable.cs | 8 +- ...tants.cs => AssetsAddressableConstants.cs} | 61 +- ...eta => AssetsAddressableConstants.cs.meta} | 0 .../Data/Dynamic/Location/CurrentLocation.cs | 10 +- .../{DungeonRoom.cs => DungeonLocation.cs} | 16 +- ...onRoom.cs.meta => DungeonLocation.cs.meta} | 0 .../Scripts/Data/Dynamic/Loot/LootData.cs | 16 +- .../Data/Dynamic/Player/SelectedWeapon.cs | 10 +- .../Scripts/Data/Dynamic/Player/SkillEntry.cs | 18 +- .../Data/Dynamic/Player/SkillsLevel.cs | 33 +- .../Scripts/Data/Dynamic/Progress.cs | 12 +- .../{Settings.meta => LocationSettings.meta} | 0 .../LocationSettings/DungeonRoomSettings.cs | 16 + .../DungeonRoomSettings.cs.meta | 0 .../Data/LocationSettings/LocationSettings.cs | 12 + .../LocationSettings.cs.meta} | 0 .../LocationSettings/MainLocationSettings.cs | 36 + .../MainLocationSettings.cs.meta | 0 .../Data/LocationSettings/MainMenuSettings.cs | 20 + .../MainMenuSettings.cs.meta | 0 .../Scripts/Data/Settings/BaseSettings.cs | 8 - .../Data/Settings/DungeonRoomSettings.cs | 10 - .../Data/Settings/MainLocationSettings.cs | 21 - .../Scripts/Data/Settings/MainMenuSettings.cs | 14 - .../Scripts/Data/Static/EnemyStaticData.cs | 35 +- .../Data/Static/PlayerStaticDefaultData.cs | 12 +- .../Scripts/Data/Static/SkillStaticData.cs | 30 +- .../Scripts/Data/Static/StaticData.cs | 12 + .../Scripts/Data/Static/StaticData.cs.meta | 3 + .../Scripts/Dummy/DummyController.cs | 70 +- .../Scripts/Dummy/DummyGetHit.cs | 33 + .../Scripts/Dummy/DummyGetHit.cs.meta | 3 + .../Scripts/Dummy/DummyUpdateCollider.cs | 79 + ...sh.cs.meta => DummyUpdateCollider.cs.meta} | 0 .../Scripts/Dummy/DummyUpdateMesh.cs | 93 - .../DungeonGenerator/DungeonGenerator.cs | 218 +- .../DungeonRoomCharacteristic.cs | 12 +- .../DungeonGenerator/DungeonTilesType.cs | 9 - .../DungeonGenerator/DungeonTilesType.cs.meta | 3 - .../DungeonGenerator/Tiles/EmptyTile.cs | 9 +- .../DungeonGenerator/Tiles/FloorTile.cs | 9 +- .../DungeonGenerator/Tiles/Interface/ITile.cs | 3 +- .../DungeonGenerator/Tiles/WallTile.cs | 9 +- .../AbstractFactory/AbstractFactory.cs | 32 +- .../AbstractFactory/IAbstractFactory.cs | 15 +- .../AbstractFactory/IAbstractFactoryInfo.cs | 10 +- .../Factory/EnemyFactory/EnemyFactory.cs | 29 +- .../Factory/EnemyFactory/IEnemyFactory.cs | 14 +- .../Factory/EnemyFactory/IEnemyFactoryInfo.cs | 9 +- .../Scripts/Infrastructure/Factory/Model.meta | 3 - .../Infrastructure/Factory/Model/IFactory.cs | 12 - .../Factory/Model/IFactory.cs.meta | 3 - .../Factory/PlayerFactory/IPlayerFactory.cs | 8 +- .../PlayerFactory/IPlayerFactoryInfo.cs | 8 +- .../Factory/PlayerFactory/PlayerFactory.cs | 10 +- .../Factory/UIFactory/IUIFactory.cs | 12 +- .../Factory/UIFactory/IUIInfo.cs | 6 +- .../Factory/UIFactory/UIFactory.cs | 18 +- .../GlobalStateMachine/GameInstance.cs | 59 +- .../StateMachine/BaseState.cs | 16 +- .../GlobalStateMachine/StateMachine/State.cs | 11 +- .../StateMachine/StateMachine.cs | 56 +- .../StateMachine/StateWithParam.cs | 11 +- .../States/BootstrapState.cs | 13 +- ...e.cs => DungeonLocationGenerationState.cs} | 102 +- ...=> DungeonLocationGenerationState.cs.meta} | 0 ...pState.cs => DungeonLocationSetUpState.cs} | 441 +-- ...meta => DungeonLocationSetUpState.cs.meta} | 0 ...onRoomState.cs => DungeonLocationState.cs} | 189 +- ...e.cs.meta => DungeonLocationState.cs.meta} | 0 .../Intermediate/LoadLastSavedLocation.cs | 42 - .../LoadLastSavedLocationState.cs | 50 + ...eta => LoadLastSavedLocationState.cs.meta} | 0 .../Intermediate/ProgressLoadingState.cs | 27 +- ...ressData.cs => RemoveProgressDataState.cs} | 15 +- ...s.meta => RemoveProgressDataState.cs.meta} | 0 .../States/Intermediate/SceneLoadingState.cs | 14 +- .../MainLocation/MainLocationSetUpState.cs | 158 +- .../States/MainLocation/MainLocationState.cs | 48 +- .../States/MainMenu/MainMenuSetUpState.cs | 34 +- .../States/MainMenu/MainMenuState.cs | 36 +- .../Installers/GameInstanceInstaller.cs | 27 +- .../Installers/ServiceInstaller.cs | 41 +- .../{StatesInstaller.cs => StateInstaller.cs} | 40 +- ...staller.cs.meta => StateInstaller.cs.meta} | 0 .../Scripts/Item/Interface/IItemDamage.cs | 11 +- .../Scripts/Item/Interface/IWeaponManager.cs | 19 - .../Item/{Interface => Weapon}/IWeapon.cs | 16 +- .../{Interface => Weapon}/IWeapon.cs.meta | 0 .../Scripts/Item/Weapon/Weapon.cs | 40 +- .../Item/Weapon/WeaponManagerDungeonRoom.cs | 70 - .../Item/Weapon/WeaponManagerMainLocation.cs | 72 - .../Scripts/Item/Weapon/WeaponType.cs | 8 +- .../Scripts/Item/WeaponManager.meta | 3 + .../Item/WeaponManager/IWeaponManager.cs | 23 + .../IWeaponManager.cs.meta | 0 .../WeaponManager/WeaponManagerDungeonRoom.cs | 73 + .../WeaponManagerDungeonRoom.cs.meta | 0 .../WeaponManagerMainLocation.cs | 82 + .../WeaponManagerMainLocation.cs.meta | 0 .../Scripts/Loot/LootManager.cs | 43 +- .../Scripts/Portal/PortalTrigger.cs | 21 - .../AssetsAddressableService.cs | 20 +- .../IAssetsAddressableService.cs | 9 +- .../IPersistentProgressService.cs | 12 +- .../PersistentProgress/IProgressLoadable.cs | 9 - .../PersistentProgress/IProgressSavable.cs | 9 - .../PersistentProgressService.cs | 8 +- .../Services/SaveLoad/ISaveLoadService.cs | 9 +- .../Services/SaveLoad/SaveLoadService.cs | 12 +- .../Services/StaticData/IStaticDataService.cs | 8 +- .../Services/StaticData/StaticDataService.cs | 21 +- .../Watchers/PersistentProgressWatcher.meta | 3 + .../IProgressLoadableWatcher.cs | 13 + .../IProgressLoadableWatcher.cs.meta} | 0 .../IProgressSavableWatcher.cs | 13 + .../IProgressSavableWatcher.cs.meta} | 0 .../ISaveLoadInstancesWatcher.cs | 20 +- .../SaveLoadInstancesWatcher.cs | 58 +- .../Scripts/Skill/SkillType.cs | 14 +- .../Scripts/Skill/SkillsBook.cs | 82 - .../Scripts/Skill/SkillsManager.cs | 69 + ...illsBook.cs.meta => SkillsManager.cs.meta} | 0 .../Scripts/Socket/FollowThePlayer.cs | 21 + ...Player.cs.meta => FollowThePlayer.cs.meta} | 0 .../Scripts/Socket/SocketInPlayer.meta | 8 - .../SocketInPlayer/RotationForwardPlayer.cs | 15 - ...ortal.meta => TransitionToTheDungeon.meta} | 0 .../TransitionToTheDungeonTrigger.cs | 34 + .../TransitionToTheDungeonTrigger.cs.meta} | 0 ...reen.cs => MenuInDungeonLocationScreen.cs} | 6 +- ...ta => MenuInDungeonLocationScreen.cs.meta} | 0 .../MainLocation/MenuInMainLocationScreen.cs | 8 +- .../Scripts/UI/MainLocation/SkillScreen.cs | 22 +- .../UI/MainLocation/SkillsBookScreen.cs | 57 +- .../Scripts/UI/MainMenu/MainMenuScreen.cs | 58 +- .../Scripts/Units/Enemy/Enemy.cs | 159 +- .../Scripts/Units/Enemy/EnemyDamage.cs | 17 +- .../Scripts/Units/Enemy/EnemyGetHit.cs | 14 +- .../Scripts/Units/Enemy/EnemyType.cs | 4 +- .../Scripts/Units/Enemy/Side.cs | 8 + .../Scripts/Units/Enemy/Side.cs.meta | 3 + .../Units/Enemy/State Machines/IState.cs | 2 +- .../Enemy/State Machines/State/Attack.cs | 89 +- .../State Machines/State/CombatReadiness.cs | 36 +- .../Units/Enemy/State Machines/State/Dead.cs | 43 +- .../Enemy/State Machines/State/GetHit.cs | 46 +- .../State Machines/State/MoveToPlayer.cs | 44 +- .../Enemy/State Machines/State/Patrol.cs | 47 +- .../State/SearchPositionForPatrol.cs | 34 +- .../Enemy/State Machines/StateMachine.cs | 79 +- .../Units/Enemy/State Machines/Transition.cs | 15 + .../Enemy/State Machines/Transition.cs.meta | 3 + .../Scripts/Units/Player/EnemyDetector.cs | 13 +- .../Scripts/Units/Player/FireInHand.cs | 16 +- .../Units/Player/HandAnimatorController.cs | 29 + .../Player}/HandAnimatorController.cs.meta | 0 .../Scripts/Units/Player/Player.cs | 61 +- .../Scripts/Units/Player/PlayerGetHit.cs | 20 +- ...actorTrigger.cs => GazeInteractTrigger.cs} | 18 +- ...er.cs.meta => GazeInteractTrigger.cs.meta} | 0 Assets/Internal assets/Scripts/XR/Hand.meta | 3 - .../Scripts/XR/Hand/HandAnimatorController.cs | 26 - Assets/Resources/ProjectContext.prefab | 10 +- .../XRI Default Input Actions.cs | 3310 +++++++++++++++++ .../XRI Default Input Actions.cs.meta | 11 + ...RI Default Input Actions.inputactions.meta | 2 +- qodana.yaml | 26 + 189 files changed, 6178 insertions(+), 2134 deletions(-) create mode 100644 .github/workflows/qodana_code_quality.yml rename Assets/Internal assets/Scripts/Data/Addressable/{AssetsAddressablesConstants.cs => AssetsAddressableConstants.cs} (92%) rename Assets/Internal assets/Scripts/Data/Addressable/{AssetsAddressablesConstants.cs.meta => AssetsAddressableConstants.cs.meta} (100%) rename Assets/Internal assets/Scripts/Data/Dynamic/Location/{DungeonRoom.cs => DungeonLocation.cs} (63%) rename Assets/Internal assets/Scripts/Data/Dynamic/Location/{DungeonRoom.cs.meta => DungeonLocation.cs.meta} (100%) rename Assets/Internal assets/Scripts/Data/{Settings.meta => LocationSettings.meta} (100%) create mode 100644 Assets/Internal assets/Scripts/Data/LocationSettings/DungeonRoomSettings.cs rename Assets/Internal assets/Scripts/Data/{Settings => LocationSettings}/DungeonRoomSettings.cs.meta (100%) create mode 100644 Assets/Internal assets/Scripts/Data/LocationSettings/LocationSettings.cs rename Assets/Internal assets/Scripts/Data/{Settings/BaseSettings.cs.meta => LocationSettings/LocationSettings.cs.meta} (100%) create mode 100644 Assets/Internal assets/Scripts/Data/LocationSettings/MainLocationSettings.cs rename Assets/Internal assets/Scripts/Data/{Settings => LocationSettings}/MainLocationSettings.cs.meta (100%) create mode 100644 Assets/Internal assets/Scripts/Data/LocationSettings/MainMenuSettings.cs rename Assets/Internal assets/Scripts/Data/{Settings => LocationSettings}/MainMenuSettings.cs.meta (100%) delete mode 100644 Assets/Internal assets/Scripts/Data/Settings/BaseSettings.cs delete mode 100644 Assets/Internal assets/Scripts/Data/Settings/DungeonRoomSettings.cs delete mode 100644 Assets/Internal assets/Scripts/Data/Settings/MainLocationSettings.cs delete mode 100644 Assets/Internal assets/Scripts/Data/Settings/MainMenuSettings.cs create mode 100644 Assets/Internal assets/Scripts/Data/Static/StaticData.cs create mode 100644 Assets/Internal assets/Scripts/Data/Static/StaticData.cs.meta create mode 100644 Assets/Internal assets/Scripts/Dummy/DummyGetHit.cs create mode 100644 Assets/Internal assets/Scripts/Dummy/DummyGetHit.cs.meta create mode 100644 Assets/Internal assets/Scripts/Dummy/DummyUpdateCollider.cs rename Assets/Internal assets/Scripts/Dummy/{DummyUpdateMesh.cs.meta => DummyUpdateCollider.cs.meta} (100%) delete mode 100644 Assets/Internal assets/Scripts/Dummy/DummyUpdateMesh.cs delete mode 100644 Assets/Internal assets/Scripts/DungeonGenerator/DungeonTilesType.cs delete mode 100644 Assets/Internal assets/Scripts/DungeonGenerator/DungeonTilesType.cs.meta delete mode 100644 Assets/Internal assets/Scripts/Infrastructure/Factory/Model.meta delete mode 100644 Assets/Internal assets/Scripts/Infrastructure/Factory/Model/IFactory.cs delete mode 100644 Assets/Internal assets/Scripts/Infrastructure/Factory/Model/IFactory.cs.meta rename Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/{DungeonRoomGenerationState.cs => DungeonLocationGenerationState.cs} (51%) rename Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/{DungeonRoomGenerationState.cs.meta => DungeonLocationGenerationState.cs.meta} (100%) rename Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/{DungeonRoomSetUpState.cs => DungeonLocationSetUpState.cs} (74%) rename Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/{DungeonRoomSetUpState.cs.meta => DungeonLocationSetUpState.cs.meta} (100%) rename Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/{DungeonRoomState.cs => DungeonLocationState.cs} (59%) rename Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/{DungeonRoomState.cs.meta => DungeonLocationState.cs.meta} (100%) delete mode 100644 Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/LoadLastSavedLocation.cs create mode 100644 Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/LoadLastSavedLocationState.cs rename Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/{LoadLastSavedLocation.cs.meta => LoadLastSavedLocationState.cs.meta} (100%) rename Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/{RemoveProgressData.cs => RemoveProgressDataState.cs} (56%) rename Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/{RemoveProgressData.cs.meta => RemoveProgressDataState.cs.meta} (100%) rename Assets/Internal assets/Scripts/Infrastructure/Installers/{StatesInstaller.cs => StateInstaller.cs} (84%) rename Assets/Internal assets/Scripts/Infrastructure/Installers/{StatesInstaller.cs.meta => StateInstaller.cs.meta} (100%) delete mode 100644 Assets/Internal assets/Scripts/Item/Interface/IWeaponManager.cs rename Assets/Internal assets/Scripts/Item/{Interface => Weapon}/IWeapon.cs (63%) rename Assets/Internal assets/Scripts/Item/{Interface => Weapon}/IWeapon.cs.meta (100%) delete mode 100644 Assets/Internal assets/Scripts/Item/Weapon/WeaponManagerDungeonRoom.cs delete mode 100644 Assets/Internal assets/Scripts/Item/Weapon/WeaponManagerMainLocation.cs create mode 100644 Assets/Internal assets/Scripts/Item/WeaponManager.meta create mode 100644 Assets/Internal assets/Scripts/Item/WeaponManager/IWeaponManager.cs rename Assets/Internal assets/Scripts/Item/{Interface => WeaponManager}/IWeaponManager.cs.meta (100%) create mode 100644 Assets/Internal assets/Scripts/Item/WeaponManager/WeaponManagerDungeonRoom.cs rename Assets/Internal assets/Scripts/Item/{Weapon => WeaponManager}/WeaponManagerDungeonRoom.cs.meta (100%) create mode 100644 Assets/Internal assets/Scripts/Item/WeaponManager/WeaponManagerMainLocation.cs rename Assets/Internal assets/Scripts/Item/{Weapon => WeaponManager}/WeaponManagerMainLocation.cs.meta (100%) delete mode 100644 Assets/Internal assets/Scripts/Portal/PortalTrigger.cs delete mode 100644 Assets/Internal assets/Scripts/Services/PersistentProgress/IProgressLoadable.cs delete mode 100644 Assets/Internal assets/Scripts/Services/PersistentProgress/IProgressSavable.cs create mode 100644 Assets/Internal assets/Scripts/Services/Watchers/PersistentProgressWatcher.meta create mode 100644 Assets/Internal assets/Scripts/Services/Watchers/PersistentProgressWatcher/IProgressLoadableWatcher.cs rename Assets/Internal assets/Scripts/Services/{PersistentProgress/IProgressLoadable.cs.meta => Watchers/PersistentProgressWatcher/IProgressLoadableWatcher.cs.meta} (100%) create mode 100644 Assets/Internal assets/Scripts/Services/Watchers/PersistentProgressWatcher/IProgressSavableWatcher.cs rename Assets/Internal assets/Scripts/Services/{PersistentProgress/IProgressSavable.cs.meta => Watchers/PersistentProgressWatcher/IProgressSavableWatcher.cs.meta} (100%) delete mode 100644 Assets/Internal assets/Scripts/Skill/SkillsBook.cs create mode 100644 Assets/Internal assets/Scripts/Skill/SkillsManager.cs rename Assets/Internal assets/Scripts/Skill/{SkillsBook.cs.meta => SkillsManager.cs.meta} (100%) create mode 100644 Assets/Internal assets/Scripts/Socket/FollowThePlayer.cs rename Assets/Internal assets/Scripts/Socket/{SocketInPlayer/RotationForwardPlayer.cs.meta => FollowThePlayer.cs.meta} (100%) delete mode 100644 Assets/Internal assets/Scripts/Socket/SocketInPlayer.meta delete mode 100644 Assets/Internal assets/Scripts/Socket/SocketInPlayer/RotationForwardPlayer.cs rename Assets/Internal assets/Scripts/{Portal.meta => TransitionToTheDungeon.meta} (100%) create mode 100644 Assets/Internal assets/Scripts/TransitionToTheDungeon/TransitionToTheDungeonTrigger.cs rename Assets/Internal assets/Scripts/{Portal/PortalTrigger.cs.meta => TransitionToTheDungeon/TransitionToTheDungeonTrigger.cs.meta} (100%) rename Assets/Internal assets/Scripts/UI/DungeonRoom/{MenuInDungeonRoomScreen.cs => MenuInDungeonLocationScreen.cs} (78%) rename Assets/Internal assets/Scripts/UI/DungeonRoom/{MenuInDungeonRoomScreen.cs.meta => MenuInDungeonLocationScreen.cs.meta} (100%) create mode 100644 Assets/Internal assets/Scripts/Units/Enemy/Side.cs create mode 100644 Assets/Internal assets/Scripts/Units/Enemy/Side.cs.meta create mode 100644 Assets/Internal assets/Scripts/Units/Enemy/State Machines/Transition.cs create mode 100644 Assets/Internal assets/Scripts/Units/Enemy/State Machines/Transition.cs.meta create mode 100644 Assets/Internal assets/Scripts/Units/Player/HandAnimatorController.cs rename Assets/Internal assets/Scripts/{XR/Hand => Units/Player}/HandAnimatorController.cs.meta (100%) rename Assets/Internal assets/Scripts/XR/{GazeInteractorTrigger.cs => GazeInteractTrigger.cs} (71%) rename Assets/Internal assets/Scripts/XR/{GazeInteractorTrigger.cs.meta => GazeInteractTrigger.cs.meta} (100%) delete mode 100644 Assets/Internal assets/Scripts/XR/Hand.meta delete mode 100644 Assets/Internal assets/Scripts/XR/Hand/HandAnimatorController.cs create mode 100644 Assets/Samples/XR Interaction Toolkit/2.3.2/Starter Assets/XRI Default Input Actions.cs create mode 100644 Assets/Samples/XR Interaction Toolkit/2.3.2/Starter Assets/XRI Default Input Actions.cs.meta create mode 100644 qodana.yaml diff --git a/.github/workflows/qodana_code_quality.yml b/.github/workflows/qodana_code_quality.yml new file mode 100644 index 0000000..d302ee2 --- /dev/null +++ b/.github/workflows/qodana_code_quality.yml @@ -0,0 +1,20 @@ +name: Qodana +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + - 'releases/*' + +jobs: + qodana: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: 'Qodana Scan' + uses: JetBrains/qodana-action@v2022.3.4 + env: + QODANA_TOKEN: ${{ eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb24iOiIzalBHaiIsInByb2plY3QiOiJ6OEROYiIsInRva2VuIjoiM0tnN3kifQ.giGvcFi2B9vlN6Sb7fS7vSQeWfOJo6Fu32kfw9lOFZI }} \ No newline at end of file diff --git a/Assets/Data/Prefabs/Map/MainLocationMap.prefab b/Assets/Data/Prefabs/Map/MainLocationMap.prefab index 685223b..efd3581 100644 --- a/Assets/Data/Prefabs/Map/MainLocationMap.prefab +++ b/Assets/Data/Prefabs/Map/MainLocationMap.prefab @@ -15771,6 +15771,11 @@ PrefabInstance: propertyPath: m_StaticEditorFlags value: 2147483647 objectReference: {fileID: 0} + - target: {fileID: 7077608692380533153, guid: 0331b169005eb1d469455efaa6b9024a, + type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} - target: {fileID: 7077608692380533153, guid: 0331b169005eb1d469455efaa6b9024a, type: 3} propertyPath: m_StaticEditorFlags @@ -15848,22 +15853,62 @@ PrefabInstance: type: 3} insertIndex: -1 addedObject: {fileID: 7091893654584596044} + - targetCorrespondingSourceObject: {fileID: 7533163476571990239, guid: 0331b169005eb1d469455efaa6b9024a, + type: 3} + insertIndex: -1 + addedObject: {fileID: 6727792454400736346} + - targetCorrespondingSourceObject: {fileID: 7533163476571990239, guid: 0331b169005eb1d469455efaa6b9024a, + type: 3} + insertIndex: -1 + addedObject: {fileID: 5463601070823579132} - targetCorrespondingSourceObject: {fileID: 7206035749426561629, guid: 0331b169005eb1d469455efaa6b9024a, type: 3} insertIndex: -1 addedObject: {fileID: 1196701173507966562} + - targetCorrespondingSourceObject: {fileID: 7206035749426561629, guid: 0331b169005eb1d469455efaa6b9024a, + type: 3} + insertIndex: -1 + addedObject: {fileID: 4729350620202220088} + - targetCorrespondingSourceObject: {fileID: 7206035749426561629, guid: 0331b169005eb1d469455efaa6b9024a, + type: 3} + insertIndex: -1 + addedObject: {fileID: 7724988574645216629} - targetCorrespondingSourceObject: {fileID: 8500709513404734051, guid: 0331b169005eb1d469455efaa6b9024a, type: 3} insertIndex: -1 addedObject: {fileID: 8127901522580427886} + - targetCorrespondingSourceObject: {fileID: 8500709513404734051, guid: 0331b169005eb1d469455efaa6b9024a, + type: 3} + insertIndex: -1 + addedObject: {fileID: 4846876152498066302} + - targetCorrespondingSourceObject: {fileID: 8500709513404734051, guid: 0331b169005eb1d469455efaa6b9024a, + type: 3} + insertIndex: -1 + addedObject: {fileID: 5963192163857627636} - targetCorrespondingSourceObject: {fileID: 7077608692380533153, guid: 0331b169005eb1d469455efaa6b9024a, type: 3} insertIndex: -1 addedObject: {fileID: 8538844825399663403} + - targetCorrespondingSourceObject: {fileID: 7077608692380533153, guid: 0331b169005eb1d469455efaa6b9024a, + type: 3} + insertIndex: -1 + addedObject: {fileID: 7808566519823213785} + - targetCorrespondingSourceObject: {fileID: 7077608692380533153, guid: 0331b169005eb1d469455efaa6b9024a, + type: 3} + insertIndex: -1 + addedObject: {fileID: 8123341173610717933} - targetCorrespondingSourceObject: {fileID: 4246267861249761399, guid: 0331b169005eb1d469455efaa6b9024a, type: 3} insertIndex: -1 addedObject: {fileID: 2951473582694144941} + - targetCorrespondingSourceObject: {fileID: 4246267861249761399, guid: 0331b169005eb1d469455efaa6b9024a, + type: 3} + insertIndex: -1 + addedObject: {fileID: 7391763640068121022} + - targetCorrespondingSourceObject: {fileID: 4246267861249761399, guid: 0331b169005eb1d469455efaa6b9024a, + type: 3} + insertIndex: -1 + addedObject: {fileID: 5718771609426394780} - targetCorrespondingSourceObject: {fileID: 6973413696058740841, guid: 0331b169005eb1d469455efaa6b9024a, type: 3} insertIndex: 1 @@ -15942,6 +15987,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 98d31a2c1244cc041a3567d44e94811b, type: 3} m_Name: m_EditorClassIdentifier: + healthMax: 1000 + timeRestart: 3.5 --- !u!114 &7120039917897407876 MonoBehaviour: m_ObjectHideFlags: 0 @@ -16002,6 +16049,39 @@ BoxCollider: serializedVersion: 3 m_Size: {x: 0.004193967, y: 0.006935526, z: 0.0035104011} m_Center: {x: 0.00008984996, y: 0.01112173, z: 0.0005882435} +--- !u!65 &6727792454400736346 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2710378096610880290} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 1 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 0.005, y: 0.0075, z: 0.004} + m_Center: {x: 0.00008984996, y: 0.01112173, z: 0.0005882435} +--- !u!114 &5463601070823579132 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2710378096610880290} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: eaee59315ea74a7293cf12dfb450d2b2, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &2960806230944022944 stripped GameObject: m_CorrespondingSourceObject: {fileID: 7206035749426561629, guid: 0331b169005eb1d469455efaa6b9024a, @@ -16029,6 +16109,39 @@ BoxCollider: serializedVersion: 3 m_Size: {x: 0.0015073447, y: 0.015451378, z: 0.0010721182} m_Center: {x: 0.00019604339, y: -0.000120419885, z: 0.00062472327} +--- !u!65 &4729350620202220088 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2960806230944022944} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 1 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 0.002, y: 0.016, z: 0.00125} + m_Center: {x: 0.00019604339, y: -0.000120419885, z: 0.00062472327} +--- !u!114 &7724988574645216629 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2960806230944022944} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: eaee59315ea74a7293cf12dfb450d2b2, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &3301301317230941076 stripped GameObject: m_CorrespondingSourceObject: {fileID: 6973413696058740841, guid: 0331b169005eb1d469455efaa6b9024a, @@ -16069,7 +16182,40 @@ BoxCollider: m_Enabled: 1 serializedVersion: 3 m_Size: {x: 0.0013220216, y: 0.0074456143, z: 0.000465158} - m_Center: {x: 0.000103979815, y: 0.003082599, z: 0.00015868343} + m_Center: {x: 0.000103979815, y: 0.003082599, z: 0} +--- !u!65 &7808566519823213785 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3399840975541469788} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 1 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 0.0015, y: 0.008, z: 0.00065} + m_Center: {x: 0.000103979815, y: 0.003082599, z: 0} +--- !u!114 &8123341173610717933 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3399840975541469788} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: eaee59315ea74a7293cf12dfb450d2b2, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &4102366403619543454 stripped GameObject: m_CorrespondingSourceObject: {fileID: 8500709513404734051, guid: 0331b169005eb1d469455efaa6b9024a, @@ -16097,6 +16243,39 @@ BoxCollider: serializedVersion: 3 m_Size: {x: 0.0016701461, y: 0.006366039, z: 0.004931135} m_Center: {x: 0.00066603854, y: -0.0013638624, z: 0.00015869568} +--- !u!65 &4846876152498066302 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4102366403619543454} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 1 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 0.00225, y: 0.0065, z: 0.00525} + m_Center: {x: 0.00066603854, y: -0.0013638624, z: 0.00015869568} +--- !u!114 &5963192163857627636 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4102366403619543454} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: eaee59315ea74a7293cf12dfb450d2b2, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &6039826222361484052 stripped GameObject: m_CorrespondingSourceObject: {fileID: 2217982354390685929, guid: 0331b169005eb1d469455efaa6b9024a, @@ -16155,6 +16334,41 @@ CapsuleCollider: m_Height: 0 m_Direction: 1 m_Center: {x: 0, y: 0.001, z: 0} +--- !u!136 &7391763640068121022 +CapsuleCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8645742359902659466} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 1 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 0.00265 + m_Height: 0 + m_Direction: 1 + m_Center: {x: 0, y: 0.001, z: 0} +--- !u!114 &5718771609426394780 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8645742359902659466} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: eaee59315ea74a7293cf12dfb450d2b2, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1001 &5602396367553309814 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Data/Prefabs/Objects/Weapon/Hammer.prefab b/Assets/Data/Prefabs/Objects/Weapon/Hammer.prefab index a020c48..b5a1805 100644 --- a/Assets/Data/Prefabs/Objects/Weapon/Hammer.prefab +++ b/Assets/Data/Prefabs/Objects/Weapon/Hammer.prefab @@ -13,6 +13,11 @@ PrefabInstance: propertyPath: weaponType value: 1 objectReference: {fileID: 0} + - target: {fileID: 8188263144140374597, guid: 82f1e40c0cf7c5048a41bfa78b10c9d9, + type: 3} + propertyPath: k__BackingField + value: 1 + objectReference: {fileID: 0} - target: {fileID: 8591273635324488586, guid: 82f1e40c0cf7c5048a41bfa78b10c9d9, type: 3} propertyPath: m_Name diff --git a/Assets/Data/Prefabs/Objects/Weapon/Sword.prefab b/Assets/Data/Prefabs/Objects/Weapon/Sword.prefab index 5ef8fd5..094aab2 100644 --- a/Assets/Data/Prefabs/Objects/Weapon/Sword.prefab +++ b/Assets/Data/Prefabs/Objects/Weapon/Sword.prefab @@ -103,6 +103,11 @@ PrefabInstance: propertyPath: weaponType value: 0 objectReference: {fileID: 0} + - target: {fileID: 4863370588218899347, guid: b84d7ca3927758646a65731cc107aa76, + type: 3} + propertyPath: k__BackingField + value: 2 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] diff --git a/Assets/Data/Prefabs/Screens/MainMenuScreen.prefab b/Assets/Data/Prefabs/Screens/MainMenuScreen.prefab index 9001d54..e16678d 100644 --- a/Assets/Data/Prefabs/Screens/MainMenuScreen.prefab +++ b/Assets/Data/Prefabs/Screens/MainMenuScreen.prefab @@ -214,7 +214,7 @@ MonoBehaviour: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - m_FontSize: 28 + m_FontSize: 26 m_FontStyle: 0 m_BestFit: 0 m_MinSize: 2 @@ -225,7 +225,7 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: "\u0412\u044B\u0445\u043E\u0434" + m_Text: Quit the game --- !u!1 &1194671910175534311 GameObject: m_ObjectHideFlags: 0 @@ -243,7 +243,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &7443329427527070274 RectTransform: m_ObjectHideFlags: 0 @@ -350,13 +350,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1d8a6d66b9544278aed2ac906bd7b87a, type: 3} m_Name: m_EditorClassIdentifier: - _loadGameButton: {fileID: 1779619751781562242} - _newGameButton: {fileID: 2083498177441079276} - _exitButton: {fileID: 4246581536859399904} - _confirmationTrueButton: {fileID: 7439516310675594391} - _confirmationFalseButton: {fileID: 2585468938132591199} - _mainPanel: {fileID: 1194671910175534311} - _confirmationPanel: {fileID: 3797558796280507627} + loadGameButton: {fileID: 1779619751781562242} + newGameButton: {fileID: 2083498177441079276} + exitButton: {fileID: 4246581536859399904} + confirmationTrueButton: {fileID: 7439516310675594391} + confirmationFalseButton: {fileID: 2585468938132591199} + mainPanel: {fileID: 1194671910175534311} + confirmationPanel: {fileID: 3797558796280507627} --- !u!1 &2243252762000319621 GameObject: m_ObjectHideFlags: 0 @@ -558,7 +558,7 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: "\u0412\u044B \u0443\u0432\u0435\u0440\u0435\u043D\u044B?" + m_Text: Are you sure? --- !u!1 &3521282476389640396 GameObject: m_ObjectHideFlags: 0 @@ -987,7 +987,7 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: "\u0414\u0430" + m_Text: Yes --- !u!1 &6248911724214527216 GameObject: m_ObjectHideFlags: 0 @@ -1067,7 +1067,7 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: "\u041D\u0435\u0442" + m_Text: No --- !u!1 &6884738178947652401 GameObject: m_ObjectHideFlags: 0 @@ -1282,7 +1282,7 @@ MonoBehaviour: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - m_FontSize: 28 + m_FontSize: 26 m_FontStyle: 0 m_BestFit: 0 m_MinSize: 2 @@ -1293,7 +1293,7 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: "\u041D\u043E\u0432\u0430\u044F \u0438\u0433\u0440\u0430" + m_Text: A new game --- !u!1 &8582870331173928121 GameObject: m_ObjectHideFlags: 0 @@ -1362,7 +1362,7 @@ MonoBehaviour: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - m_FontSize: 28 + m_FontSize: 26 m_FontStyle: 0 m_BestFit: 0 m_MinSize: 2 @@ -1373,7 +1373,7 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: "\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C" + m_Text: Continue game --- !u!1 &8889132334504304846 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Data/Prefabs/Screens/MenuInDungeonRoomScreen.prefab b/Assets/Data/Prefabs/Screens/MenuInDungeonRoomScreen.prefab index 5938833..6cd355a 100644 --- a/Assets/Data/Prefabs/Screens/MenuInDungeonRoomScreen.prefab +++ b/Assets/Data/Prefabs/Screens/MenuInDungeonRoomScreen.prefab @@ -292,7 +292,7 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: "\u0412\u044B\u0439\u0442\u0438 \u0438\u0437 \u043F\u043E\u0434\u0437\u0435\u043C\u0435\u043B\u044C\u044F" + m_Text: Exit the dungeon --- !u!1 &7411722975123792757 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Data/Prefabs/Screens/MenuInMainLocationScreen.prefab b/Assets/Data/Prefabs/Screens/MenuInMainLocationScreen.prefab index 6220f33..f95452e 100644 --- a/Assets/Data/Prefabs/Screens/MenuInMainLocationScreen.prefab +++ b/Assets/Data/Prefabs/Screens/MenuInMainLocationScreen.prefab @@ -79,7 +79,7 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: "\u0412\u044B\u0445\u043E\u0434 \u0432 \u043C\u0435\u043D\u044E" + m_Text: Exit --- !u!1 &1706293297475985732 GameObject: m_ObjectHideFlags: 0 @@ -148,18 +148,18 @@ MonoBehaviour: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - m_FontSize: 40 + m_FontSize: 38 m_FontStyle: 0 m_BestFit: 0 - m_MinSize: 4 - m_MaxSize: 40 + m_MinSize: 3 + m_MaxSize: 300 m_Alignment: 4 m_AlignByGeometry: 0 m_RichText: 1 m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C" + m_Text: Save progress --- !u!1 &3113874509457592469 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Data/Prefabs/Screens/SkillsBookScreen.prefab b/Assets/Data/Prefabs/Screens/SkillsBookScreen.prefab index 27293b3..be5baad 100644 --- a/Assets/Data/Prefabs/Screens/SkillsBookScreen.prefab +++ b/Assets/Data/Prefabs/Screens/SkillsBookScreen.prefab @@ -194,7 +194,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: skillsBookScreen: {fileID: 6440274993910932920} - skillStaticDatas: + skillStaticData: - {fileID: 11400000, guid: 0840ba806e578cd46a4c48924c1c7467, type: 2} - {fileID: 11400000, guid: 013ceb497b40a6d4d9742cef1d808ddf, type: 2} - {fileID: 11400000, guid: 8135a765b04665346ac5fbb4d1e84561, type: 2} diff --git a/Assets/Data/Prefabs/Units/Player.prefab b/Assets/Data/Prefabs/Units/Player.prefab index a2a4673..b9841b2 100644 --- a/Assets/Data/Prefabs/Units/Player.prefab +++ b/Assets/Data/Prefabs/Units/Player.prefab @@ -1688,7 +1688,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 3839841b389e42079ee316cf49b983fa, type: 3} m_Name: m_EditorClassIdentifier: - _triggerTransform: {fileID: 4727501319348209356} + triggerTransform: {fileID: 4727501319348209356} --- !u!1 &7021716789815793006 GameObject: m_ObjectHideFlags: 0 @@ -2631,6 +2631,48 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 90 objectReference: {fileID: 0} + - target: {fileID: 8605441864125897717, guid: 65847589f926b734d9eaed6e25f0046b, + type: 3} + propertyPath: grabAction.m_Reference + value: + objectReference: {fileID: -4289430672226363583, guid: c348712bda248c246b8c49b3db54643f, + type: 3} + - target: {fileID: 8605441864125897717, guid: 65847589f926b734d9eaed6e25f0046b, + type: 3} + propertyPath: grabAction.m_Action.m_Id + value: 273e394f-29d1-473e-a57e-6572f33607e2 + objectReference: {fileID: 0} + - target: {fileID: 8605441864125897717, guid: 65847589f926b734d9eaed6e25f0046b, + type: 3} + propertyPath: grabAction.m_UseReference + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8605441864125897717, guid: 65847589f926b734d9eaed6e25f0046b, + type: 3} + propertyPath: activateAction.m_Reference + value: + objectReference: {fileID: 6558622148059887818, guid: c348712bda248c246b8c49b3db54643f, + type: 3} + - target: {fileID: 8605441864125897717, guid: 65847589f926b734d9eaed6e25f0046b, + type: 3} + propertyPath: grabAction.m_Action.m_Name + value: Grab + objectReference: {fileID: 0} + - target: {fileID: 8605441864125897717, guid: 65847589f926b734d9eaed6e25f0046b, + type: 3} + propertyPath: activateAction.m_Action.m_Id + value: a8e379eb-9170-4216-b186-7cac95df1798 + objectReference: {fileID: 0} + - target: {fileID: 8605441864125897717, guid: 65847589f926b734d9eaed6e25f0046b, + type: 3} + propertyPath: activateAction.m_UseReference + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8605441864125897717, guid: 65847589f926b734d9eaed6e25f0046b, + type: 3} + propertyPath: activateAction.m_Action.m_Name + value: Activate + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] @@ -2716,6 +2758,48 @@ PrefabInstance: propertyPath: m_Name value: Right Hand Model objectReference: {fileID: 0} + - target: {fileID: 6692686522684814048, guid: 1fd3a7c43c8190f4d8c167ebde694364, + type: 3} + propertyPath: grabAction.m_Reference + value: + objectReference: {fileID: 7904272356298805229, guid: c348712bda248c246b8c49b3db54643f, + type: 3} + - target: {fileID: 6692686522684814048, guid: 1fd3a7c43c8190f4d8c167ebde694364, + type: 3} + propertyPath: grabAction.m_Action.m_Id + value: dc2546ae-7e9c-4d3f-91a4-2d54d3587bb0 + objectReference: {fileID: 0} + - target: {fileID: 6692686522684814048, guid: 1fd3a7c43c8190f4d8c167ebde694364, + type: 3} + propertyPath: grabAction.m_UseReference + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6692686522684814048, guid: 1fd3a7c43c8190f4d8c167ebde694364, + type: 3} + propertyPath: activateAction.m_Reference + value: + objectReference: {fileID: -1758520528963094988, guid: c348712bda248c246b8c49b3db54643f, + type: 3} + - target: {fileID: 6692686522684814048, guid: 1fd3a7c43c8190f4d8c167ebde694364, + type: 3} + propertyPath: grabAction.m_Action.m_Name + value: Grab + objectReference: {fileID: 0} + - target: {fileID: 6692686522684814048, guid: 1fd3a7c43c8190f4d8c167ebde694364, + type: 3} + propertyPath: activateAction.m_Action.m_Id + value: 1215391a-f4aa-4cf4-9f49-cf80992176b0 + objectReference: {fileID: 0} + - target: {fileID: 6692686522684814048, guid: 1fd3a7c43c8190f4d8c167ebde694364, + type: 3} + propertyPath: activateAction.m_UseReference + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6692686522684814048, guid: 1fd3a7c43c8190f4d8c167ebde694364, + type: 3} + propertyPath: activateAction.m_Action.m_Name + value: Activate + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] diff --git a/Assets/Data/Settings/MainLocationSettings.asset b/Assets/Data/Settings/MainLocationSettings.asset index 803fdef..89b54ec 100644 --- a/Assets/Data/Settings/MainLocationSettings.asset +++ b/Assets/Data/Settings/MainLocationSettings.asset @@ -12,12 +12,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 95b09753b1d3398408a36564c906b124, type: 3} m_Name: MainLocationSettings m_EditorClassIdentifier: - playerSpawnPosition: {x: 0, y: 0, z: 0} - weaponSpawnPosition: - - {x: 8, y: 1, z: 0.75} - - {x: 8, y: 1, z: 0} + k__BackingField: {x: 0, y: 0, z: 0} + k__BackingField: - {x: 8, y: 1, z: -0.75} - socketForWeaponSpawnPosition: {x: 0.325, y: 0.7, z: 0.075} - portalSpawnPosition: {x: 0, y: 1.5, z: 9} - skillsBookScreenPosition: {x: -7.868, y: 1.303, z: -7.932} - skillsBookScreenRotation: {x: 30, y: -135, z: 0} + - {x: 8, y: 1, z: 0} + - {x: 8, y: 1, z: 0.75} + k__BackingField: {x: 0.325, y: -0.6, z: 0.075} + k__BackingField: {x: 0, y: 1.5, z: 9} + k__BackingField: {x: -7.868, y: 1.303, z: -7.932} + k__BackingField: {x: 30, y: -135, z: 0} diff --git a/Assets/Data/Settings/MainMenuSettings.asset b/Assets/Data/Settings/MainMenuSettings.asset index 06ef1c4..24bc7d7 100644 --- a/Assets/Data/Settings/MainMenuSettings.asset +++ b/Assets/Data/Settings/MainMenuSettings.asset @@ -12,5 +12,5 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1a2ed1f0d74146408622b373c39fbbf7, type: 3} m_Name: MainMenuSettings m_EditorClassIdentifier: - uiMenuSpawnPosition: {x: 0, y: 1.5, z: 2} - playerSpawnPosition: {x: 0, y: 0, z: 0} + k__BackingField: {x: 0, y: 1.5, z: 2} + k__BackingField: {x: 0, y: 0, z: 0} diff --git a/Assets/Data/SkillsStatic/SkillStatic_ HEALTH_Count.asset b/Assets/Data/SkillsStatic/SkillStatic_ HEALTH_Count.asset index bda009f..0698f15 100644 --- a/Assets/Data/SkillsStatic/SkillStatic_ HEALTH_Count.asset +++ b/Assets/Data/SkillsStatic/SkillStatic_ HEALTH_Count.asset @@ -15,7 +15,7 @@ MonoBehaviour: k__BackingField: 4 k__BackingField: "\u0421\u0435\u0440\u0434\u0446\u0435 \u043C\u0430\u043D\u043D\u044B" k__BackingField: 2 - k__BackingField: Count + k__BackingField: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E" k__BackingField: "\u0423\u043B\u0443\u0447\u0448\u0430\u0435\u0442\u0441\u044F \u043C\u0430\u043D\u0438\u043F\u0443\u043B\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \u043C\u0430\u043D\u043D\u043E\u0439, \u0443\u043B\u0443\u0447\u0448\u0430\u044F diff --git a/Assets/Data/SkillsStatic/SkillStatic_ HEALTH_Percent.asset b/Assets/Data/SkillsStatic/SkillStatic_ HEALTH_Percent.asset index 232d275..1f128b7 100644 --- a/Assets/Data/SkillsStatic/SkillStatic_ HEALTH_Percent.asset +++ b/Assets/Data/SkillsStatic/SkillStatic_ HEALTH_Percent.asset @@ -16,7 +16,7 @@ MonoBehaviour: k__BackingField: "\u0411\u043B\u0430\u0433\u043E\u0441\u043B\u043E\u0432\u0435\u043D\u0438\u0435 \u0436\u0438\u0437\u043D\u0438" k__BackingField: 1 - k__BackingField: Percent + k__BackingField: "\u041F\u0440\u043E\u0446\u0435\u043D\u0442" k__BackingField: " \u0414\u0430\u0440\u0443\u0435\u0442 \u043E\u0431\u043B\u0430\u0434\u0430\u0442\u0435\u043B\u044E \u0431\u043B\u0430\u0433\u043E\u0441\u043B\u043E\u0432\u043B\u0435\u043D\u0438\u044F \u0443\u0441\u0438\u043B\u0435\u043D\u0438\u0435 \u0437\u0434\u043E\u0440\u043E\u0432\u044C\u044F, diff --git a/Assets/Data/SkillsStatic/SkillStatic_ PROCTION_Count.asset b/Assets/Data/SkillsStatic/SkillStatic_ PROCTION_Count.asset index 05d2e36..e90a2df 100644 --- a/Assets/Data/SkillsStatic/SkillStatic_ PROCTION_Count.asset +++ b/Assets/Data/SkillsStatic/SkillStatic_ PROCTION_Count.asset @@ -15,7 +15,7 @@ MonoBehaviour: k__BackingField: 2 k__BackingField: "\u0429\u0438\u0442 \u043C\u0430\u043D\u043D\u044B" k__BackingField: 2 - k__BackingField: Count + k__BackingField: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E" k__BackingField: "\u0421\u043E\u0437\u0434\u0430\u0451\u0442 \u043C\u0430\u0433\u0438\u0447\u0435\u0441\u043A\u0438\u0439 \u0431\u0430\u0440\u044C\u0435\u0440 \u043E\u0431\u0432\u043E\u043B\u0430\u043A\u0438\u0432\u0430\u044E\u0449\u0438\u0439 diff --git a/Assets/Data/SkillsStatic/SkillStatic_ PROCTION_Percent.asset b/Assets/Data/SkillsStatic/SkillStatic_ PROCTION_Percent.asset index d7aee9f..1cdc870 100644 --- a/Assets/Data/SkillsStatic/SkillStatic_ PROCTION_Percent.asset +++ b/Assets/Data/SkillsStatic/SkillStatic_ PROCTION_Percent.asset @@ -15,7 +15,7 @@ MonoBehaviour: k__BackingField: 3 k__BackingField: "\u041A\u0440\u0435\u043F\u043A\u0430\u044F \u043A\u043E\u0436\u0430" k__BackingField: 1 - k__BackingField: Percent + k__BackingField: "\u041F\u0440\u043E\u0446\u0435\u043D\u0442" k__BackingField: "\u0423\u043B\u0443\u0447\u0448\u0430\u0435\u0442 \u0437\u0430\u0449\u0438\u0442\u043D\u044B\u0435 \u0441\u0432\u043E\u0439\u0441\u0442\u0432\u0430 \u043A\u043E\u0436\u0438, \u0434\u0435\u043B\u0430\u044F \u043E\u0431\u043B\u0430\u0434\u0430\u0442\u0435\u043B\u044F diff --git a/Assets/Data/SkillsStatic/SkillStatic_ STREANGHT_Count.asset b/Assets/Data/SkillsStatic/SkillStatic_ STREANGHT_Count.asset index 7ebaf53..3f0708d 100644 --- a/Assets/Data/SkillsStatic/SkillStatic_ STREANGHT_Count.asset +++ b/Assets/Data/SkillsStatic/SkillStatic_ STREANGHT_Count.asset @@ -15,7 +15,7 @@ MonoBehaviour: k__BackingField: 0 k__BackingField: "\u0422\u0432\u0435\u0440\u0434\u0430\u044F \u0440\u0443\u043A\u0430" k__BackingField: 2 - k__BackingField: Count + k__BackingField: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E" k__BackingField: "\u0423\u0432\u0435\u043B\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u043C\u043E\u0449\u043D\u043E\u0441\u0442\u044C \u0443\u0434\u0430\u0440\u043E\u0432" a1: 0 diff --git a/Assets/Data/SkillsStatic/SkillStatic_ STREANGHT_Percent.asset b/Assets/Data/SkillsStatic/SkillStatic_ STREANGHT_Percent.asset index fc5000a..0ebd597 100644 --- a/Assets/Data/SkillsStatic/SkillStatic_ STREANGHT_Percent.asset +++ b/Assets/Data/SkillsStatic/SkillStatic_ STREANGHT_Percent.asset @@ -16,7 +16,7 @@ MonoBehaviour: k__BackingField: "\u0422\u0438\u0442\u0430\u043D\u043E\u0432\u044B\u0435 \u043C\u044B\u0448\u0446\u044B" k__BackingField: 1 - k__BackingField: Percent + k__BackingField: "\u041F\u0440\u043E\u0446\u0435\u043D\u0442" k__BackingField: "\u0423\u0432\u0435\u043B\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0443\u044E \u0441\u0438\u043B\u0443 \u0434\u0430\u0440\u0443\u044F \u0447\u0430\u0441\u0442\u0438\u0447\u043A\u0443 diff --git a/Assets/Editor/com.vladfaust.unitywakatime/Editor/Plugin.cs b/Assets/Editor/com.vladfaust.unitywakatime/Editor/Plugin.cs index 1dd2077..40fbe78 100644 --- a/Assets/Editor/com.vladfaust.unitywakatime/Editor/Plugin.cs +++ b/Assets/Editor/com.vladfaust.unitywakatime/Editor/Plugin.cs @@ -164,9 +164,9 @@ static void SendHeartbeat(bool fromSave = false) { if (_debug) Debug.LogWarning(" Duplicate heartbeat"); } else { - Debug.LogError( - " Failed to send heartbeat to WakaTime!\n" + - response.error); + // Debug.LogError( + // " Failed to send heartbeat to WakaTime!\n" + + // response.error); } } else { diff --git a/Assets/External assets/Training_dummy/Mesh/idle.anim b/Assets/External assets/Training_dummy/Mesh/idle.anim index 2b60eef..88c3546 100644 --- a/Assets/External assets/Training_dummy/Mesh/idle.anim +++ b/Assets/External assets/Training_dummy/Mesh/idle.anim @@ -2836,7 +2836,7 @@ AnimationClip: m_HasMotionFloatCurves: 0 m_Events: - time: 0 - functionName: Idle + functionName: AnimationTriggerIdle data: objectReferenceParameter: {fileID: 0} floatParameter: 0 diff --git a/Assets/External assets/Training_dummy/Mesh/restart.anim b/Assets/External assets/Training_dummy/Mesh/restart.anim index 4f6be6f..7c519c0 100644 --- a/Assets/External assets/Training_dummy/Mesh/restart.anim +++ b/Assets/External assets/Training_dummy/Mesh/restart.anim @@ -3988,14 +3988,28 @@ AnimationClip: m_HasMotionFloatCurves: 0 m_Events: - time: 0 - functionName: Action + functionName: AnimationTriggerAnimationTriggerAction + data: + objectReferenceParameter: {fileID: 0} + floatParameter: 0 + intParameter: 0 + messageOptions: 0 + - time: 0.016666668 + functionName: AnimationTriggerAnimationTriggerAction data: objectReferenceParameter: {fileID: 0} floatParameter: 0 intParameter: 0 messageOptions: 0 - time: 0.38333333 - functionName: Revived + functionName: AnimationTriggerRevived + data: + objectReferenceParameter: {fileID: 0} + floatParameter: 0 + intParameter: 0 + messageOptions: 0 + - time: 0.4 + functionName: AnimationTriggerRevived data: objectReferenceParameter: {fileID: 0} floatParameter: 0 diff --git a/Assets/External assets/Training_dummy/Mesh/training_dummy.fbx.meta b/Assets/External assets/Training_dummy/Mesh/training_dummy.fbx.meta index 2b08d38..9567191 100644 --- a/Assets/External assets/Training_dummy/Mesh/training_dummy.fbx.meta +++ b/Assets/External assets/Training_dummy/Mesh/training_dummy.fbx.meta @@ -75,7 +75,7 @@ ModelImporter: curves: [] events: - time: 0 - functionName: Action + functionName: AnimationTriggerAction data: objectReferenceParameter: {instanceID: 0} floatParameter: 0 @@ -111,7 +111,7 @@ ModelImporter: curves: [] events: - time: 0 - functionName: Action + functionName: AnimationTriggerAction data: objectReferenceParameter: {instanceID: 0} floatParameter: 0 @@ -129,6 +129,7 @@ ModelImporter: addColliders: 0 useSRGBMaterialColor: 1 sortHierarchyByName: 1 + importPhysicalCameras: 1 importVisibility: 1 importBlendShapes: 1 importCameras: 1 diff --git a/Assets/Internal assets/Scripts/BuildSetting/GameObjectDisable.cs b/Assets/Internal assets/Scripts/BuildSetting/GameObjectDisable.cs index f3c1114..987db7e 100644 --- a/Assets/Internal assets/Scripts/BuildSetting/GameObjectDisable.cs +++ b/Assets/Internal assets/Scripts/BuildSetting/GameObjectDisable.cs @@ -1,5 +1,9 @@ +#region + using UnityEngine; +#endregion + namespace BuildSetting { public class GameObjectDisable : MonoBehaviour @@ -8,8 +12,8 @@ private void Start() { #if UNITY_EDITOR #else - gameObject.SetActive(false); + Destroy(gameObject); #endif } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Data/Addressable/AssetsAddressablesConstants.cs b/Assets/Internal assets/Scripts/Data/Addressable/AssetsAddressableConstants.cs similarity index 92% rename from Assets/Internal assets/Scripts/Data/Addressable/AssetsAddressablesConstants.cs rename to Assets/Internal assets/Scripts/Data/Addressable/AssetsAddressableConstants.cs index df0226c..3b65bb1 100644 --- a/Assets/Internal assets/Scripts/Data/Addressable/AssetsAddressablesConstants.cs +++ b/Assets/Internal assets/Scripts/Data/Addressable/AssetsAddressableConstants.cs @@ -1,31 +1,30 @@ -namespace Data.Addressable -{ - public static class AssetsAddressablesConstants - { - public const string MAIN_MENU_SCENE_NAME = "MainMenu"; - public const string MAIN_LOCATION_SCENE_NAME = "MainLocation"; - public const string DUNGEON_ROOM_SCENE_NAME = "DungeonRoom"; - - public const string LOADING_PROCESS_SCREEN = "LoadingProcessScreen"; - public const string MAIN_MENU_SCREEN = "MainMenuScreen"; - public const string MAIN_LOCATION_SCREEN = "MainLocationScreen"; - public const string MENU_IN_MAIN_LOCATION_SCREEN = "MenuInMainLocationScreen"; - public const string MENU_IN_DUNGEON_ROOM_SCREEN = "MenuInDungeonRoomScreen"; - public const string SKILLS_BOOK_SCREEN = "SkillsBookScreen"; - - - public const string MAIN_LOCATION_MAP = "MainLocationMap"; - public const string MAIN_MENU_MAP = "MainMenuMap"; - - public const string PLAYER = "Player"; - - public const string WEAPON_AX = "WeaponAx"; - public const string WEAPON_HAMMER = "WeaponHammer"; - public const string WEAPON_SWORD = "WeaponSword"; - public const string SOCKET_FOR_SWORD = "SocketForWeapon"; - - public const string FLOOR = "Floor"; - public const string WALL = "Wall"; - public const string WALL_AND_LIGHT = "WallAndLight"; - } -} \ No newline at end of file +namespace Data.Addressable +{ + public static class AssetsAddressableConstants + { + public const string MAIN_MENU_SCENE_NAME = "MainMenu"; + public const string MAIN_LOCATION_SCENE_NAME = "MainLocation"; + public const string DUNGEON_ROOM_SCENE_NAME = "DungeonRoom"; + + public const string LOADING_PROCESS_SCREEN = "LoadingProcessScreen"; + public const string MAIN_MENU_SCREEN = "MainMenuScreen"; + public const string MAIN_LOCATION_SCREEN = "MainLocationScreen"; + public const string MENU_IN_MAIN_LOCATION_SCREEN = "MenuInMainLocationScreen"; + public const string MENU_IN_DUNGEON_ROOM_SCREEN = "MenuInDungeonRoomScreen"; + public const string SKILLS_BOOK_SCREEN = "SkillsBookScreen"; + + public const string MAIN_LOCATION_MAP = "MainLocationMap"; + public const string MAIN_MENU_MAP = "MainMenuMap"; + + public const string PLAYER = "Player"; + + public const string WEAPON_AX = "WeaponAx"; + public const string WEAPON_HAMMER = "WeaponHammer"; + public const string WEAPON_SWORD = "WeaponSword"; + public const string SOCKET_FOR_SWORD = "SocketForWeapon"; + + public const string FLOOR = "Floor"; + public const string WALL = "Wall"; + public const string WALL_AND_LIGHT = "WallAndLight"; + } +} diff --git a/Assets/Internal assets/Scripts/Data/Addressable/AssetsAddressablesConstants.cs.meta b/Assets/Internal assets/Scripts/Data/Addressable/AssetsAddressableConstants.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Data/Addressable/AssetsAddressablesConstants.cs.meta rename to Assets/Internal assets/Scripts/Data/Addressable/AssetsAddressableConstants.cs.meta diff --git a/Assets/Internal assets/Scripts/Data/Dynamic/Location/CurrentLocation.cs b/Assets/Internal assets/Scripts/Data/Dynamic/Location/CurrentLocation.cs index 5a40dc0..4633fb2 100644 --- a/Assets/Internal assets/Scripts/Data/Dynamic/Location/CurrentLocation.cs +++ b/Assets/Internal assets/Scripts/Data/Dynamic/Location/CurrentLocation.cs @@ -1,4 +1,8 @@ -using System; +#region + +using System; + +#endregion namespace Data.Dynamic.Location { @@ -9,7 +13,7 @@ public CurrentLocation() { locationType = LocationType.Main; } - + public LocationType locationType; public enum LocationType @@ -19,4 +23,4 @@ public enum LocationType DungeonBoss = 2, } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Data/Dynamic/Location/DungeonRoom.cs b/Assets/Internal assets/Scripts/Data/Dynamic/Location/DungeonLocation.cs similarity index 63% rename from Assets/Internal assets/Scripts/Data/Dynamic/Location/DungeonRoom.cs rename to Assets/Internal assets/Scripts/Data/Dynamic/Location/DungeonLocation.cs index a99941c..c660de6 100644 --- a/Assets/Internal assets/Scripts/Data/Dynamic/Location/DungeonRoom.cs +++ b/Assets/Internal assets/Scripts/Data/Dynamic/Location/DungeonLocation.cs @@ -1,19 +1,21 @@ -using System; -using UnityEngine.Serialization; +#region + +using System; + +#endregion namespace Data.Dynamic.Location { [Serializable] - public class DungeonRoom + public class DungeonLocation { - public DungeonRoom() + public DungeonLocation() { roomPassedCount = 0; seed = 0; } - + public int roomPassedCount; public int seed; - } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Data/Dynamic/Location/DungeonRoom.cs.meta b/Assets/Internal assets/Scripts/Data/Dynamic/Location/DungeonLocation.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Data/Dynamic/Location/DungeonRoom.cs.meta rename to Assets/Internal assets/Scripts/Data/Dynamic/Location/DungeonLocation.cs.meta diff --git a/Assets/Internal assets/Scripts/Data/Dynamic/Loot/LootData.cs b/Assets/Internal assets/Scripts/Data/Dynamic/Loot/LootData.cs index bb9ea5a..95a4aab 100644 --- a/Assets/Internal assets/Scripts/Data/Dynamic/Loot/LootData.cs +++ b/Assets/Internal assets/Scripts/Data/Dynamic/Loot/LootData.cs @@ -1,10 +1,20 @@ -using System; +#region + +using System; +using UnityEngine.Serialization; + +#endregion namespace Data.Dynamic.Loot { [Serializable] public class LootData { - public int soulsOfTheDungeon; + public LootData() + { + loot = 0; + } + + public int loot; } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Data/Dynamic/Player/SelectedWeapon.cs b/Assets/Internal assets/Scripts/Data/Dynamic/Player/SelectedWeapon.cs index abc16ed..81bf483 100644 --- a/Assets/Internal assets/Scripts/Data/Dynamic/Player/SelectedWeapon.cs +++ b/Assets/Internal assets/Scripts/Data/Dynamic/Player/SelectedWeapon.cs @@ -1,6 +1,10 @@ -using System; +#region + +using System; using Item.Weapon; +#endregion + namespace Data.Dynamic.Player { [Serializable] @@ -10,7 +14,7 @@ public SelectedWeapon() { weaponType = WeaponType.Sword; } - + public WeaponType weaponType; } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Data/Dynamic/Player/SkillEntry.cs b/Assets/Internal assets/Scripts/Data/Dynamic/Player/SkillEntry.cs index a9b9a24..51a0ab9 100644 --- a/Assets/Internal assets/Scripts/Data/Dynamic/Player/SkillEntry.cs +++ b/Assets/Internal assets/Scripts/Data/Dynamic/Player/SkillEntry.cs @@ -1,18 +1,22 @@ -using System; +#region + +using System; using Skill; +#endregion + namespace Data.Dynamic.Player { [Serializable] public class SkillEntry { - public SkillType Key; - public int Value; - public SkillEntry(SkillType key, int value) { - Key = key; - Value = value; + this.key = key; + this.value = value; } + + public SkillType key; + public int value; } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Data/Dynamic/Player/SkillsLevel.cs b/Assets/Internal assets/Scripts/Data/Dynamic/Player/SkillsLevel.cs index 898f075..118a294 100644 --- a/Assets/Internal assets/Scripts/Data/Dynamic/Player/SkillsLevel.cs +++ b/Assets/Internal assets/Scripts/Data/Dynamic/Player/SkillsLevel.cs @@ -1,7 +1,12 @@ +#region + using System; using System.Collections.Generic; using System.Linq; using Skill; +using UnityEngine.Serialization; + +#endregion namespace Data.Dynamic.Player { @@ -10,32 +15,30 @@ public class SkillsLevel { public SkillsLevel() { - Skills = new Dictionary + skills = new Dictionary { - { SkillType.STREANGHT_Count, 0 }, - { SkillType.STREANGHT_Percent, 0 }, - { SkillType.PROTECTION_Count, 0 }, - { SkillType.PROTECTION_Percent, 0 }, - { SkillType.HEALTH_Count, 0 }, - { SkillType.HEALTH_Percent, 0 }, + [SkillType.StrengthCount] = 0, + [SkillType.StrengthPercent] = 0, + [SkillType.ProtectionCount] = 0, + [SkillType.ProtectionPercent] = 0, + [SkillType.HealthCount] = 0, + [SkillType.HealthPercent] = 0 }; } - public Dictionary Skills; + public List skillEntries; - public List SkillEntries; + public Dictionary skills; public void SerializeSkills() { - SkillEntries = Skills.Select(pair => new SkillEntry(pair.Key, pair.Value)).ToList(); + skillEntries = skills.Select(pair => new SkillEntry(pair.Key, pair.Value)).ToList(); } public void DeserializeSkills() { - if (SkillEntries == null) return; - var skills = SkillEntries.ToDictionary(entry => entry.Key, entry => entry.Value); - foreach (var (skillsType, level) in skills) - Skills[skillsType] = level; + if (skillEntries == null) return; + skills = skillEntries.ToDictionary(entry => entry.key, entry => entry.value); } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Data/Dynamic/Progress.cs b/Assets/Internal assets/Scripts/Data/Dynamic/Progress.cs index 52a4947..ea8e7ed 100644 --- a/Assets/Internal assets/Scripts/Data/Dynamic/Progress.cs +++ b/Assets/Internal assets/Scripts/Data/Dynamic/Progress.cs @@ -1,8 +1,12 @@ -using System; +#region + +using System; using Data.Dynamic.Location; using Data.Dynamic.Loot; using Data.Dynamic.Player; +#endregion + namespace Data.Dynamic { [Serializable] @@ -12,15 +16,15 @@ public Progress() { currentLocation = new CurrentLocation(); selectedWeapon = new SelectedWeapon(); - dungeonRoom = new DungeonRoom(); + dungeonLocation = new DungeonLocation(); skillsLevel = new SkillsLevel(); lootData = new LootData(); } public CurrentLocation currentLocation; public SelectedWeapon selectedWeapon; - public DungeonRoom dungeonRoom; + public DungeonLocation dungeonLocation; public SkillsLevel skillsLevel; public LootData lootData; } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Data/Settings.meta b/Assets/Internal assets/Scripts/Data/LocationSettings.meta similarity index 100% rename from Assets/Internal assets/Scripts/Data/Settings.meta rename to Assets/Internal assets/Scripts/Data/LocationSettings.meta diff --git a/Assets/Internal assets/Scripts/Data/LocationSettings/DungeonRoomSettings.cs b/Assets/Internal assets/Scripts/Data/LocationSettings/DungeonRoomSettings.cs new file mode 100644 index 0000000..00edc32 --- /dev/null +++ b/Assets/Internal assets/Scripts/Data/LocationSettings/DungeonRoomSettings.cs @@ -0,0 +1,16 @@ +#region + +using UnityEngine; + +#endregion + +namespace Data.LocationSettings +{ + [CreateAssetMenu(fileName = "DungeonRoomSettings", menuName = "Settings/DungeonRoomSettings", order = 0)] + public class DungeonRoomSettings : LocationSettings + { + [field: Space(5f)] + [field: SerializeField] + public Vector3 SocketForWeaponSpawnPosition { get; private set; } + } +} diff --git a/Assets/Internal assets/Scripts/Data/Settings/DungeonRoomSettings.cs.meta b/Assets/Internal assets/Scripts/Data/LocationSettings/DungeonRoomSettings.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Data/Settings/DungeonRoomSettings.cs.meta rename to Assets/Internal assets/Scripts/Data/LocationSettings/DungeonRoomSettings.cs.meta diff --git a/Assets/Internal assets/Scripts/Data/LocationSettings/LocationSettings.cs b/Assets/Internal assets/Scripts/Data/LocationSettings/LocationSettings.cs new file mode 100644 index 0000000..bb4f15c --- /dev/null +++ b/Assets/Internal assets/Scripts/Data/LocationSettings/LocationSettings.cs @@ -0,0 +1,12 @@ +#region + +using UnityEngine; + +#endregion + +namespace Data.LocationSettings +{ + public class LocationSettings : ScriptableObject + { + } +} diff --git a/Assets/Internal assets/Scripts/Data/Settings/BaseSettings.cs.meta b/Assets/Internal assets/Scripts/Data/LocationSettings/LocationSettings.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Data/Settings/BaseSettings.cs.meta rename to Assets/Internal assets/Scripts/Data/LocationSettings/LocationSettings.cs.meta diff --git a/Assets/Internal assets/Scripts/Data/LocationSettings/MainLocationSettings.cs b/Assets/Internal assets/Scripts/Data/LocationSettings/MainLocationSettings.cs new file mode 100644 index 0000000..3cc7581 --- /dev/null +++ b/Assets/Internal assets/Scripts/Data/LocationSettings/MainLocationSettings.cs @@ -0,0 +1,36 @@ +#region + +using UnityEngine; + +#endregion + +namespace Data.LocationSettings +{ + [CreateAssetMenu(fileName = "MainLocationSettings", menuName = "Settings/MainLocationSettings")] + public class MainLocationSettings : LocationSettings + { + [field: Space(5f)] + [field: SerializeField] + public Vector3 PlayerSpawnPosition { get; private set; } + + [field: Space(5f)] + [field: SerializeField] + public Vector3[] WeaponSpawnPosition { get; private set; } + + [field: Space(5f)] + [field: SerializeField] + public Vector3 SocketForWeaponSpawnPosition { get; private set; } + + [field: Space(5f)] + [field: SerializeField] + public Vector3 TransitionToTheDungeonSpawnPosition { get; private set; } + + [field: Space(5f)] + [field: SerializeField] + public Vector3 SkillsBookScreenPosition { get; private set; } + + [field: Space(5f)] + [field: SerializeField] + public Vector3 SkillsBookScreenRotation { get; private set; } + } +} diff --git a/Assets/Internal assets/Scripts/Data/Settings/MainLocationSettings.cs.meta b/Assets/Internal assets/Scripts/Data/LocationSettings/MainLocationSettings.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Data/Settings/MainLocationSettings.cs.meta rename to Assets/Internal assets/Scripts/Data/LocationSettings/MainLocationSettings.cs.meta diff --git a/Assets/Internal assets/Scripts/Data/LocationSettings/MainMenuSettings.cs b/Assets/Internal assets/Scripts/Data/LocationSettings/MainMenuSettings.cs new file mode 100644 index 0000000..c63fd06 --- /dev/null +++ b/Assets/Internal assets/Scripts/Data/LocationSettings/MainMenuSettings.cs @@ -0,0 +1,20 @@ +#region + +using UnityEngine; + +#endregion + +namespace Data.LocationSettings +{ + [CreateAssetMenu(fileName = "MainMenuSettings", menuName = "Settings/MainMenuSettings")] + public class MainMenuSettings : LocationSettings + { + [field: Space(5f)] + [field: SerializeField] + public Vector3 UIMenuSpawnPosition { get; private set; } + + [field: Space(5f)] + [field: SerializeField] + public Vector3 PlayerSpawnPosition { get; private set; } + } +} diff --git a/Assets/Internal assets/Scripts/Data/Settings/MainMenuSettings.cs.meta b/Assets/Internal assets/Scripts/Data/LocationSettings/MainMenuSettings.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Data/Settings/MainMenuSettings.cs.meta rename to Assets/Internal assets/Scripts/Data/LocationSettings/MainMenuSettings.cs.meta diff --git a/Assets/Internal assets/Scripts/Data/Settings/BaseSettings.cs b/Assets/Internal assets/Scripts/Data/Settings/BaseSettings.cs deleted file mode 100644 index b845427..0000000 --- a/Assets/Internal assets/Scripts/Data/Settings/BaseSettings.cs +++ /dev/null @@ -1,8 +0,0 @@ -using UnityEngine; - -namespace Data.Settings -{ - public class BaseSettings : ScriptableObject { } -} - - diff --git a/Assets/Internal assets/Scripts/Data/Settings/DungeonRoomSettings.cs b/Assets/Internal assets/Scripts/Data/Settings/DungeonRoomSettings.cs deleted file mode 100644 index 5c466e6..0000000 --- a/Assets/Internal assets/Scripts/Data/Settings/DungeonRoomSettings.cs +++ /dev/null @@ -1,10 +0,0 @@ -using UnityEngine; - -namespace Data.Settings -{ - [CreateAssetMenu(fileName = "DungeonRoomSettings", menuName = "Settings/DungeonRoomSettings", order = 0)] - public class DungeonRoomSettings : BaseSettings - { - [field: Space(5f), SerializeField] public Vector3 SocketForWeaponSpawnPosition { get; private set; } - } -} \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Data/Settings/MainLocationSettings.cs b/Assets/Internal assets/Scripts/Data/Settings/MainLocationSettings.cs deleted file mode 100644 index 0452471..0000000 --- a/Assets/Internal assets/Scripts/Data/Settings/MainLocationSettings.cs +++ /dev/null @@ -1,21 +0,0 @@ -using UnityEngine; - -namespace Data.Settings -{ - [CreateAssetMenu(fileName = "MainLocationSettings", menuName = "Settings/MainLocationSettings")] - public class MainLocationSettings : BaseSettings - { - [SerializeField] private Vector3 playerSpawnPosition; - [Space(5f)] [SerializeField] private Vector3[] weaponSpawnPosition; - [Space(5f)] [SerializeField] private Vector3 socketForWeaponSpawnPosition; - [Space(5f)] [SerializeField] private Vector3 portalSpawnPosition; - [Space(5f)] [SerializeField] private Vector3 skillsBookScreenPosition; - [Space(5f)] [SerializeField] private Vector3 skillsBookScreenRotation; - public Vector3 PlayerSpawnPosition => playerSpawnPosition; - public Vector3[] WeaponSpawnPosition => weaponSpawnPosition; - public Vector3 SocketForWeaponSpawnPosition => socketForWeaponSpawnPosition; - public Vector3 PortalSpawnPosition => portalSpawnPosition; - public Vector3 SkillsBookScreenPosition => skillsBookScreenPosition; - public Vector3 SkillsBookScreenRotation => skillsBookScreenRotation; - } -} \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Data/Settings/MainMenuSettings.cs b/Assets/Internal assets/Scripts/Data/Settings/MainMenuSettings.cs deleted file mode 100644 index 9b6facc..0000000 --- a/Assets/Internal assets/Scripts/Data/Settings/MainMenuSettings.cs +++ /dev/null @@ -1,14 +0,0 @@ -using UnityEngine; - -namespace Data.Settings -{ - [CreateAssetMenu(fileName = "MainMenuSettings", menuName = "Settings/MainMenuSettings")] - public class MainMenuSettings : BaseSettings - { - [SerializeField] private Vector3 uiMenuSpawnPosition; - [Space(5f)] [SerializeField] private Vector3 playerSpawnPosition; - - public Vector3 UIMenuSpawnPosition => uiMenuSpawnPosition; - public Vector3 PlayerSpawnPosition => playerSpawnPosition; - } -} \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Data/Static/EnemyStaticData.cs b/Assets/Internal assets/Scripts/Data/Static/EnemyStaticData.cs index 4a1d69b..e1600f2 100644 --- a/Assets/Internal assets/Scripts/Data/Static/EnemyStaticData.cs +++ b/Assets/Internal assets/Scripts/Data/Static/EnemyStaticData.cs @@ -1,35 +1,44 @@ -using Units.Enemy; +#region + +using Units.Enemy; using UnityEngine; using UnityEngine.AddressableAssets; +#endregion + namespace Data.Static { [CreateAssetMenu(fileName = "EnemyData", menuName = "StaticData/Enemy")] - public class EnemyStaticData : ScriptableObject + public class EnemyStaticData : StaticData { [field: SerializeField] public EnemyType EnemyType { get; private set; } [field: SerializeField] public string Name { get; private set; } - [field: Range(1, 100), SerializeField] public float MaxHealthPoints { get; private set; } + [field: Range(1, 100)] + [field: SerializeField] + public float MaxHealthPoints { get; private set; } - [field: Range(1, 30), SerializeField] public float Damage { get; private set; } + [field: Range(1, 30)] + [field: SerializeField] + public float Damage { get; private set; } - [field: Range(0.1f, 2), SerializeField] + [field: Range(0.1f, 2)] + [field: SerializeField] public float EffectiveDistance { get; private set; } - [field: Range(0.1f, 2), SerializeField] - public float Cleavage { get; private set; } - - [field: Range(0.1f, 10), SerializeField] + [field: Range(0.1f, 10)] + [field: SerializeField] public float AttackCooldown { get; private set; } - [field: Range(0.1f, 10), SerializeField] + [field: Range(0.1f, 10)] + [field: SerializeField] public float MovementSpeed { get; private set; } - [field: Range(10f, 100), SerializeField] + [field: Range(10f, 100)] + [field: SerializeField] public float RotationSpeed { get; private set; } - [field: Space, SerializeField] public AssetReferenceGameObject PrefabReference { get; private set; } + [field: Space] [field: SerializeField] public AssetReferenceGameObject PrefabReference { get; private set; } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Data/Static/PlayerStaticDefaultData.cs b/Assets/Internal assets/Scripts/Data/Static/PlayerStaticDefaultData.cs index 451ed19..e9d2528 100644 --- a/Assets/Internal assets/Scripts/Data/Static/PlayerStaticDefaultData.cs +++ b/Assets/Internal assets/Scripts/Data/Static/PlayerStaticDefaultData.cs @@ -1,12 +1,16 @@ -using UnityEngine; +#region + +using UnityEngine; + +#endregion namespace Data.Static { [CreateAssetMenu(fileName = "PlayerStaticDefaultData", menuName = "StaticData/Player")] - public class PlayerStaticDefaultData : ScriptableObject + public class PlayerStaticDefaultData : StaticData { - [field: SerializeField] public float MaxHealthPoints { get; private set; } + [field: SerializeField] public float HealthMaxPoints { get; private set; } [field: SerializeField] public float DamagePoints { get; private set; } [field: SerializeField] public float ProtectionPoints { get; private set; } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Data/Static/SkillStaticData.cs b/Assets/Internal assets/Scripts/Data/Static/SkillStaticData.cs index 808868b..3057df9 100644 --- a/Assets/Internal assets/Scripts/Data/Static/SkillStaticData.cs +++ b/Assets/Internal assets/Scripts/Data/Static/SkillStaticData.cs @@ -1,25 +1,33 @@ -using Data.Dynamic.Player; +#region + using Skill; using UnityEngine; +#endregion + namespace Data.Static { [CreateAssetMenu(fileName = "SkillStatic", menuName = "StaticData/Skill", order = 0)] - public class SkillStaticData : ScriptableObject + public class SkillStaticData : StaticData { - [field: SerializeField] public SkillType SkillType {get; private set;} - [field: SerializeField] public string NameSkill {get; private set;} - [field: SerializeField] public int BaseValueSkill {get; private set;} - [field: SerializeField] public string TypeSkill {get; private set;} - [field: SerializeField] public string DescriptionSkill {get; private set;} + [field: SerializeField] public SkillType SkillType { get; private set; } + [field: SerializeField] public string NameSkill { get; private set; } + [field: SerializeField] public int BaseValueSkill { get; private set; } + [field: SerializeField] public string TypeSkill { get; private set; } + [field: SerializeField] public string DescriptionSkill { get; private set; } + + [Space] [Header("PRICE(x) = a1*((a2*x)^3) + b1*((b2*x)^2) + c*x + d")] [SerializeField] + private int a1; - [Space] [Header("PRICE(x) = a1*((a2*x)^3) + b1*((b2*x)^2) + c*x + d")] - [SerializeField] private int a1; [SerializeField] private int a2; [SerializeField] private int b1; [SerializeField] private int b2; [SerializeField] private int c; [SerializeField] private int d; - public int GetPriceForLevel(int level) => a1 * ((a2 * level) ^ 3) + b1 * ((b2 * level) ^ 2) + c * level + d; + + public int GetPriceForLevel(int level) + { + return a1 * (a2 * level ^ 3) + b1 * (b2 * level ^ 2) + c * level + d; + } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Data/Static/StaticData.cs b/Assets/Internal assets/Scripts/Data/Static/StaticData.cs new file mode 100644 index 0000000..ceefb59 --- /dev/null +++ b/Assets/Internal assets/Scripts/Data/Static/StaticData.cs @@ -0,0 +1,12 @@ +#region + +using UnityEngine; + +#endregion + +namespace Data.Static +{ + public class StaticData : ScriptableObject + { + } +} diff --git a/Assets/Internal assets/Scripts/Data/Static/StaticData.cs.meta b/Assets/Internal assets/Scripts/Data/Static/StaticData.cs.meta new file mode 100644 index 0000000..1b58bc7 --- /dev/null +++ b/Assets/Internal assets/Scripts/Data/Static/StaticData.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 14511c4ed6174e6d96ce09be56a3b7ba +timeCreated: 1684967653 \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Dummy/DummyController.cs b/Assets/Internal assets/Scripts/Dummy/DummyController.cs index afda344..0e8a01c 100644 --- a/Assets/Internal assets/Scripts/Dummy/DummyController.cs +++ b/Assets/Internal assets/Scripts/Dummy/DummyController.cs @@ -1,57 +1,69 @@ +#region + using System.Collections; -using Item; using UnityEngine; +#endregion + namespace Dummy { public class DummyController : MonoBehaviour { - private static readonly int Damage = Animator.StringToHash("Damage"); - private static readonly int Dead = Animator.StringToHash("Dead"); - private static readonly int Reset = Animator.StringToHash("Reset"); + private readonly static int Damage = Animator.StringToHash("Damage"); + private readonly static int Dead = Animator.StringToHash("Dead"); + private readonly static int Reset = Animator.StringToHash("Reset"); - private Animator _animator; + [SerializeField] private float healthMax; + [SerializeField] private float timeRestart; - private int _health = 100; - private bool _isAction = false; + private Animator _animator; + private float _health; + private bool _isAction; - private int Health + private void Start() { - get => _health; - set + _animator = GetComponent(); + _health = healthMax; + foreach (var dummyGetHit in GetComponentsInChildren()) { - _health = value; - if (_health > 0) return; - _animator.SetTrigger(Dead); - StartCoroutine(Restart()); + dummyGetHit.RegisterOnGetHit(TakeDamage); } } - private void Start() + public void AnimationTriggerAction() { - _animator = GetComponent(); + _isAction = true; + } + + public void AnimationTriggerIdle() + { + _isAction = false; + } + + public void AnimationTriggerRevived() + { + _health = healthMax; } - private void OnCollisionEnter(Collision other) + private void TakeDamage(float damage) { - if (!_isAction && other.gameObject.TryGetComponent(out var itemDamage)) + if (_isAction) return; + _health -= damage; + + if (_health > 0) { - if (itemDamage.IsDamage) - { - _animator.SetTrigger(Damage); - Health -= (int)itemDamage.Damage; - } + _animator.SetTrigger(Damage); + } + else + { + _animator.SetTrigger(Dead); + StartCoroutine(Restart()); } } - //using animation - public void Action() => _isAction = true; - public void Idle() => _isAction = false; - public void Revived() => _health = 1000; - private IEnumerator Restart() { - yield return new WaitForSeconds(3.5f); + yield return new WaitForSeconds(timeRestart); _animator.SetTrigger(Reset); } } diff --git a/Assets/Internal assets/Scripts/Dummy/DummyGetHit.cs b/Assets/Internal assets/Scripts/Dummy/DummyGetHit.cs new file mode 100644 index 0000000..6a6fd00 --- /dev/null +++ b/Assets/Internal assets/Scripts/Dummy/DummyGetHit.cs @@ -0,0 +1,33 @@ +#region + +using Item; +using UnityEngine; +using UnityEngine.Events; + +#endregion + +namespace Dummy +{ + public class DummyGetHit : MonoBehaviour + { + private UnityAction _onGetHit; + + private void OnTriggerEnter(Collider other) + { + if (other.gameObject.TryGetComponent(out var itemDamage) && itemDamage.IsDamage) + { + _onGetHit?.Invoke(itemDamage.Damage); + } + } + + public void RegisterOnGetHit(UnityAction onGetHit) + { + _onGetHit = onGetHit; + } + + public void UnregisterOnGetHit(UnityAction onGetHit) + { + _onGetHit -= onGetHit; + } + } +} diff --git a/Assets/Internal assets/Scripts/Dummy/DummyGetHit.cs.meta b/Assets/Internal assets/Scripts/Dummy/DummyGetHit.cs.meta new file mode 100644 index 0000000..162b212 --- /dev/null +++ b/Assets/Internal assets/Scripts/Dummy/DummyGetHit.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: eaee59315ea74a7293cf12dfb450d2b2 +timeCreated: 1685030011 \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Dummy/DummyUpdateCollider.cs b/Assets/Internal assets/Scripts/Dummy/DummyUpdateCollider.cs new file mode 100644 index 0000000..b3690c4 --- /dev/null +++ b/Assets/Internal assets/Scripts/Dummy/DummyUpdateCollider.cs @@ -0,0 +1,79 @@ +#region + +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +#endregion + +namespace Dummy +{ + public class DummyUpdateCollider : MonoBehaviour + { + private Mesh _mesh; + private MeshCollider _meshCollider; + private MeshFilter _meshFilter; + private SkinnedMeshRenderer _skinnedMeshRenderer; + private List CollidersInChildrenNonTriggers { get; } = new List(); + + private void Awake() + { + _meshCollider = GetComponent(); + _meshFilter = GetComponentInChildren(); + _skinnedMeshRenderer = GetComponentInChildren(); + + _mesh = new Mesh(); + + FillAllCollidersInChildrenNonTriggers(); + } + + private void Start() + { + StartCoroutine(UpdateNewMesh()); + } + + public void AnimationTriggerAction() + { + _meshCollider.enabled = false; + foreach (var childrenCollider in CollidersInChildrenNonTriggers) + { + childrenCollider.enabled = true; + } + } + + public void AnimationTriggerIdle() + { + _meshCollider.enabled = true; + foreach (var childrenCollider in CollidersInChildrenNonTriggers) + { + childrenCollider.enabled = false; + } + } + + private IEnumerator UpdateNewMesh() + { + _skinnedMeshRenderer.BakeMesh(_mesh); + + _meshFilter.mesh = _mesh; + _meshFilter.mesh.RecalculateBounds(); + + yield return new WaitForSeconds(0.1f); + + _meshCollider.sharedMesh = _mesh; + _meshCollider.sharedMesh.RecalculateBounds(); + } + + private void FillAllCollidersInChildrenNonTriggers() + { + var colliders = transform.GetComponentsInChildren(); + + foreach (var thisCollider in colliders + .Where(thisCollider => thisCollider is not MeshCollider) + .Where(thisCollider => thisCollider.isTrigger == false)) + { + CollidersInChildrenNonTriggers.Add(thisCollider); + } + } + } +} diff --git a/Assets/Internal assets/Scripts/Dummy/DummyUpdateMesh.cs.meta b/Assets/Internal assets/Scripts/Dummy/DummyUpdateCollider.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Dummy/DummyUpdateMesh.cs.meta rename to Assets/Internal assets/Scripts/Dummy/DummyUpdateCollider.cs.meta diff --git a/Assets/Internal assets/Scripts/Dummy/DummyUpdateMesh.cs b/Assets/Internal assets/Scripts/Dummy/DummyUpdateMesh.cs deleted file mode 100644 index dc9fd3f..0000000 --- a/Assets/Internal assets/Scripts/Dummy/DummyUpdateMesh.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -namespace Dummy -{ - public class DummyUpdateMesh : MonoBehaviour - { - private Mesh _mesh; - private MeshFilter _meshFilter; - private MeshCollider _meshCollider; - private SkinnedMeshRenderer _skinnedMeshRenderer; - - private Collider[] _childrenColliders; - - private void Awake() - { - _meshCollider = GetComponent(); - _meshFilter = GetComponentInChildren(); - _skinnedMeshRenderer = GetComponentInChildren(); - - _mesh = new Mesh(); - - _childrenColliders = GetAllCollidersInChildren(transform); - } - - private void Start() - { - StartCoroutine(UpdateNewMesh()); - } - - public void Action() - { - _meshCollider.enabled = false; - foreach (var collider in _childrenColliders) - { - collider.enabled = true; - } - } - - public void Idle() - { - _meshCollider.enabled = true; - foreach (var collider in _childrenColliders) - { - collider.enabled = false; - } - } - - private IEnumerator UpdateNewMesh() - { - _skinnedMeshRenderer.BakeMesh(_mesh); - - _meshFilter.mesh = _mesh; - _meshFilter.mesh.RecalculateBounds(); - - yield return new WaitForSeconds(0.1f); - - _meshCollider.sharedMesh = _mesh; - _meshCollider.sharedMesh.RecalculateBounds(); - } - - private Collider[] GetAllCollidersInChildren(Transform parentTransform) - { - var colliders = new List(); - - var childCount = parentTransform.childCount; - for (var i = 0; i < childCount; i++) - { - var childTransform = parentTransform.GetChild(i); - - var childColliders = childTransform.GetComponents(); - if (childColliders != null && childColliders.Length > 0) - { - colliders.AddRange(childColliders); - } - - if (childTransform.childCount > 0) - { - var childCollidersInChildren = GetAllCollidersInChildren(childTransform); - - if (childCollidersInChildren != null && childCollidersInChildren.Length > 0) - { - colliders.AddRange(childCollidersInChildren); - } - } - } - - return colliders.ToArray(); - } - } -} \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/DungeonGenerator/DungeonGenerator.cs b/Assets/Internal assets/Scripts/DungeonGenerator/DungeonGenerator.cs index a8ecf6a..8d427c6 100644 --- a/Assets/Internal assets/Scripts/DungeonGenerator/DungeonGenerator.cs +++ b/Assets/Internal assets/Scripts/DungeonGenerator/DungeonGenerator.cs @@ -1,15 +1,20 @@ -using System; +#region + +using System; using System.Collections.Generic; +using System.Threading.Tasks; using DungeonGenerator.Tiles; using DungeonGenerator.Tiles.Interface; using Random = UnityEngine.Random; +#endregion namespace DungeonGenerator { public static class DungeonGenerator { - public static (ITile[,] dungeonMap, (int, int) playerPosition, List<(int, int)> enemiesPosition) + public static async Task<(ITile[,] dungeonMap, (int x, int y) playerPosition, List<(int x, int y)> + enemiesPosition)> GetDungeon(int seed) { const int minRoomSize = 4; @@ -19,7 +24,7 @@ public static (ITile[,] dungeonMap, (int, int) playerPosition, List<(int, int)> const int width = 45; const int height = 45; - var map = Generation( + var map = await Generation( seed, minRoomSize, maxRoomSize, @@ -31,16 +36,62 @@ public static (ITile[,] dungeonMap, (int, int) playerPosition, List<(int, int)> return map; } + #region Generation Enemy + + private static List<(int x, int y)> GetEnemiesPosition( + List rooms, DungeonRoomCharacteristic startDungeonRoomCharacteristic, + ITile[,] dungeonMap, int height, int width) + { + var enemyPosition = new List<(int x, int y)>(); + var tilesMap = (ITile[,])dungeonMap.Clone(); + + + for (var y = startDungeonRoomCharacteristic.Y - startDungeonRoomCharacteristic.Height / 2 - 5; + y < startDungeonRoomCharacteristic.Y - startDungeonRoomCharacteristic.Height / 2 + 7; + y++) + { + if (y < 0 || y > height - 1) continue; + for (var x = startDungeonRoomCharacteristic.X - startDungeonRoomCharacteristic.Width / 2 - 5; + x < startDungeonRoomCharacteristic.X - startDungeonRoomCharacteristic.Width / 2 + 7; + x++) + { + if (x < 0 || x > width - 1) continue; + if (tilesMap[y, x] is FloorTile) + tilesMap[y, x] = new EmptyTile(); + } + } + + foreach (var room in rooms) + { + for (var i = 0; i < (room.Height * room.Width / 20 == 0 ? 1 : room.Height * room.Width / 20); i++) + for (var flag = 0; flag < 25; flag++) + { + (int x, int y) position = ( + Random.Range(room.X - room.Width / 2, room.X + room.Width / 2), + Random.Range(room.Y - room.Height / 2, room.Y + room.Height / 2)); + + if (tilesMap[position.x, position.y] is not FloorTile) continue; + + enemyPosition.Add(position); + break; + } + } + + return enemyPosition; + } + + #endregion + #region Generation Map - private static (ITile[,] dungeonMap, (int, int) playerPosition, List<(int, int)> enemiesPosition) - Generation(int seed, - int minRoomSize, - int maxRoomSize, - int minRoomCount, - int maxRoomCount, - int width, - int height) + private static Task<(ITile[,] tilesMap, (int x, int y), List<(int, int)> enemyPosition)> Generation( + int seed, + int minRoomSize, + int maxRoomSize, + int minRoomCount, + int maxRoomCount, + int width, + int height) { var tilesMap = FillInWalls(height, width); @@ -56,12 +107,12 @@ private static (ITile[,] dungeonMap, (int, int) playerPosition, List<(int, int)> height); AddCorridors(ref tilesMap, ref rooms); - AddPlayer(ref rooms, ref tilesMap, out var startRoom); - ClearWall(height, width, ref tilesMap); + AddPlayer(ref rooms, out var startRoom); + AddWalls(height, width, ref tilesMap); AddedLight(height, width, ref tilesMap); var enemyPosition = GetEnemiesPosition(rooms, startRoom, tilesMap, height, width); - return (tilesMap, (startRoom.x, startRoom.y), enemyPosition); + return Task.FromResult((tilesMap, (x: startRoom.X, y: startRoom.Y), enemyPosition)); } private static ITile[,] FillInWalls(int height, int width) @@ -87,18 +138,18 @@ private static void AddRooms(ref ITile[,] tilesMap, out List rooms, ref ITile[,] tilesMap, + private static void AddPlayer(ref List rooms, out DungeonRoomCharacteristic startDungeonRoomCharacteristic) { var distHi = 0; @@ -134,7 +185,7 @@ private static void AddPlayer(ref List rooms, ref ITi for (var i = 0; i != rooms.Count; ++i) for (var j = 0; j != rooms.Count; ++j) { - var dist = Math.Abs(rooms[i].x - rooms[j].x) + Math.Abs(rooms[i].y - rooms[j].y); + var dist = Math.Abs(rooms[i].X - rooms[j].X) + Math.Abs(rooms[i].Y - rooms[j].Y); if (dist <= distHi) continue; distHi = dist; startIdx = i; @@ -144,15 +195,17 @@ private static void AddPlayer(ref List rooms, ref ITi rooms.Remove(startDungeonRoomCharacteristic); } - private static void ClearWall(int height, int width, ref ITile[,] tilesMap) + private static void AddWalls(int height, int width, ref ITile[,] tilesMap) { for (var y = 0; y < height; y++) for (var x = 0; x < width; x++) if (tilesMap[y, x] is FloorTile) + { for (var dy = -1; dy <= 1; ++dy) for (var dx = -1; dx <= 1; ++dx) if (tilesMap[y + dy, x + dx] is EmptyTile) tilesMap[y + dy, x + dx] = new WallTile(); + } } private static void AddedLight(int height, int width, ref ITile[,] tilesMap) @@ -163,82 +216,37 @@ private static void AddedLight(int height, int width, ref ITile[,] tilesMap) if (tilesMap[y, x] is not WallTile tile) continue; var isLightVisible = false; - for (var dy = -2; dy <= 2; dy++) - if (tilesMap[y + dy, x] is WallTile tileTemp) - if (tileTemp.IsLight) - isLightVisible = true; - for (var dx = -2; dx <= 2; dx++) - if (tilesMap[y, x + dx] is WallTile tileTemp) - if (tileTemp.IsLight) - isLightVisible = true; + for (var dy = -2; dy <= 2; dy++) + if (tilesMap[y + dy, x] is WallTile { IsLight: true }) + { + isLightVisible = true; + break; + } if (isLightVisible) continue; - if (tilesMap[y + 1, x] is FloorTile) - { - tile.LightDirectionType = WallTile.DirectionType.Up; - tile.IsLight = true; - } - else if (tilesMap[y - 1, x] is FloorTile) - { - tile.LightDirectionType = WallTile.DirectionType.Down; - tile.IsLight = true; - } - else if (tilesMap[y, x + 1] is FloorTile) - { - tile.LightDirectionType = WallTile.DirectionType.Right; - tile.IsLight = true; - } - else if (tilesMap[y, x - 1] is FloorTile) - { - tile.LightDirectionType = WallTile.DirectionType.Left; - tile.IsLight = true; - } - } - } - #endregion - - #region Generation Enemy - - private static List<(int, int)> GetEnemiesPosition( - List rooms, DungeonRoomCharacteristic startDungeonRoomCharacteristic, - ITile[,] dungeonMap, int height, int width) - { - var enemyPosition = new List<(int, int)>(); - var tilesMap = (ITile[,])dungeonMap.Clone(); + for (var dx = -2; dx <= 2; dx++) + if (tilesMap[y, x + dx] is WallTile { IsLight: true }) + { + isLightVisible = true; + break; + } + if (isLightVisible) continue; - for (var y = startDungeonRoomCharacteristic.y - startDungeonRoomCharacteristic.height / 2 - 5; - y < startDungeonRoomCharacteristic.y - startDungeonRoomCharacteristic.height / 2 + 7; - y++) - { - if (y < 0 || y > height - 1) continue; - for (var x = startDungeonRoomCharacteristic.x - startDungeonRoomCharacteristic.width / 2 - 5; - x < startDungeonRoomCharacteristic.x - startDungeonRoomCharacteristic.width / 2 + 7; - x++) - { - if (x < 0 || x > width - 1) continue; - if (tilesMap[y, x] is FloorTile) - tilesMap[y, x] = new EmptyTile(); - } + for (var i = y - 1; i <= y + 1; i++) + for (var j = x - 1; j <= x + 1; j++) + if ((j != x || i != y) && tilesMap[i, j] is FloorTile) + { + if (i == y - 1) tile.LightDirectionType = WallTile.DirectionType.Up; + else if (i == y + 1) tile.LightDirectionType = WallTile.DirectionType.Down; + else if (j == x - 1) tile.LightDirectionType = WallTile.DirectionType.Left; + else if (j == x + 1) tile.LightDirectionType = WallTile.DirectionType.Right; + + tile.IsLight = true; + } } - - foreach (var room in rooms) - for (var i = 0; i < (room.height * room.width / 20 == 0 ? 1 : room.height * room.width / 20); i++) - for (var flag = 0; flag < 25; flag++) - { - var position = ( - Random.Range(room.x - room.width / 2, room.x + room.width / 2), - Random.Range(room.y - room.height / 2, room.y + room.height / 2)); - - if (tilesMap[position.Item1, position.Item2] is not FloorTile) continue; - - enemyPosition.Add(position); - break; - } - - return enemyPosition; } #endregion @@ -252,15 +260,15 @@ private static int IntHash(ref int x) x = 1; } - x = ((x >> 16) ^ x) * 0x45d9f3b; - x = ((x >> 16) ^ x) * 0x45d9f3b; - x = (x >> 16) ^ x; + x = (x >> 16 ^ x) * 0x45d9f3b; + x = (x >> 16 ^ x) * 0x45d9f3b; + x = x >> 16 ^ x; return x; } private static int RandomRange(ref int seed, int min, int max) { - var range = IntHash(ref seed) % ((max + 1) - min); + var range = IntHash(ref seed) % (max + 1 - min); return min + range; } @@ -278,4 +286,4 @@ private static void CarveFloor(ref ITile[,] tilesMap, int y, int x, int height, #endregion } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/DungeonGenerator/DungeonRoomCharacteristic.cs b/Assets/Internal assets/Scripts/DungeonGenerator/DungeonRoomCharacteristic.cs index 4e856a0..2446f4b 100644 --- a/Assets/Internal assets/Scripts/DungeonGenerator/DungeonRoomCharacteristic.cs +++ b/Assets/Internal assets/Scripts/DungeonGenerator/DungeonRoomCharacteristic.cs @@ -1,10 +1,10 @@ namespace DungeonGenerator { - public struct DungeonRoomCharacteristic + public class DungeonRoomCharacteristic { - public int x; - public int y; - public int width; - public int height; + public int Height; + public int Width; + public int X; + public int Y; } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/DungeonGenerator/DungeonTilesType.cs b/Assets/Internal assets/Scripts/DungeonGenerator/DungeonTilesType.cs deleted file mode 100644 index b0817b5..0000000 --- a/Assets/Internal assets/Scripts/DungeonGenerator/DungeonTilesType.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace DungeonGenerator -{ - public enum DungeonTilesType - { - FLOOR, - WALL, - EMPTY - } -} \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/DungeonGenerator/DungeonTilesType.cs.meta b/Assets/Internal assets/Scripts/DungeonGenerator/DungeonTilesType.cs.meta deleted file mode 100644 index e3e51a2..0000000 --- a/Assets/Internal assets/Scripts/DungeonGenerator/DungeonTilesType.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: e029562f5bdc46108db575068df4e107 -timeCreated: 1683492792 \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/DungeonGenerator/Tiles/EmptyTile.cs b/Assets/Internal assets/Scripts/DungeonGenerator/Tiles/EmptyTile.cs index 104bdd3..6341a96 100644 --- a/Assets/Internal assets/Scripts/DungeonGenerator/Tiles/EmptyTile.cs +++ b/Assets/Internal assets/Scripts/DungeonGenerator/Tiles/EmptyTile.cs @@ -1,9 +1,12 @@ -using DungeonGenerator.Tiles.Interface; +#region + +using DungeonGenerator.Tiles.Interface; + +#endregion namespace DungeonGenerator.Tiles { public class EmptyTile : ITile { - public DungeonTilesType Type { get; set; } = DungeonTilesType.EMPTY; } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/DungeonGenerator/Tiles/FloorTile.cs b/Assets/Internal assets/Scripts/DungeonGenerator/Tiles/FloorTile.cs index eef8ecc..d6a96af 100644 --- a/Assets/Internal assets/Scripts/DungeonGenerator/Tiles/FloorTile.cs +++ b/Assets/Internal assets/Scripts/DungeonGenerator/Tiles/FloorTile.cs @@ -1,10 +1,13 @@ -using DungeonGenerator.Tiles.Interface; +#region + +using DungeonGenerator.Tiles.Interface; + +#endregion namespace DungeonGenerator.Tiles { public class FloorTile : ITile { - public DungeonTilesType Type { get; set; } = DungeonTilesType.FLOOR; public bool IsOccupied; } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/DungeonGenerator/Tiles/Interface/ITile.cs b/Assets/Internal assets/Scripts/DungeonGenerator/Tiles/Interface/ITile.cs index 9668abb..850d186 100644 --- a/Assets/Internal assets/Scripts/DungeonGenerator/Tiles/Interface/ITile.cs +++ b/Assets/Internal assets/Scripts/DungeonGenerator/Tiles/Interface/ITile.cs @@ -2,6 +2,5 @@ { public interface ITile { - DungeonTilesType Type { get; set; } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/DungeonGenerator/Tiles/WallTile.cs b/Assets/Internal assets/Scripts/DungeonGenerator/Tiles/WallTile.cs index 29c84fc..dfb54a6 100644 --- a/Assets/Internal assets/Scripts/DungeonGenerator/Tiles/WallTile.cs +++ b/Assets/Internal assets/Scripts/DungeonGenerator/Tiles/WallTile.cs @@ -1,11 +1,13 @@ -using DungeonGenerator.Tiles.Interface; +#region + +using DungeonGenerator.Tiles.Interface; + +#endregion namespace DungeonGenerator.Tiles { public class WallTile : ITile { - public DungeonTilesType Type { get; set; } = DungeonTilesType.WALL; - public bool IsLight; public DirectionType LightDirectionType; @@ -18,4 +20,3 @@ public enum DirectionType } } } - diff --git a/Assets/Internal assets/Scripts/Infrastructure/Factory/AbstractFactory/AbstractFactory.cs b/Assets/Internal assets/Scripts/Infrastructure/Factory/AbstractFactory/AbstractFactory.cs index d2a460a..19ac9c1 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/Factory/AbstractFactory/AbstractFactory.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/Factory/AbstractFactory/AbstractFactory.cs @@ -1,9 +1,13 @@ -using System; +#region + +using System; using System.Collections.Generic; using UnityEngine; using Zenject; using Object = UnityEngine.Object; +#endregion + namespace Infrastructure.Factory.AbstractFactory { public class AbstractFactory : IAbstractFactory @@ -14,12 +18,13 @@ public AbstractFactory(DiContainer container) } private readonly DiContainer _container; + public List Instances { get; } = new(); public GameObject CreateInstance(GameObject prefab, Vector3 spawnPoint) { var instance = _container.InstantiatePrefab(prefab, spawnPoint, Quaternion.identity, null); - + Instances.Add(instance); return instance; @@ -31,10 +36,11 @@ public void DestroyInstance(GameObject instance) { throw new NullReferenceException("There is no instance to destroy"); } - + if (!Instances.Contains(instance)) { - throw new NullReferenceException($"Instance {instance} can't be destroyed, cause there is no {instance} on Abstract Factory Instances"); + throw new NullReferenceException( + $"Instance {instance} can't be destroyed, cause there is no {instance} on Abstract Factory Instances"); } Object.Destroy(instance); @@ -43,22 +49,12 @@ public void DestroyInstance(GameObject instance) public void DestroyAllInstances() { - for (int i = 0; i < Instances.Count; i++) + foreach (var gameObject in Instances) { - Object.Destroy(Instances[i]); + Object.Destroy(gameObject); } - - Instances.Clear(); - } - public void DestroyAllInstances(List list) where T : Object - { - for (int i = 0; i < list.Count; i++) - { - Object.Destroy(list[i]); - } - - list.Clear(); + Instances.Clear(); } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/Factory/AbstractFactory/IAbstractFactory.cs b/Assets/Internal assets/Scripts/Infrastructure/Factory/AbstractFactory/IAbstractFactory.cs index 4a4390c..270d8ac 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/Factory/AbstractFactory/IAbstractFactory.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/Factory/AbstractFactory/IAbstractFactory.cs @@ -1,10 +1,15 @@ -using UnityEngine; -using IFactory = Infrastructure.Factory.Model.IFactory; +#region + +using UnityEngine; + +#endregion namespace Infrastructure.Factory.AbstractFactory { - public interface IAbstractFactory : IAbstractFactoryInfo, IFactory + public interface IAbstractFactory : IAbstractFactoryInfo { - public GameObject CreateInstance(GameObject prefab, Vector3 spawnPoint); + GameObject CreateInstance(GameObject prefab, Vector3 spawnPoint); + void DestroyInstance(GameObject instance); + void DestroyAllInstances(); } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/Factory/AbstractFactory/IAbstractFactoryInfo.cs b/Assets/Internal assets/Scripts/Infrastructure/Factory/AbstractFactory/IAbstractFactoryInfo.cs index 9ba26be..1e0c80a 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/Factory/AbstractFactory/IAbstractFactoryInfo.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/Factory/AbstractFactory/IAbstractFactoryInfo.cs @@ -1,10 +1,14 @@ -using System.Collections.Generic; +#region + +using System.Collections.Generic; using UnityEngine; +#endregion + namespace Infrastructure.Factory.AbstractFactory { public interface IAbstractFactoryInfo { - public List Instances { get; } + List Instances { get; } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/Factory/EnemyFactory/EnemyFactory.cs b/Assets/Internal assets/Scripts/Infrastructure/Factory/EnemyFactory/EnemyFactory.cs index 007df0e..8b2d263 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/Factory/EnemyFactory/EnemyFactory.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/Factory/EnemyFactory/EnemyFactory.cs @@ -1,18 +1,20 @@ -using System; +#region + +using System; using System.Collections.Generic; using System.Threading.Tasks; -using Data.Addressable; using Data.Static; using Infrastructure.Factory.PlayerFactory; using Services.AssetsAddressableService; using Services.StaticData; using Units.Enemy; -using Unity.VisualScripting; using UnityEngine; using UnityEngine.Events; using Zenject; using Object = UnityEngine.Object; +#endregion + namespace Infrastructure.Factory.EnemyFactory { public class EnemyFactory : IEnemyFactory @@ -22,16 +24,16 @@ public EnemyFactory(DiContainer container, IStaticDataService staticDataService, IPlayerFactory playerFactory) { - _container = container; _assetsAddressableService = assetsAddressableService; _staticDataService = staticDataService; _playerFactory = playerFactory; + _container = container; } private readonly IAssetsAddressableService _assetsAddressableService; - private readonly IStaticDataService _staticDataService; - private readonly IPlayerFactory _playerFactory; private readonly DiContainer _container; + private readonly IPlayerFactory _playerFactory; + private readonly IStaticDataService _staticDataService; public event UnityAction AllDeadEnemies; public List Instances { get; } = new(); @@ -89,16 +91,6 @@ public void DestroyAllInstances() Instances.Clear(); } - public void DestroyAllInstances(List list) where T : Object - { - foreach (var value in list) - { - Object.Destroy(value); - } - - list.Clear(); - } - private void SetUp(GameObject instance, EnemyStaticData enemyStaticData) { var enemy = instance.TryGetComponent(out Enemy enemyComponent) @@ -108,13 +100,12 @@ private void SetUp(GameObject instance, EnemyStaticData enemyStaticData) enemy.SetUp( enemyStaticData.MaxHealthPoints, enemyStaticData.EffectiveDistance, - enemyStaticData.Cleavage, enemyStaticData.AttackCooldown, enemyStaticData.Damage, enemyStaticData.MovementSpeed, enemyStaticData.RotationSpeed, _playerFactory.PlayerInstance.transform, - this); + DeadEnemy); } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/Factory/EnemyFactory/IEnemyFactory.cs b/Assets/Internal assets/Scripts/Infrastructure/Factory/EnemyFactory/IEnemyFactory.cs index dcda41c..e84bd59 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/Factory/EnemyFactory/IEnemyFactory.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/Factory/EnemyFactory/IEnemyFactory.cs @@ -1,14 +1,18 @@ -using System.Threading.Tasks; -using Infrastructure.Factory.Model; +#region + +using System.Threading.Tasks; using Units.Enemy; using UnityEngine; +#endregion + namespace Infrastructure.Factory.EnemyFactory { - public interface IEnemyFactory: IEnemyFactoryInfo, IFactory + public interface IEnemyFactory : IEnemyFactoryInfo { Task CreateInstance(EnemyType enemyType, Vector3 position); - + void DestroyInstance(GameObject instance); + void DestroyAllInstances(); void DeadEnemy(Enemy enemy); } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/Factory/EnemyFactory/IEnemyFactoryInfo.cs b/Assets/Internal assets/Scripts/Infrastructure/Factory/EnemyFactory/IEnemyFactoryInfo.cs index ddbbcf8..1e3e1ee 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/Factory/EnemyFactory/IEnemyFactoryInfo.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/Factory/EnemyFactory/IEnemyFactoryInfo.cs @@ -1,15 +1,18 @@ -using System; +#region + using System.Collections.Generic; using Units.Enemy; using UnityEngine; using UnityEngine.Events; +#endregion + namespace Infrastructure.Factory.EnemyFactory { public interface IEnemyFactoryInfo { - event UnityAction AllDeadEnemies; List Instances { get; } List Enemies { get; } + event UnityAction AllDeadEnemies; } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/Factory/Model.meta b/Assets/Internal assets/Scripts/Infrastructure/Factory/Model.meta deleted file mode 100644 index e8206d9..0000000 --- a/Assets/Internal assets/Scripts/Infrastructure/Factory/Model.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 4065f716ddf14f1092646bb14cf472ca -timeCreated: 1683096079 \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Infrastructure/Factory/Model/IFactory.cs b/Assets/Internal assets/Scripts/Infrastructure/Factory/Model/IFactory.cs deleted file mode 100644 index 0272cda..0000000 --- a/Assets/Internal assets/Scripts/Infrastructure/Factory/Model/IFactory.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace Infrastructure.Factory.Model -{ - public interface IFactory - { - public void DestroyInstance(GameObject instance); - public void DestroyAllInstances(); - public void DestroyAllInstances(List list) where T : Object; - } -} \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Infrastructure/Factory/Model/IFactory.cs.meta b/Assets/Internal assets/Scripts/Infrastructure/Factory/Model/IFactory.cs.meta deleted file mode 100644 index b60a8d9..0000000 --- a/Assets/Internal assets/Scripts/Infrastructure/Factory/Model/IFactory.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: c5aa7789b90f4a61806b6f61fb542ac7 -timeCreated: 1683096110 \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Infrastructure/Factory/PlayerFactory/IPlayerFactory.cs b/Assets/Internal assets/Scripts/Infrastructure/Factory/PlayerFactory/IPlayerFactory.cs index 6d16997..a0cb9be 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/Factory/PlayerFactory/IPlayerFactory.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/Factory/PlayerFactory/IPlayerFactory.cs @@ -1,4 +1,8 @@ -using UnityEngine; +#region + +using UnityEngine; + +#endregion namespace Infrastructure.Factory.PlayerFactory { @@ -7,4 +11,4 @@ public interface IPlayerFactory : IPlayerFactoryInfo GameObject CreatePlayer(GameObject prefab, Vector3 position); void DestroyPlayer(); } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/Factory/PlayerFactory/IPlayerFactoryInfo.cs b/Assets/Internal assets/Scripts/Infrastructure/Factory/PlayerFactory/IPlayerFactoryInfo.cs index 386e647..2da2467 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/Factory/PlayerFactory/IPlayerFactoryInfo.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/Factory/PlayerFactory/IPlayerFactoryInfo.cs @@ -1,4 +1,8 @@ -using UnityEngine; +#region + +using UnityEngine; + +#endregion namespace Infrastructure.Factory.PlayerFactory { @@ -6,4 +10,4 @@ public interface IPlayerFactoryInfo { GameObject PlayerInstance { get; } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/Factory/PlayerFactory/PlayerFactory.cs b/Assets/Internal assets/Scripts/Infrastructure/Factory/PlayerFactory/PlayerFactory.cs index 6b4a4b3..3611926 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/Factory/PlayerFactory/PlayerFactory.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/Factory/PlayerFactory/PlayerFactory.cs @@ -1,6 +1,10 @@ -using UnityEngine; +#region + +using UnityEngine; using Zenject; +#endregion + namespace Infrastructure.Factory.PlayerFactory { public class PlayerFactory : IPlayerFactory @@ -11,8 +15,8 @@ public PlayerFactory(DiContainer container) } private readonly DiContainer _container; - public GameObject PlayerInstance { get; private set; } + public GameObject PlayerInstance { get; private set; } public GameObject CreatePlayer(GameObject prefab, Vector3 position) { @@ -28,4 +32,4 @@ public void DestroyPlayer() Object.Destroy(PlayerInstance); } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/Factory/UIFactory/IUIFactory.cs b/Assets/Internal assets/Scripts/Infrastructure/Factory/UIFactory/IUIFactory.cs index aeb5e80..ee20b86 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/Factory/UIFactory/IUIFactory.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/Factory/UIFactory/IUIFactory.cs @@ -1,6 +1,9 @@ +#region + using System.Threading.Tasks; using UnityEngine; -using UnityEngine.UI; + +#endregion namespace Infrastructure.Factory.UIFactory { @@ -8,21 +11,20 @@ public interface IUIFactory : IUIInfo { public Task CreateLoadingScreen(); public void DestroyLoadingScreen(); - + public Task CreateMainLocationScreen(); public void DestroyMainLocationScreen(); public Task CreateMainMenuScreen(); public void DestroyMainMenuScreen(); - + public Task CreateMenuInDungeonRoomScreen(); public void DestroyMenuInDungeonRoomScreen(); public Task CreateMenuInMainLocationScreen(); public void DestroyMenuInMainLocationScreen(); - + public Task CreateSkillsBookScreen(); public void DestroySkillsBookScreen(); } } - diff --git a/Assets/Internal assets/Scripts/Infrastructure/Factory/UIFactory/IUIInfo.cs b/Assets/Internal assets/Scripts/Infrastructure/Factory/UIFactory/IUIInfo.cs index 2d4482b..8d08a3d 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/Factory/UIFactory/IUIInfo.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/Factory/UIFactory/IUIInfo.cs @@ -1,5 +1,9 @@ +#region + using UnityEngine; +#endregion + namespace Infrastructure.Factory.UIFactory { public interface IUIInfo @@ -10,7 +14,5 @@ public interface IUIInfo public GameObject MenuInDungeonRoomScreen { get; } public GameObject MenuInMainLocationScreen { get; } public GameObject SkillsBookScreen { get; } - } } - diff --git a/Assets/Internal assets/Scripts/Infrastructure/Factory/UIFactory/UIFactory.cs b/Assets/Internal assets/Scripts/Infrastructure/Factory/UIFactory/UIFactory.cs index 511cc2c..9ed36d0 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/Factory/UIFactory/UIFactory.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/Factory/UIFactory/UIFactory.cs @@ -1,9 +1,13 @@ +#region + using System.Threading.Tasks; using Data.Addressable; using Services.AssetsAddressableService; using UnityEngine; using Zenject; +#endregion + namespace Infrastructure.Factory.UIFactory { public class UIFactory : IUIFactory @@ -31,7 +35,7 @@ public async Task CreateLoadingScreen() { var loadingScreenPrefab = await _assetsAddressableService.GetAsset( - AssetsAddressablesConstants + AssetsAddressableConstants .LOADING_PROCESS_SCREEN); LoadingScreen = _container.InstantiatePrefab(loadingScreenPrefab); @@ -52,7 +56,7 @@ public void DestroyLoadingScreen() public async Task CreateMainLocationScreen() { var gameplayScreenPrefab = - await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.MAIN_LOCATION_SCREEN); + await _assetsAddressableService.GetAsset(AssetsAddressableConstants.MAIN_LOCATION_SCREEN); MainLocationScreen = _container.InstantiatePrefab(gameplayScreenPrefab); @@ -72,7 +76,7 @@ public void DestroyMainLocationScreen() public async Task CreateMainMenuScreen() { var mainMenuScreenPrefab = - await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.MAIN_MENU_SCREEN); + await _assetsAddressableService.GetAsset(AssetsAddressableConstants.MAIN_MENU_SCREEN); MainMenuScreen = _container.InstantiatePrefab(mainMenuScreenPrefab); @@ -93,7 +97,7 @@ public async Task CreateMenuInDungeonRoomScreen() { var menuInDungeonRoomScreenPrefab = await _assetsAddressableService.GetAsset( - AssetsAddressablesConstants.MENU_IN_DUNGEON_ROOM_SCREEN); + AssetsAddressableConstants.MENU_IN_DUNGEON_ROOM_SCREEN); MenuInDungeonRoomScreen = _container.InstantiatePrefab(menuInDungeonRoomScreenPrefab); @@ -114,7 +118,7 @@ public async Task CreateMenuInMainLocationScreen() { var menuInMainLocationScreenPrefab = await _assetsAddressableService.GetAsset( - AssetsAddressablesConstants.MENU_IN_MAIN_LOCATION_SCREEN); + AssetsAddressableConstants.MENU_IN_MAIN_LOCATION_SCREEN); MenuInMainLocationScreen = _container.InstantiatePrefab(menuInMainLocationScreenPrefab); @@ -134,7 +138,7 @@ public void DestroyMenuInMainLocationScreen() public async Task CreateSkillsBookScreen() { var skillsBookScreenPrefab = - await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.SKILLS_BOOK_SCREEN); + await _assetsAddressableService.GetAsset(AssetsAddressableConstants.SKILLS_BOOK_SCREEN); SkillsBookScreen = _container.InstantiatePrefab(skillsBookScreenPrefab); @@ -149,4 +153,4 @@ public void DestroySkillsBookScreen() #endregion } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/GameInstance.cs b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/GameInstance.cs index f1f0ab9..d2f8f56 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/GameInstance.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/GameInstance.cs @@ -1,4 +1,6 @@ -using Data.Settings; +#region + +using Data.LocationSettings; using Data.Static; using Infrastructure.Factory.AbstractFactory; using Infrastructure.Factory.EnemyFactory; @@ -13,31 +15,43 @@ using Services.SaveLoad; using Services.Watchers.SaveLoadWatcher; +#endregion + namespace Infrastructure.GlobalStateMachine { public class GameInstance { public GameInstance( - IPersistentProgressService persistentProgressService, IAssetsAddressableService assetsAddressableService, - ISaveLoadInstancesWatcher saveLoadInstancesWatcher, PlayerStaticDefaultData playerStaticDefaultData, MainLocationSettings mainLocationSettings, DungeonRoomSettings dungeonRoomSettings, MainMenuSettings mainMenuSettings, - IAbstractFactory abstractFactory, + IPersistentProgressService persistentProgressService, + ISaveLoadInstancesWatcher saveLoadInstancesWatcher, ISaveLoadService saveLoadService, + IAbstractFactory abstractFactory, IPlayerFactory playerFactory, IEnemyFactory enemyFactory, IUIFactory uiFactory) { StateMachine = new StateMachine( - this, - new BootstrapState(this), - new LoadLastSavedLocation(this, saveLoadService), - new SceneLoadingState(this, uiFactory), - new RemoveProgressData(this, saveLoadService), - new ProgressLoadingState(this, saveLoadService, saveLoadInstancesWatcher, persistentProgressService), + new BootstrapState( + this), + new LoadLastSavedLocationState( + this, + saveLoadService), + new SceneLoadingState( + this, + uiFactory), + new RemoveProgressDataState( + this, + saveLoadService), + new ProgressLoadingState( + this, + saveLoadService, + saveLoadInstancesWatcher, + persistentProgressService), new MainMenuSetUpState( this, abstractFactory, @@ -45,7 +59,12 @@ public GameInstance( assetsAddressableService, mainMenuSettings, playerFactory), - new MainMenuState(this, uiFactory, abstractFactory, saveLoadService, playerFactory), + new MainMenuState( + this, + uiFactory, + abstractFactory, + saveLoadService, + playerFactory), new MainLocationSetUpState( this, abstractFactory, @@ -61,9 +80,13 @@ public GameInstance( saveLoadService, saveLoadInstancesWatcher, abstractFactory, - playerFactory), - new DungeonRoomGenerationState(this, persistentProgressService, saveLoadService), - new DungeonRoomSetUpState( + playerFactory, + persistentProgressService), + new DungeonLocationGenerationState( + this, + persistentProgressService, + saveLoadService), + new DungeonLocationSetUpState( this, abstractFactory, assetsAddressableService, @@ -73,20 +96,20 @@ public GameInstance( enemyFactory, playerFactory, uiFactory), - new DungeonRoomState( + new DungeonLocationState( this, uiFactory, saveLoadService, abstractFactory, enemyFactory, saveLoadInstancesWatcher, - playerFactory, + playerFactory, persistentProgressService) ); - StateMachine.SwitchState(); + StateMachine.SwitchState(typeof(BootstrapState)); } public readonly StateMachine StateMachine; } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/StateMachine/BaseState.cs b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/StateMachine/BaseState.cs index e5e2c67..d9284db 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/StateMachine/BaseState.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/StateMachine/BaseState.cs @@ -2,13 +2,19 @@ { public class BaseState { - protected readonly TContext Context; - public BaseState(TContext context) { Context = context; } - public virtual void Tick() { } - public virtual void Exit() { } + + protected readonly TContext Context; + + public virtual void Tick() + { + } + + public virtual void Exit() + { + } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/StateMachine/State.cs b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/StateMachine/State.cs index 178defc..6bc9792 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/StateMachine/State.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/StateMachine/State.cs @@ -2,7 +2,12 @@ { public class State : BaseState { - public State(TContext context) : base(context) { } - public virtual void Enter() { } + public State(TContext context) : base(context) + { + } + + public virtual void Enter() + { + } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/StateMachine/StateMachine.cs b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/StateMachine/StateMachine.cs index fd4fee5..38dddb0 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/StateMachine/StateMachine.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/StateMachine/StateMachine.cs @@ -1,22 +1,17 @@ -using System; +#region + +using System; using System.Collections.Generic; using System.Threading.Tasks; +#endregion + namespace Infrastructure.GlobalStateMachine.StateMachine { public class StateMachine { - private readonly Dictionary> _states; - - private BaseState CurrentState { get; set; } - - protected float TickRate = 0; - - protected TContext Context; - - public StateMachine(TContext context, params BaseState[] states) + public StateMachine(params BaseState[] states) { - Context = context; _states = new Dictionary>(states.Length); foreach (var state in states) @@ -27,25 +22,18 @@ public StateMachine(TContext context, params BaseState[] states) TickAsync(); } - #region SwitchState - - public void SwitchState() where TState : State - { - CurrentState?.Exit(); + private BaseState CurrentState { get; set; } - TickRate = 0; - - var newState = GetState(); + private readonly Dictionary> _states; - CurrentState = newState; + protected float TickRate; - newState?.Enter(); - } - public void SwitchState(Type type) { CurrentState?.Exit(); + TickRate = 0; + var newState = _states[type] as State; CurrentState = newState; @@ -53,21 +41,12 @@ public void SwitchState(Type type) newState?.Enter(); } - public void SwitchState(T0 arg0) where TState : StateWithParam - { - CurrentState?.Exit(); - - var newState = GetState(); - - CurrentState = newState; - - newState.Enter(arg0); - } - public void SwitchState(Type type, T0 arg0) { CurrentState?.Exit(); + TickRate = 0; + var newState = _states[type] as StateWithParam; CurrentState = newState; @@ -75,8 +54,6 @@ public void SwitchState(Type type, T0 arg0) newState?.Enter(arg0); } - #endregion - private async void TickAsync() { while (true) @@ -93,10 +70,5 @@ private async void TickAsync() CurrentState?.Tick(); } } - - private TState GetState() where TState : BaseState - { - return _states[typeof(TState)] as TState; - } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/StateMachine/StateWithParam.cs b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/StateMachine/StateWithParam.cs index 5ff5ccb..7604acb 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/StateMachine/StateWithParam.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/StateMachine/StateWithParam.cs @@ -2,7 +2,12 @@ { public class StateWithParam : BaseState { - public StateWithParam(TContext context) : base(context) { } - public virtual void Enter(T0 arg0) {} + public StateWithParam(TContext context) : base(context) + { + } + + public virtual void Enter(T0 arg0) + { + } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/BootstrapState.cs b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/BootstrapState.cs index 74d4c81..ec309a4 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/BootstrapState.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/BootstrapState.cs @@ -1,10 +1,14 @@ -using System; +#region + +using System; using Data.Addressable; using Infrastructure.GlobalStateMachine.StateMachine; using Infrastructure.GlobalStateMachine.States.Intermediate; using Infrastructure.GlobalStateMachine.States.MainMenu; using Zenject; +#endregion + namespace Infrastructure.GlobalStateMachine.States { public class BootstrapState : State, IInitializable @@ -15,8 +19,9 @@ public BootstrapState(GameInstance context) : base(context) public void Initialize() { - Context.StateMachine.SwitchState( - (AssetsAddressablesConstants.MAIN_MENU_SCENE_NAME, typeof(MainMenuSetUpState))); + Context.StateMachine.SwitchState<(string sceneName, Type newStateType)>( + typeof(SceneLoadingState), + (AssetsAddressableConstants.MAIN_MENU_SCENE_NAME, typeof(MainMenuSetUpState))); } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonRoomGenerationState.cs b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonLocationGenerationState.cs similarity index 51% rename from Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonRoomGenerationState.cs rename to Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonLocationGenerationState.cs index 3ce8c17..3637662 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonRoomGenerationState.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonLocationGenerationState.cs @@ -1,51 +1,51 @@ -using System.Collections.Generic; -using Data.Dynamic.Location; -using DungeonGenerator; -using DungeonGenerator.Tiles.Interface; -using Infrastructure.GlobalStateMachine.StateMachine; -using Services.PersistentProgress; -using Services.SaveLoad; -using UnityEngine; - -namespace Infrastructure.GlobalStateMachine.States -{ - public class DungeonRoomGenerationState : State - { - public DungeonRoomGenerationState(GameInstance context, IPersistentProgressService persistentProgressService, - ISaveLoadService saveLoadService) : - base(context) - { - _persistentProgressService = persistentProgressService; - _saveLoadService = saveLoadService; - } - - private readonly IPersistentProgressService _persistentProgressService; - private readonly ISaveLoadService _saveLoadService; - - public override void Enter() - { - int seed; - var progress = _saveLoadService.LoadProgress(); - - if (progress.dungeonRoom.seed == 0) - { - seed = Random.Range(int.MinValue, int.MaxValue); - progress.dungeonRoom.seed = seed; - } - else - { - seed = progress.dungeonRoom.seed; - } - - progress.currentLocation.locationType = CurrentLocation.LocationType.DungeonRoom; - _persistentProgressService.SetProgress(progress); - _saveLoadService.SaveProgress(); - - var dungeonArchitecture = DungeonGenerator.DungeonGenerator.GetDungeon(seed); - - Context.StateMachine - .SwitchState - enemiesPosition)>(dungeonArchitecture); - } - } -} \ No newline at end of file +#region + +using Data.Dynamic.Location; +using Infrastructure.GlobalStateMachine.StateMachine; +using Services.PersistentProgress; +using Services.SaveLoad; +using UnityEngine; + +#endregion + +namespace Infrastructure.GlobalStateMachine.States +{ + public class DungeonLocationGenerationState : State + { + public DungeonLocationGenerationState( + GameInstance context, + IPersistentProgressService persistentProgressService, + ISaveLoadService saveLoadService) : base(context) + { + _persistentProgressService = persistentProgressService; + _saveLoadService = saveLoadService; + } + + private readonly IPersistentProgressService _persistentProgressService; + private readonly ISaveLoadService _saveLoadService; + + public override async void Enter() + { + int seed; + var progress = _saveLoadService.LoadProgress(); + + if (progress.dungeonLocation.seed == 0) + { + seed = Random.Range(int.MinValue, int.MaxValue); + progress.dungeonLocation.seed = seed; + } + else + { + seed = progress.dungeonLocation.seed; + } + + progress.currentLocation.locationType = CurrentLocation.LocationType.DungeonRoom; + _persistentProgressService.SetProgress(progress); + _saveLoadService.SaveProgress(); + + var dungeonArchitecture = await DungeonGenerator.DungeonGenerator.GetDungeon(seed); + + Context.StateMachine.SwitchState(typeof(DungeonLocationSetUpState), dungeonArchitecture); + } + } +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonRoomGenerationState.cs.meta b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonLocationGenerationState.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonRoomGenerationState.cs.meta rename to Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonLocationGenerationState.cs.meta diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonRoomSetUpState.cs b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonLocationSetUpState.cs similarity index 74% rename from Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonRoomSetUpState.cs rename to Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonLocationSetUpState.cs index 557aef1..0d9f81b 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonRoomSetUpState.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonLocationSetUpState.cs @@ -1,215 +1,226 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Data.Addressable; -using Data.Settings; -using Data.Static; -using DungeonGenerator; -using DungeonGenerator.Tiles; -using DungeonGenerator.Tiles.Interface; -using Infrastructure.Factory.AbstractFactory; -using Infrastructure.Factory.EnemyFactory; -using Infrastructure.Factory.PlayerFactory; -using Infrastructure.Factory.UIFactory; -using Infrastructure.GlobalStateMachine.StateMachine; -using Infrastructure.GlobalStateMachine.States.Intermediate; -using Infrastructure.GlobalStateMachine.States.MainMenu; -using Item.Weapon; -using Loot; -using Services.AssetsAddressableService; -using Services.Watchers.SaveLoadWatcher; -using UI.DungeonRoom; -using Units.Enemy; -using Units.Player; -using Unity.AI.Navigation; -using UnityEngine; -using UnityEngine.XR.Interaction.Toolkit; -using XR; -using Random = UnityEngine.Random; - -namespace Infrastructure.GlobalStateMachine.States -{ - public class DungeonRoomSetUpState : StateWithParam enemiesPosition)> - { - public DungeonRoomSetUpState(GameInstance context, IAbstractFactory abstractFactory, - IAssetsAddressableService assetsAddressableService, DungeonRoomSettings dungeonRoomSettings, - ISaveLoadInstancesWatcher saveLoadInstancesWatcher, PlayerStaticDefaultData playerStaticDefaultData, - IEnemyFactory enemyFactory, IPlayerFactory playerFactory, IUIFactory uiFactory) - : base(context) - { - _abstractFactory = abstractFactory; - _assetsAddressableService = assetsAddressableService; - _dungeonRoomSettings = dungeonRoomSettings; - _saveLoadInstancesWatcher = saveLoadInstancesWatcher; - _playerStaticDefaultData = playerStaticDefaultData; - _enemyFactory = enemyFactory; - _playerFactory = playerFactory; - _uiFactory = uiFactory; - } - - private readonly IAbstractFactory _abstractFactory; - private readonly IAssetsAddressableService _assetsAddressableService; - private readonly DungeonRoomSettings _dungeonRoomSettings; - private readonly ISaveLoadInstancesWatcher _saveLoadInstancesWatcher; - private readonly PlayerStaticDefaultData _playerStaticDefaultData; - private readonly IEnemyFactory _enemyFactory; - private readonly IPlayerFactory _playerFactory; - private readonly IUIFactory _uiFactory; - private Transform _socketInstanceTransform; - - private const float UNIT = 4.85f / 2; - - public override async void Enter( - (ITile[,] dungeonMap, (int, int) playerPosition, List<(int, int)> enemiesPosition) dungeonArchitecture) - { - await CreateMap(dungeonArchitecture.dungeonMap); - await CreatePlayer(dungeonArchitecture.playerPosition); - await CreatePlayerAddons(); - await CreateWeapon(); - await CreateMenu(); - CreateLootManager(); - BuildNavMeshForDungeon(); - await CreateEnemies(dungeonArchitecture.enemiesPosition); - - Context.StateMachine.SwitchState(typeof(DungeonRoomState)); - } - - private async Task CreateMap(ITile[,] dungeonMap) - { - var floor = await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.FLOOR); - var wall = await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.WALL); - var wallAndLight = - await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.WALL_AND_LIGHT); - - - for (var y = 0; y < dungeonMap.GetLength(0); y++) - for (var x = 0; x < dungeonMap.GetLength(1); x++) - { - switch (dungeonMap[y, x]) - { - case FloorTile: - _abstractFactory.CreateInstance(floor, new Vector3(x, 0, y) * UNIT); - _abstractFactory.CreateInstance(floor, new Vector3(x, 2, y) * UNIT).transform.rotation = - new Quaternion(180, 0, 0, 0); - - break; - case WallTile tile: - if (tile.IsLight) - { - _abstractFactory.CreateInstance(wallAndLight, new Vector3(x, 0, y) * UNIT).transform - .rotation = new Quaternion(0, 90 * (int)tile.LightDirectionType, 0, 0); - } - else - { - _abstractFactory.CreateInstance(wall, new Vector3(x, 0, y) * UNIT); - } - - break; - } - } - } - - private async Task CreatePlayer((int x, int y) playerPosition) - { - var player = await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.PLAYER); - - _playerFactory.CreatePlayer(player, new Vector3(playerPosition.x, 0, playerPosition.y) * UNIT); - - _playerFactory.PlayerInstance.AddComponent().SetUp(MoveMainLocation, _playerStaticDefaultData); - - _saveLoadInstancesWatcher.RegisterProgress(_playerFactory.PlayerInstance); - - void MoveMainLocation() => - Context.StateMachine.SwitchState( - (AssetsAddressablesConstants.MAIN_LOCATION_SCENE_NAME, typeof(MainLocationSetUpState))); - } - - private async Task CreatePlayerAddons() - { - var socket = - await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.SOCKET_FOR_SWORD); - - var socketInstance = _abstractFactory.CreateInstance(socket, Vector3.zero); - socketInstance.transform.parent = _playerFactory.PlayerInstance.transform.GetChild(0).GetChild(0); - socketInstance.transform.localPosition = _dungeonRoomSettings.SocketForWeaponSpawnPosition; - _socketInstanceTransform = socketInstance.transform; - - var enemyDetectorInstance = _abstractFactory.CreateInstance(new GameObject(), Vector3.zero); - enemyDetectorInstance.transform.parent = _playerFactory.PlayerInstance.transform; - enemyDetectorInstance.transform.localPosition = Vector3.zero; - enemyDetectorInstance.AddComponent(); - enemyDetectorInstance.AddComponent().radius = 7.5f; - enemyDetectorInstance.GetComponent().isTrigger = true; - } - - private async Task CreateWeapon() - { - var sword = await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.WEAPON_SWORD); - var ax = await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.WEAPON_AX); - var hammer = - await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.WEAPON_HAMMER); - - var swordInstance = _abstractFactory.CreateInstance(sword, Vector3.zero); - var axInstance = _abstractFactory.CreateInstance(ax, Vector3.zero); - var hammerInstance = _abstractFactory.CreateInstance(hammer, Vector3.zero); - - var weaponManagerInstance = _abstractFactory.CreateInstance(new GameObject("weaponManager"), Vector3.zero); - weaponManagerInstance.AddComponent().SetUp( - _socketInstanceTransform, - _playerStaticDefaultData, - swordInstance, - axInstance, - hammerInstance); - - _saveLoadInstancesWatcher.RegisterProgress(weaponManagerInstance); - } - - private async Task CreateMenu() - { - var playerInstance = _playerFactory.PlayerInstance; - - var menuInDungeonRoomScreenInstance = await _uiFactory.CreateMenuInDungeonRoomScreen(); - - menuInDungeonRoomScreenInstance.transform.SetParent( - playerInstance.GetComponentInChildren().transform.parent); - - menuInDungeonRoomScreenInstance.transform.localPosition = Vector3.zero; - playerInstance.GetComponentInChildren() - .AddHoverEntered(_ => menuInDungeonRoomScreenInstance.SetActive(true)); - - playerInstance.GetComponentInChildren() - .AddHoverExited(_ => menuInDungeonRoomScreenInstance.SetActive(false)); - - menuInDungeonRoomScreenInstance.SetActive(false); - } - - private void CreateLootManager() - { - var lootManagerInstance = _abstractFactory.CreateInstance(new GameObject("lootManager"), Vector3.zero); - lootManagerInstance.AddComponent(); - - _saveLoadInstancesWatcher.RegisterProgress(lootManagerInstance); - } - - private void BuildNavMeshForDungeon() - { - var navMeshSurface = _abstractFactory.CreateInstance(new GameObject(), Vector3.zero) - .AddComponent(); - - navMeshSurface.BuildNavMesh(); - } - - private async Task CreateEnemies(List<(int, int)> enemyPosition) - { - foreach (var position in enemyPosition) - { - var enemy = await _enemyFactory.CreateInstance( - (EnemyType)Random.Range(0, 5), - new Vector3(position.Item1 * UNIT, 2, position.Item2 * UNIT)); - - enemy.transform.rotation = new Quaternion(0, Random.Range(-180f, 180f), 0, 0); - } - } - } -} \ No newline at end of file +#region + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Data.Addressable; +using Data.LocationSettings; +using Data.Static; +using DungeonGenerator.Tiles; +using DungeonGenerator.Tiles.Interface; +using Infrastructure.Factory.AbstractFactory; +using Infrastructure.Factory.EnemyFactory; +using Infrastructure.Factory.PlayerFactory; +using Infrastructure.Factory.UIFactory; +using Infrastructure.GlobalStateMachine.StateMachine; +using Infrastructure.GlobalStateMachine.States.Intermediate; +using Item.WeaponManager; +using Loot; +using Services.AssetsAddressableService; +using Services.Watchers.SaveLoadWatcher; +using Units.Enemy; +using Units.Player; +using Unity.AI.Navigation; +using UnityEngine; +using UnityEngine.XR.Interaction.Toolkit; +using XR; +using Random = UnityEngine.Random; + +#endregion + +namespace Infrastructure.GlobalStateMachine.States +{ + public class DungeonLocationSetUpState : StateWithParamenemiesPosition)> + { + public DungeonLocationSetUpState(GameInstance context, + IAbstractFactory abstractFactory, + IAssetsAddressableService assetsAddressableService, + DungeonRoomSettings dungeonRoomSettings, + ISaveLoadInstancesWatcher saveLoadInstancesWatcher, + PlayerStaticDefaultData playerStaticDefaultData, + IEnemyFactory enemyFactory, + IPlayerFactory playerFactory, + IUIFactory uiFactory) + : base(context) + { + _assetsAddressableService = assetsAddressableService; + _saveLoadInstancesWatcher = saveLoadInstancesWatcher; + _playerStaticDefaultData = playerStaticDefaultData; + _dungeonRoomSettings = dungeonRoomSettings; + _abstractFactory = abstractFactory; + _playerFactory = playerFactory; + _enemyFactory = enemyFactory; + _uiFactory = uiFactory; + } + + private const float UNIT = 4.85f / 2; + private readonly IAbstractFactory _abstractFactory; + + private readonly IAssetsAddressableService _assetsAddressableService; + private readonly DungeonRoomSettings _dungeonRoomSettings; + private readonly IEnemyFactory _enemyFactory; + private readonly IPlayerFactory _playerFactory; + private readonly PlayerStaticDefaultData _playerStaticDefaultData; + private readonly ISaveLoadInstancesWatcher _saveLoadInstancesWatcher; + private readonly IUIFactory _uiFactory; + private Transform _socketInstanceTransform; + + public override async void Enter( + (ITile[,] dungeonMap, (int x, int y) playerPosition, List<(int x, int y)> enemiesPosition) + dungeonArchitecture) + { + await CreateMap(dungeonArchitecture.dungeonMap); + await CreatePlayer(dungeonArchitecture.playerPosition); + await CreatePlayerAddons(); + await CreateWeapon(); + await CreateMenu(); + CreateLootManager(); + BuildNavMeshForDungeon(); + await CreateEnemies(dungeonArchitecture.enemiesPosition); + + Context.StateMachine.SwitchState(typeof(ProgressLoadingState), typeof(DungeonLocationState)); + } + + private async Task CreateMap(ITile[,] dungeonMap) + { + var floor = await _assetsAddressableService.GetAsset(AssetsAddressableConstants.FLOOR); + var wall = await _assetsAddressableService.GetAsset(AssetsAddressableConstants.WALL); + var wallAndLight = + await _assetsAddressableService.GetAsset(AssetsAddressableConstants.WALL_AND_LIGHT); + + + for (var y = 0; y < dungeonMap.GetLength(0); y++) + for (var x = 0; x < dungeonMap.GetLength(1); x++) + { + switch (dungeonMap[y, x]) + { + case FloorTile: + _abstractFactory.CreateInstance(floor, new Vector3(x, 0, y) * UNIT); + _abstractFactory.CreateInstance(floor, new Vector3(x, 2, y) * UNIT).transform.rotation = + new Quaternion(180, 0, 0, 0); + + break; + case WallTile tile: + if (tile.IsLight) + { + _abstractFactory.CreateInstance(wallAndLight, new Vector3(x, 0, y) * UNIT).transform + .rotation = new Quaternion(0, 90 * (int)tile.LightDirectionType, 0, 0); + } + else + { + _abstractFactory.CreateInstance(wall, new Vector3(x, 0, y) * UNIT); + } + + break; + } + } + } + + private async Task CreatePlayer((int x, int y) playerPosition) + { + var player = await _assetsAddressableService.GetAsset(AssetsAddressableConstants.PLAYER); + + _playerFactory.CreatePlayer(player, new Vector3(playerPosition.x, 0, playerPosition.y) * UNIT); + + _playerFactory.PlayerInstance.AddComponent().SetUp(_playerStaticDefaultData.HealthMaxPoints, _playerStaticDefaultData.ProtectionPoints); + _playerFactory.PlayerInstance.GetComponent().RegisterOnPlayerDead(MoveMainLocation); + _saveLoadInstancesWatcher.RegisterProgressWatchers(_playerFactory.PlayerInstance); + + void MoveMainLocation() + { + Context.StateMachine.SwitchState<(string sceneName, Type newStateType)>( + typeof(SceneLoadingState), + (AssetsAddressableConstants.MAIN_LOCATION_SCENE_NAME, typeof(MainLocationSetUpState))); + } + } + + private async Task CreatePlayerAddons() + { + var socket = + await _assetsAddressableService.GetAsset(AssetsAddressableConstants.SOCKET_FOR_SWORD); + + var socketInstance = _abstractFactory.CreateInstance(socket, Vector3.zero); + socketInstance.transform.parent = _playerFactory.PlayerInstance.transform.GetChild(0).GetChild(0); + socketInstance.transform.localPosition = _dungeonRoomSettings.SocketForWeaponSpawnPosition; + _socketInstanceTransform = socketInstance.transform; + + var enemyDetectorInstance = _abstractFactory.CreateInstance(new GameObject("EnemyDetector"), Vector3.zero); + enemyDetectorInstance.transform.parent = _playerFactory.PlayerInstance.transform; + enemyDetectorInstance.transform.localPosition = Vector3.zero; + enemyDetectorInstance.AddComponent(); + enemyDetectorInstance.AddComponent().radius = 7.5f; + enemyDetectorInstance.GetComponent().isTrigger = true; + } + + private async Task CreateWeapon() + { + var sword = await _assetsAddressableService.GetAsset(AssetsAddressableConstants.WEAPON_SWORD); + var ax = await _assetsAddressableService.GetAsset(AssetsAddressableConstants.WEAPON_AX); + var hammer = + await _assetsAddressableService.GetAsset(AssetsAddressableConstants.WEAPON_HAMMER); + + var swordInstance = _abstractFactory.CreateInstance(sword, Vector3.zero); + var axInstance = _abstractFactory.CreateInstance(ax, Vector3.zero); + var hammerInstance = _abstractFactory.CreateInstance(hammer, Vector3.zero); + + var weaponManagerInstance = _abstractFactory.CreateInstance(new GameObject("weaponManager"), Vector3.zero); + weaponManagerInstance.AddComponent().SetUp( + _socketInstanceTransform, + _playerStaticDefaultData.DamagePoints, + swordInstance, + axInstance, + hammerInstance); + + _saveLoadInstancesWatcher.RegisterProgressWatchers(weaponManagerInstance); + } + + private async Task CreateMenu() + { + var playerInstance = _playerFactory.PlayerInstance; + + var menuInDungeonRoomScreenInstance = await _uiFactory.CreateMenuInDungeonRoomScreen(); + + menuInDungeonRoomScreenInstance.transform.SetParent( + playerInstance.GetComponentInChildren().transform.parent); + + menuInDungeonRoomScreenInstance.transform.localPosition = Vector3.zero; + + playerInstance.GetComponentInChildren() + .AddHoverEntered(_ => menuInDungeonRoomScreenInstance.SetActive(true)); + + playerInstance.GetComponentInChildren() + .AddHoverExited(_ => menuInDungeonRoomScreenInstance.SetActive(false)); + + menuInDungeonRoomScreenInstance.SetActive(false); + } + + private void CreateLootManager() + { + var lootManagerInstance = _abstractFactory.CreateInstance(new GameObject("lootManager"), Vector3.zero); + lootManagerInstance.AddComponent(); + + _saveLoadInstancesWatcher.RegisterProgressWatchers(lootManagerInstance); + } + + private void BuildNavMeshForDungeon() + { + var navMeshSurface = _abstractFactory.CreateInstance(new GameObject(), Vector3.zero) + .AddComponent(); + + navMeshSurface.BuildNavMesh(); + } + + private async Task CreateEnemies(List<(int x, int y)> enemyPosition) + { + foreach (var position in enemyPosition) + { + var enemy = await _enemyFactory.CreateInstance( + (EnemyType)Random.Range(0, 5), + new Vector3(position.x * UNIT, 2, position.y * UNIT)); + + enemy.transform.rotation = new Quaternion(0, Random.Range(-180f, 180f), 0, 0); + } + } + } +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonRoomSetUpState.cs.meta b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonLocationSetUpState.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonRoomSetUpState.cs.meta rename to Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonLocationSetUpState.cs.meta diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonRoomState.cs b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonLocationState.cs similarity index 59% rename from Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonRoomState.cs rename to Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonLocationState.cs index 619c088..dd1ea71 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonRoomState.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonLocationState.cs @@ -1,92 +1,97 @@ -using System; -using Data.Addressable; -using Data.Dynamic.Location; -using Infrastructure.Factory.AbstractFactory; -using Infrastructure.Factory.EnemyFactory; -using Infrastructure.Factory.PlayerFactory; -using Infrastructure.Factory.UIFactory; -using Infrastructure.GlobalStateMachine.StateMachine; -using Infrastructure.GlobalStateMachine.States.Intermediate; -using Infrastructure.GlobalStateMachine.States.MainMenu; -using Loot; -using Services.PersistentProgress; -using Services.SaveLoad; -using Services.Watchers.SaveLoadWatcher; -using UI.DungeonRoom; -using UnityEngine; - -namespace Infrastructure.GlobalStateMachine.States -{ - public class DungeonRoomState : State - { - public DungeonRoomState(GameInstance context, IUIFactory uiFactory, ISaveLoadService saveLoadService, - IAbstractFactory abstractFactory, IEnemyFactory enemyFactory, - ISaveLoadInstancesWatcher saveLoadInstancesWatcher, IPlayerFactory playerFactory, - IPersistentProgressService persistentProgressService) : base(context) - { - _uiFactory = uiFactory; - _saveLoadService = saveLoadService; - _abstractFactory = abstractFactory; - _enemyFactory = enemyFactory; - _saveLoadInstancesWatcher = saveLoadInstancesWatcher; - _playerFactory = playerFactory; - _persistentProgressService = persistentProgressService; - } - - private readonly IEnemyFactory _enemyFactory; - private readonly IUIFactory _uiFactory; - private readonly ISaveLoadService _saveLoadService; - private readonly IAbstractFactory _abstractFactory; - private readonly ISaveLoadInstancesWatcher _saveLoadInstancesWatcher; - private readonly IPlayerFactory _playerFactory; - private readonly IPersistentProgressService _persistentProgressService; - - public override void Enter() - { - CreatedActionAllDeadEnemies(); - SettingMenu(); - - _uiFactory.DestroyLoadingScreen(); - } - - public override void Exit() - { - _saveLoadInstancesWatcher.ClearProgress(); - - _playerFactory.DestroyPlayer(); - _enemyFactory.DestroyAllInstances(); - _abstractFactory.DestroyAllInstances(); - _uiFactory.DestroyMenuInDungeonRoomScreen(); - } - - private void CreatedActionAllDeadEnemies() - { - _enemyFactory.AllDeadEnemies += Finish; - - void Finish() - { - _persistentProgressService.Progress.dungeonRoom.seed = 0; - _persistentProgressService.Progress.dungeonRoom.roomPassedCount++; - _saveLoadService.SaveProgress(); - - Context.StateMachine.SwitchState( - (AssetsAddressablesConstants.DUNGEON_ROOM_SCENE_NAME, typeof(DungeonRoomGenerationState))); - } - } - - private void SettingMenu() - { - _uiFactory.MenuInDungeonRoomScreen.GetComponent().SetUp(ExitInMainLocation); - - void ExitInMainLocation() - { - _persistentProgressService.Progress.dungeonRoom.seed = 0; - _persistentProgressService.Progress.dungeonRoom.roomPassedCount = 0; - _saveLoadService.SaveProgress(); - - Context.StateMachine.SwitchState( - (AssetsAddressablesConstants.MAIN_LOCATION_SCENE_NAME, typeof(MainLocationSetUpState))); - } - } - } -} \ No newline at end of file +#region + +using System; +using Data.Addressable; +using Infrastructure.Factory.AbstractFactory; +using Infrastructure.Factory.EnemyFactory; +using Infrastructure.Factory.PlayerFactory; +using Infrastructure.Factory.UIFactory; +using Infrastructure.GlobalStateMachine.StateMachine; +using Infrastructure.GlobalStateMachine.States.Intermediate; +using Services.PersistentProgress; +using Services.SaveLoad; +using Services.Watchers.SaveLoadWatcher; +using UI.DungeonRoom; + +#endregion + +namespace Infrastructure.GlobalStateMachine.States +{ + public class DungeonLocationState : State + { + public DungeonLocationState(GameInstance context, + IUIFactory uiFactory, + ISaveLoadService saveLoadService, + IAbstractFactory abstractFactory, + IEnemyFactory enemyFactory, + ISaveLoadInstancesWatcher saveLoadInstancesWatcher, + IPlayerFactory playerFactory, + IPersistentProgressService persistentProgressService) : base(context) + { + _persistentProgressService = persistentProgressService; + _saveLoadInstancesWatcher = saveLoadInstancesWatcher; + _saveLoadService = saveLoadService; + _abstractFactory = abstractFactory; + _playerFactory = playerFactory; + _enemyFactory = enemyFactory; + _uiFactory = uiFactory; + } + + private readonly IAbstractFactory _abstractFactory; + private readonly IEnemyFactory _enemyFactory; + + private readonly IPersistentProgressService _persistentProgressService; + private readonly IPlayerFactory _playerFactory; + private readonly ISaveLoadInstancesWatcher _saveLoadInstancesWatcher; + private readonly ISaveLoadService _saveLoadService; + private readonly IUIFactory _uiFactory; + + public override void Enter() + { + CreatedActionAllDeadEnemies(); + SettingMenu(); + + _uiFactory.DestroyLoadingScreen(); + } + + public override void Exit() + { + _persistentProgressService.Progress.dungeonLocation.seed = 0; + _saveLoadService.SaveProgress(); + _saveLoadInstancesWatcher.ClearProgressWatchers(); + + _playerFactory.DestroyPlayer(); + _enemyFactory.DestroyAllInstances(); + _abstractFactory.DestroyAllInstances(); + _uiFactory.DestroyMenuInDungeonRoomScreen(); + } + + private void CreatedActionAllDeadEnemies() + { + _enemyFactory.AllDeadEnemies += Finish; + + void Finish() + { + _persistentProgressService.Progress.dungeonLocation.roomPassedCount++; + + Context.StateMachine.SwitchState<(string sceneName, Type newStateType)>( + typeof(SceneLoadingState), + (AssetsAddressableConstants.DUNGEON_ROOM_SCENE_NAME, typeof(DungeonLocationGenerationState))); + } + } + + private void SettingMenu() + { + _uiFactory.MenuInDungeonRoomScreen.GetComponent().SetUp(ExitInMainLocation); + + void ExitInMainLocation() + { + _persistentProgressService.Progress.dungeonLocation.roomPassedCount = 0; + + Context.StateMachine.SwitchState<(string sceneName, Type newStateType)>( + typeof(SceneLoadingState), + (AssetsAddressableConstants.MAIN_LOCATION_SCENE_NAME, typeof(MainLocationSetUpState))); + } + } + } +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonRoomState.cs.meta b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonLocationState.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonRoomState.cs.meta rename to Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/DungeonRoom/DungeonLocationState.cs.meta diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/LoadLastSavedLocation.cs b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/LoadLastSavedLocation.cs deleted file mode 100644 index a59094d..0000000 --- a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/LoadLastSavedLocation.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using Data.Addressable; -using Data.Dynamic.Location; -using Infrastructure.GlobalStateMachine.StateMachine; -using Services.SaveLoad; -using UnityEngine; - -namespace Infrastructure.GlobalStateMachine.States.Intermediate -{ - public class LoadLastSavedLocation : State - { - public LoadLastSavedLocation(GameInstance context, ISaveLoadService saveLoadService) : base( - context) - { - _saveLoadService = saveLoadService; - } - - private readonly ISaveLoadService _saveLoadService; - - public override void Enter() - { - switch (_saveLoadService.LoadProgress().currentLocation.locationType) - { - case CurrentLocation.LocationType.Main: - Context.StateMachine.SwitchState( - (AssetsAddressablesConstants.MAIN_LOCATION_SCENE_NAME,typeof(MainLocationSetUpState))); - - break; - case CurrentLocation.LocationType.DungeonRoom: - Context.StateMachine.SwitchState( - (AssetsAddressablesConstants.DUNGEON_ROOM_SCENE_NAME,typeof(DungeonRoomGenerationState))); - - break; - case CurrentLocation.LocationType.DungeonBoss: - Debug.LogError("Boos ERROR"); - break; - default: - throw new ArgumentOutOfRangeException(); - } - } - } -} \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/LoadLastSavedLocationState.cs b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/LoadLastSavedLocationState.cs new file mode 100644 index 0000000..4adf6a4 --- /dev/null +++ b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/LoadLastSavedLocationState.cs @@ -0,0 +1,50 @@ +#region + +using System; +using Data.Addressable; +using Data.Dynamic.Location; +using Infrastructure.GlobalStateMachine.StateMachine; +using Services.SaveLoad; +using UnityEngine; + +#endregion + +namespace Infrastructure.GlobalStateMachine.States.Intermediate +{ + public class LoadLastSavedLocationState : State + { + public LoadLastSavedLocationState(GameInstance context, ISaveLoadService saveLoadService) : base( + context) + { + _saveLoadService = saveLoadService; + } + + private readonly ISaveLoadService _saveLoadService; + + public override void Enter() + { + var currentLocationType = _saveLoadService.LoadProgress().currentLocation.locationType; + + switch (currentLocationType) + { + case CurrentLocation.LocationType.Main: + Context.StateMachine.SwitchState<(string sceneName, Type newStateType)>( + typeof(SceneLoadingState), + (AssetsAddressableConstants.MAIN_LOCATION_SCENE_NAME, typeof(MainLocationSetUpState))); + + break; + case CurrentLocation.LocationType.DungeonRoom: + Context.StateMachine.SwitchState<(string sceneName, Type newStateType)>( + typeof(SceneLoadingState), + (AssetsAddressableConstants.DUNGEON_ROOM_SCENE_NAME, typeof(DungeonLocationGenerationState))); + + break; + case CurrentLocation.LocationType.DungeonBoss: + Debug.LogError("Boos ERROR"); + break; + default: + throw new ArgumentOutOfRangeException(); + } + } + } +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/LoadLastSavedLocation.cs.meta b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/LoadLastSavedLocationState.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/LoadLastSavedLocation.cs.meta rename to Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/LoadLastSavedLocationState.cs.meta diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/ProgressLoadingState.cs b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/ProgressLoadingState.cs index ff9b671..58e5c48 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/ProgressLoadingState.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/ProgressLoadingState.cs @@ -1,10 +1,14 @@ -using System; +#region + +using System; using Data.Dynamic; using Infrastructure.GlobalStateMachine.StateMachine; using Services.PersistentProgress; using Services.SaveLoad; using Services.Watchers.SaveLoadWatcher; +#endregion + namespace Infrastructure.GlobalStateMachine.States.Intermediate { public class ProgressLoadingState : StateWithParam @@ -18,28 +22,35 @@ public ProgressLoadingState(GameInstance context, ISaveLoadService saveLoadServi _persistentProgressService = persistentProgressService; } - private readonly ISaveLoadService _saveLoadService; - private readonly ISaveLoadInstancesWatcher _saveLoadInstancesWatcher; private readonly IPersistentProgressService _persistentProgressService; + private readonly ISaveLoadInstancesWatcher _saveLoadInstancesWatcher; + private readonly ISaveLoadService _saveLoadService; - public override void Enter(Type dungeonMapAndEnemiesPosition) + public override void Enter(Type nextStateType) { LoadProgressOrInitNew(); InformProgressReaders(); - Context.StateMachine.SwitchState(dungeonMapAndEnemiesPosition); + Context.StateMachine.SwitchState(nextStateType); } - private void LoadProgressOrInitNew() => + private void LoadProgressOrInitNew() + { _persistentProgressService.SetProgress(_saveLoadService.LoadProgress() ?? InitNewProgress()); + } - private Progress InitNewProgress() => new(); + private static Progress InitNewProgress() + { + return new Progress(); + } private void InformProgressReaders() { foreach (var progressLoadable in _saveLoadInstancesWatcher.ProgressLoadable) + { progressLoadable.LoadProgress(_persistentProgressService.Progress); + } } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/RemoveProgressData.cs b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/RemoveProgressDataState.cs similarity index 56% rename from Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/RemoveProgressData.cs rename to Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/RemoveProgressDataState.cs index c3d4055..4a72c69 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/RemoveProgressData.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/RemoveProgressDataState.cs @@ -1,12 +1,16 @@ -using System; +#region + +using System; using Infrastructure.GlobalStateMachine.StateMachine; using Services.SaveLoad; +#endregion + namespace Infrastructure.GlobalStateMachine.States.Intermediate { - public class RemoveProgressData : StateWithParam + public class RemoveProgressDataState : StateWithParam { - public RemoveProgressData(GameInstance context, ISaveLoadService saveLoadService) : base(context) + public RemoveProgressDataState(GameInstance context, ISaveLoadService saveLoadService) : base(context) { _saveLoadService = saveLoadService; } @@ -16,8 +20,9 @@ public RemoveProgressData(GameInstance context, ISaveLoadService saveLoadService public override void Enter((string sceneName, Type nextStateType) getValue) { _saveLoadService.ClearProgress(); - Context.StateMachine.SwitchState( + Context.StateMachine.SwitchState<(string sceneName, Type newStateType)>( + typeof(SceneLoadingState), (getValue.sceneName, getValue.nextStateType)); } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/RemoveProgressData.cs.meta b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/RemoveProgressDataState.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/RemoveProgressData.cs.meta rename to Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/RemoveProgressDataState.cs.meta diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/SceneLoadingState.cs b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/SceneLoadingState.cs index 794d7b4..0421522 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/SceneLoadingState.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/Intermediate/SceneLoadingState.cs @@ -1,11 +1,15 @@ -using System; +#region + +using System; using Infrastructure.Factory.UIFactory; using Infrastructure.GlobalStateMachine.StateMachine; using UnityEngine.AddressableAssets; +#endregion + namespace Infrastructure.GlobalStateMachine.States.Intermediate { - public class SceneLoadingState : StateWithParam + public class SceneLoadingState : StateWithParam { public SceneLoadingState(GameInstance context, IUIFactory uiFactory) : base(context) { @@ -14,13 +18,13 @@ public SceneLoadingState(GameInstance context, IUIFactory uiFactory) : base(cont private readonly IUIFactory _uiFactory; - public override async void Enter((string sceneName, Type newStateType) getValue) + public override async void Enter((string sceneName, Type nextStateType) getValue) { await _uiFactory.CreateLoadingScreen(); await Addressables.LoadSceneAsync(getValue.sceneName).Task; - Context.StateMachine.SwitchState(getValue.newStateType); + Context.StateMachine.SwitchState(getValue.nextStateType); } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/MainLocation/MainLocationSetUpState.cs b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/MainLocation/MainLocationSetUpState.cs index acdcc83..9d0d0e0 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/MainLocation/MainLocationSetUpState.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/MainLocation/MainLocationSetUpState.cs @@ -1,7 +1,9 @@ -using System; +#region + +using System; using System.Threading.Tasks; using Data.Addressable; -using Data.Settings; +using Data.LocationSettings; using Data.Static; using Infrastructure.Factory.AbstractFactory; using Infrastructure.Factory.PlayerFactory; @@ -9,95 +11,121 @@ using Infrastructure.GlobalStateMachine.StateMachine; using Infrastructure.GlobalStateMachine.States.Intermediate; using Item.Weapon; +using Item.WeaponManager; using Loot; -using Portal; using Services.AssetsAddressableService; using Services.Watchers.SaveLoadWatcher; using Skill; +using TransitionToTheDungeon; using UnityEngine; using UnityEngine.XR.Interaction.Toolkit; using XR; +#endregion + namespace Infrastructure.GlobalStateMachine.States { public class MainLocationSetUpState : State { - public MainLocationSetUpState(GameInstance context, IAbstractFactory abstractFactory, IUIFactory uiFactory, - IAssetsAddressableService assetsAddressableService, MainLocationSettings mainLocationSettings, + public MainLocationSetUpState( + GameInstance context, + IAbstractFactory abstractFactory, + IUIFactory uiFactory, + IAssetsAddressableService assetsAddressableService, + MainLocationSettings mainLocationSettings, ISaveLoadInstancesWatcher saveLoadInstancesWatcher, - PlayerStaticDefaultData playerStaticDefaultData, IPlayerFactory playerFactory) - : base(context) + PlayerStaticDefaultData playerStaticDefaultData, + IPlayerFactory playerFactory) : base(context) { - _abstractFactory = abstractFactory; - _uiFactory = uiFactory; _assetsAddressableService = assetsAddressableService; - _mainLocationSettings = mainLocationSettings; _saveLoadInstancesWatcher = saveLoadInstancesWatcher; _playerStaticDefaultData = playerStaticDefaultData; + _mainLocationSettings = mainLocationSettings; + _abstractFactory = abstractFactory; _playerFactory = playerFactory; + _uiFactory = uiFactory; } + private readonly IAbstractFactory _abstractFactory; + private readonly IAssetsAddressableService _assetsAddressableService; - private readonly ISaveLoadInstancesWatcher _saveLoadInstancesWatcher; - private readonly PlayerStaticDefaultData _playerStaticDefaultData; private readonly MainLocationSettings _mainLocationSettings; - private readonly IAbstractFactory _abstractFactory; private readonly IPlayerFactory _playerFactory; + private readonly PlayerStaticDefaultData _playerStaticDefaultData; + private readonly ISaveLoadInstancesWatcher _saveLoadInstancesWatcher; private readonly IUIFactory _uiFactory; - private GameObject _socketInstance; private GameObject _lootManagerInstance; + private GameObject _socketInstance; public override async void Enter() { + CreateLootManager(); await CreateMap(); await CreatePlayer(); await CreatePlayerAddons(); + await CreateSkillsBookScreen(); await CreateWeapons(); await CreateMenu(); - CreateLootManager(); - await CreateSkillsBook(); - CreatePortal(); + CreateTransitionToTheDungeon(); - Context.StateMachine.SwitchState(typeof(MainLocationState)); + Context.StateMachine.SwitchState(typeof(ProgressLoadingState), typeof(MainLocationState)); } private async Task CreateMap() { var mainLocationMap = - await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.MAIN_LOCATION_MAP); + await _assetsAddressableService.GetAsset(AssetsAddressableConstants.MAIN_LOCATION_MAP); - var mapInstance = _abstractFactory.CreateInstance(mainLocationMap, Vector3.zero); + _abstractFactory.CreateInstance(mainLocationMap, Vector3.zero); } private async Task CreatePlayer() { - var player = await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.PLAYER); + var player = await _assetsAddressableService.GetAsset(AssetsAddressableConstants.PLAYER); _playerFactory.CreatePlayer(player, _mainLocationSettings.PlayerSpawnPosition); } private async Task CreatePlayerAddons() { var socket = - await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.SOCKET_FOR_SWORD); - - _socketInstance = _abstractFactory.CreateInstance( - socket, - _mainLocationSettings.SocketForWeaponSpawnPosition); + await _assetsAddressableService.GetAsset(AssetsAddressableConstants.SOCKET_FOR_SWORD); + _socketInstance = _abstractFactory.CreateInstance(socket, Vector3.zero); _socketInstance.transform.parent = _playerFactory.PlayerInstance.transform.GetChild(0).GetChild(0); + _socketInstance.transform.localPosition = _mainLocationSettings.SocketForWeaponSpawnPosition; } - private async Task CreateWeapons() + private void CreateLootManager() { - var sword = await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.WEAPON_SWORD); - var ax = await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.WEAPON_AX); - var hammer = - await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.WEAPON_HAMMER); + _lootManagerInstance = _abstractFactory.CreateInstance(new GameObject("lootManager"), Vector3.zero); + _lootManagerInstance.AddComponent(); - var swordInstance = _abstractFactory.CreateInstance( - sword, - _mainLocationSettings.WeaponSpawnPosition[(int)sword.GetComponent().WeaponType]); + _saveLoadInstancesWatcher.RegisterProgressWatchers(_lootManagerInstance); + } + + private async Task CreateSkillsBookScreen() + { + var skillsBookScreenInstance = await _uiFactory.CreateSkillsBookScreen(); + + skillsBookScreenInstance.transform.position = _mainLocationSettings.SkillsBookScreenPosition; + + skillsBookScreenInstance.transform.rotation = + Quaternion.Euler(_mainLocationSettings.SkillsBookScreenRotation); + + var lootManager = _lootManagerInstance.GetComponent(); + skillsBookScreenInstance.GetComponent().SetUp( + lootManager.TryAmountChangeOnThe, + () => lootManager.SoulsOfTheDungeon); + + _saveLoadInstancesWatcher.RegisterProgressWatchers(skillsBookScreenInstance); + } + + private async Task CreateWeapons() + { + var sword = await _assetsAddressableService.GetAsset(AssetsAddressableConstants.WEAPON_SWORD); + var ax = await _assetsAddressableService.GetAsset(AssetsAddressableConstants.WEAPON_AX); + var hammer = await _assetsAddressableService.GetAsset(AssetsAddressableConstants.WEAPON_HAMMER); var axInstance = _abstractFactory.CreateInstance( ax, @@ -107,80 +135,60 @@ private async Task CreateWeapons() hammer, _mainLocationSettings.WeaponSpawnPosition[(int)hammer.GetComponent().WeaponType]); + var swordInstance = _abstractFactory.CreateInstance( + sword, + _mainLocationSettings.WeaponSpawnPosition[(int)sword.GetComponent().WeaponType]); + var weaponManagerInstance = _abstractFactory.CreateInstance(new GameObject("weaponManager"), Vector3.zero); weaponManagerInstance.AddComponent().SetUp( _socketInstance.transform, - _playerStaticDefaultData, - swordInstance, + _playerStaticDefaultData.DamagePoints, axInstance, - hammerInstance); + hammerInstance, + swordInstance); - _saveLoadInstancesWatcher.RegisterProgress(weaponManagerInstance); + _saveLoadInstancesWatcher.RegisterProgressWatchers(weaponManagerInstance); } private async Task CreateMenu() { var playerInstance = _playerFactory.PlayerInstance; - var menuInMainLocationScreenInstance = - await _uiFactory.CreateMenuInMainLocationScreen(); + var menuInMainLocationScreenInstance = await _uiFactory.CreateMenuInMainLocationScreen(); menuInMainLocationScreenInstance.transform.SetParent( playerInstance.GetComponentInChildren().transform.parent); menuInMainLocationScreenInstance.transform.localPosition = Vector3.zero; - playerInstance.GetComponentInChildren() + + playerInstance.GetComponentInChildren() .AddHoverEntered(_ => menuInMainLocationScreenInstance.SetActive(true)); - playerInstance.GetComponentInChildren() + playerInstance.GetComponentInChildren() .AddHoverExited(_ => menuInMainLocationScreenInstance.SetActive(false)); menuInMainLocationScreenInstance.SetActive(false); } - private void CreateLootManager() - { - _lootManagerInstance = _abstractFactory.CreateInstance(new GameObject("lootManager"), Vector3.zero); - _lootManagerInstance.AddComponent(); - _saveLoadInstancesWatcher.RegisterProgress(_lootManagerInstance); - } - - private async Task CreateSkillsBook() - { - var skillsBookScreen = - await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.SKILLS_BOOK_SCREEN); - - var skillsBookScreenInstance = _abstractFactory.CreateInstance( - skillsBookScreen, - _mainLocationSettings.SkillsBookScreenPosition); - - skillsBookScreenInstance.transform.rotation = Quaternion.Euler( - _mainLocationSettings.SkillsBookScreenRotation.x, - _mainLocationSettings.SkillsBookScreenRotation.y, - _mainLocationSettings.SkillsBookScreenRotation.z); - - skillsBookScreenInstance.GetComponent().SetUp(_lootManagerInstance.GetComponent()); - - _saveLoadInstancesWatcher.RegisterProgress(skillsBookScreenInstance); - } - - private void CreatePortal() + private void CreateTransitionToTheDungeon() { var portalInstance = _abstractFactory.CreateInstance( - new GameObject("Portal"), - _mainLocationSettings.PortalSpawnPosition); + new GameObject("Transition to the Dungeon"), + _mainLocationSettings.TransitionToTheDungeonSpawnPosition); var portalCollider = portalInstance.AddComponent(); portalCollider.size = new Vector3(2.5f, 2.5f, 1f); portalCollider.isTrigger = true; + portalInstance.AddComponent().isKinematic = true; - portalInstance.AddComponent().SetUp(MoveToDungeonRoom); + portalInstance.AddComponent().RegisterOnTransitionToTheDungeon(MoveToDungeonRoom); void MoveToDungeonRoom() { - Context.StateMachine.SwitchState( - (AssetsAddressablesConstants.DUNGEON_ROOM_SCENE_NAME, typeof(DungeonRoomGenerationState))); + Context.StateMachine.SwitchState<(string sceneName, Type newStateType)>( + typeof(SceneLoadingState), + (AssetsAddressableConstants.DUNGEON_ROOM_SCENE_NAME, typeof(DungeonLocationGenerationState))); } } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/MainLocation/MainLocationState.cs b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/MainLocation/MainLocationState.cs index 1c80d24..08eaf53 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/MainLocation/MainLocationState.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/MainLocation/MainLocationState.cs @@ -1,4 +1,6 @@ -using System; +#region + +using System; using Data.Addressable; using Data.Dynamic.Location; using Infrastructure.Factory.AbstractFactory; @@ -7,36 +9,45 @@ using Infrastructure.GlobalStateMachine.StateMachine; using Infrastructure.GlobalStateMachine.States.Intermediate; using Infrastructure.GlobalStateMachine.States.MainMenu; +using Services.PersistentProgress; using Services.SaveLoad; using Services.Watchers.SaveLoadWatcher; using UI.MainLocation; +#endregion + namespace Infrastructure.GlobalStateMachine.States { public class MainLocationState : State { - public MainLocationState(GameInstance context, IUIFactory uiFactory, ISaveLoadService saveLoadService, - ISaveLoadInstancesWatcher saveLoadInstancesWatcher, IAbstractFactory abstractFactory, - IPlayerFactory playerFactory) : - base(context) + public MainLocationState( + GameInstance context, + IUIFactory uiFactory, + ISaveLoadService saveLoadService, + ISaveLoadInstancesWatcher saveLoadInstancesWatcher, + IAbstractFactory abstractFactory, + IPlayerFactory playerFactory, + IPersistentProgressService persistentProgressService) : base(context) { - _uiFactory = uiFactory; - _saveLoadService = saveLoadService; + _persistentProgressService = persistentProgressService; _saveLoadInstancesWatcher = saveLoadInstancesWatcher; _abstractFactory = abstractFactory; + _saveLoadService = saveLoadService; _playerFactory = playerFactory; + _uiFactory = uiFactory; } - private readonly ISaveLoadInstancesWatcher _saveLoadInstancesWatcher; - private readonly ISaveLoadService _saveLoadService; private readonly IAbstractFactory _abstractFactory; + + private readonly IPersistentProgressService _persistentProgressService; private readonly IPlayerFactory _playerFactory; + private readonly ISaveLoadInstancesWatcher _saveLoadInstancesWatcher; + private readonly ISaveLoadService _saveLoadService; private readonly IUIFactory _uiFactory; public override void Enter() { - _saveLoadService.SaveProgress(); - SelectionLocationSettingChange(); + ChangeCurrentSaveLocation(); SettingMenu(); _uiFactory.DestroyLoadingScreen(); @@ -45,17 +56,19 @@ public override void Enter() public override void Exit() { _saveLoadService.SaveProgress(); - _saveLoadInstancesWatcher.ClearProgress(); + _saveLoadInstancesWatcher.ClearProgressWatchers(); _playerFactory.DestroyPlayer(); _abstractFactory.DestroyAllInstances(); + _uiFactory.DestroySkillsBookScreen(); _uiFactory.DestroyMenuInMainLocationScreen(); } - private void SelectionLocationSettingChange() + private void ChangeCurrentSaveLocation() { - var progress = _saveLoadService.LoadProgress(); + var progress = _persistentProgressService.Progress; progress.currentLocation.locationType = CurrentLocation.LocationType.Main; + _persistentProgressService.SetProgress(progress); _saveLoadService.SaveProgress(); } @@ -66,9 +79,10 @@ private void SettingMenu() void ExitInMainMenu() { - Context.StateMachine.SwitchState( - (AssetsAddressablesConstants.MAIN_MENU_SCENE_NAME, typeof(MainMenuSetUpState))); + Context.StateMachine.SwitchState<(string sceneName, Type newStateType)>( + typeof(SceneLoadingState), + (AssetsAddressableConstants.MAIN_MENU_SCENE_NAME, typeof(MainMenuSetUpState))); } } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/MainMenu/MainMenuSetUpState.cs b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/MainMenu/MainMenuSetUpState.cs index 0c21c4a..d3ecff8 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/MainMenu/MainMenuSetUpState.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/MainMenu/MainMenuSetUpState.cs @@ -1,7 +1,8 @@ -using System.Threading; +#region + using System.Threading.Tasks; using Data.Addressable; -using Data.Settings; +using Data.LocationSettings; using Infrastructure.Factory.AbstractFactory; using Infrastructure.Factory.PlayerFactory; using Infrastructure.Factory.UIFactory; @@ -9,12 +10,18 @@ using Services.AssetsAddressableService; using UnityEngine; +#endregion + namespace Infrastructure.GlobalStateMachine.States.MainMenu { public class MainMenuSetUpState : State { - public MainMenuSetUpState(GameInstance context, IAbstractFactory abstractFactory, IUIFactory uiFactory, - IAssetsAddressableService assetsAddressableService, MainMenuSettings mainMenuSettings, + public MainMenuSetUpState( + GameInstance context, + IAbstractFactory abstractFactory, + IUIFactory uiFactory, + IAssetsAddressableService assetsAddressableService, + MainMenuSettings mainMenuSettings, IPlayerFactory playerFactory) : base(context) { _assetsAddressableService = assetsAddressableService; @@ -24,9 +31,10 @@ public MainMenuSetUpState(GameInstance context, IAbstractFactory abstractFactory _uiFactory = uiFactory; } + private readonly IAbstractFactory _abstractFactory; + private readonly IAssetsAddressableService _assetsAddressableService; private readonly MainMenuSettings _mainMenuSettings; - private readonly IAbstractFactory _abstractFactory; private readonly IPlayerFactory _playerFactory; private readonly IUIFactory _uiFactory; @@ -38,19 +46,19 @@ public override async void Enter() await CreatePlayer(); await CreateMainMenu(); - Context.StateMachine.SwitchState(); + Context.StateMachine.SwitchState(typeof(MainMenuState)); } - private async Task CreatePlayer() + private async Task CreateMap() { - var player = await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.PLAYER); - _playerFactory.CreatePlayer(player, _mainMenuSettings.PlayerSpawnPosition); + var map = await _assetsAddressableService.GetAsset(AssetsAddressableConstants.MAIN_MENU_MAP); + _abstractFactory.CreateInstance(map, Vector3.zero); } - private async Task CreateMap() + private async Task CreatePlayer() { - var map = await _assetsAddressableService.GetAsset(AssetsAddressablesConstants.MAIN_MENU_MAP); - _abstractFactory.CreateInstance(map, Vector3.zero); + var player = await _assetsAddressableService.GetAsset(AssetsAddressableConstants.PLAYER); + _playerFactory.CreatePlayer(player, _mainMenuSettings.PlayerSpawnPosition); } private async Task CreateMainMenu() @@ -59,4 +67,4 @@ private async Task CreateMainMenu() menu.transform.position = _mainMenuSettings.UIMenuSpawnPosition; } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/MainMenu/MainMenuState.cs b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/MainMenu/MainMenuState.cs index 90979f9..607ee0a 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/MainMenu/MainMenuState.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/GlobalStateMachine/States/MainMenu/MainMenuState.cs @@ -1,4 +1,6 @@ -using System; +#region + +using System; using Data.Addressable; using Infrastructure.Factory.AbstractFactory; using Infrastructure.Factory.PlayerFactory; @@ -7,25 +9,29 @@ using Infrastructure.GlobalStateMachine.States.Intermediate; using Services.SaveLoad; using UI.MainMenu; -using UnityEngine; + +#endregion namespace Infrastructure.GlobalStateMachine.States.MainMenu { public class MainMenuState : State { - public MainMenuState(GameInstance context, IUIFactory uiFactory, IAbstractFactory abstractFactory, - ISaveLoadService saveLoadService, IPlayerFactory playerFactory) : base( - context) + public MainMenuState( + GameInstance context, + IUIFactory uiFactory, + IAbstractFactory abstractFactory, + ISaveLoadService saveLoadService, + IPlayerFactory playerFactory) : base(context) { - _uiFactory = uiFactory; _abstractFactory = abstractFactory; _saveLoadService = saveLoadService; _playerFactory = playerFactory; + _uiFactory = uiFactory; } private readonly IAbstractFactory _abstractFactory; - private readonly ISaveLoadService _saveLoadService; private readonly IPlayerFactory _playerFactory; + private readonly ISaveLoadService _saveLoadService; private readonly IUIFactory _uiFactory; public override void Enter() @@ -48,10 +54,16 @@ private void SettingMenu() mainMenuScreenComponent.SetUp(GoToNewGame, GoToLoadGame, _saveLoadService.IsInStockSave()); } - private void GoToNewGame() => - Context.StateMachine.SwitchState( - (AssetsAddressablesConstants.MAIN_LOCATION_SCENE_NAME, typeof(MainLocationSetUpState))); + private void GoToNewGame() + { + Context.StateMachine.SwitchState<(string sceneName, Type nextStateType)>( + typeof(RemoveProgressDataState), + (AssetsAddressableConstants.MAIN_LOCATION_SCENE_NAME, typeof(MainLocationSetUpState))); + } - private void GoToLoadGame() => Context.StateMachine.SwitchState(); + private void GoToLoadGame() + { + Context.StateMachine.SwitchState(typeof(LoadLastSavedLocationState)); + } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/Installers/GameInstanceInstaller.cs b/Assets/Internal assets/Scripts/Infrastructure/Installers/GameInstanceInstaller.cs index 0b854a6..e508d65 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/Installers/GameInstanceInstaller.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/Installers/GameInstanceInstaller.cs @@ -1,19 +1,22 @@ +#region + using Infrastructure.GlobalStateMachine; -using UnityEngine; using Zenject; +#endregion + namespace Infrastructure.Installers { - public class GameInstanceInstaller : MonoInstaller - { - public override void InstallBindings() - { - BindGameInstance(); - } + public class GameInstanceInstaller : MonoInstaller + { + public override void InstallBindings() + { + BindGameInstance(); + } - private void BindGameInstance() - { - Container.Bind().AsSingle().NonLazy(); - } - } + private void BindGameInstance() + { + Container.Bind().AsSingle().NonLazy(); + } + } } diff --git a/Assets/Internal assets/Scripts/Infrastructure/Installers/ServiceInstaller.cs b/Assets/Internal assets/Scripts/Infrastructure/Installers/ServiceInstaller.cs index 895847b..c38690d 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/Installers/ServiceInstaller.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/Installers/ServiceInstaller.cs @@ -1,10 +1,11 @@ -using Data.Settings; +#region + +using Data.LocationSettings; using Data.Static; using Infrastructure.Factory.AbstractFactory; using Infrastructure.Factory.EnemyFactory; using Infrastructure.Factory.PlayerFactory; using Infrastructure.Factory.UIFactory; -using Infrastructure.GlobalStateMachine.States; using Services.AssetsAddressableService; using Services.PersistentProgress; using Services.SaveLoad; @@ -13,14 +14,16 @@ using UnityEngine; using Zenject; +#endregion + namespace Infrastructure.Installers { public class ServiceInstaller : MonoInstaller { - [SerializeField] private PlayerStaticDefaultData _playerStaticDefaultData; - [SerializeField] private MainLocationSettings _mainLocationSettings; - [SerializeField] private DungeonRoomSettings _dungeonRoomSettings; - [SerializeField] private MainMenuSettings _mainMenuSettings; + [SerializeField] private PlayerStaticDefaultData playerStaticDefaultData; + [SerializeField] private MainLocationSettings mainLocationSettings; + [SerializeField] private DungeonRoomSettings dungeonRoomSettings; + [SerializeField] private MainMenuSettings mainMenuSettings; public override void InstallBindings() { @@ -33,9 +36,12 @@ public override void InstallBindings() BindFactory(); } - private void BindAssetsAddressable() + private void BindSettings() { - Container.BindInterfacesTo().AsSingle(); + Container.Bind().FromInstance(playerStaticDefaultData).AsSingle(); + Container.Bind().FromInstance(mainLocationSettings).AsSingle(); + Container.Bind().FromInstance(dungeonRoomSettings).AsSingle(); + Container.Bind().FromInstance(mainMenuSettings).AsSingle(); } private void BindFactory() @@ -46,14 +52,6 @@ private void BindFactory() Container.BindInterfacesTo().AsSingle(); } - private void BindSettings() - { - Container.Bind().FromInstance(_playerStaticDefaultData).AsSingle(); - Container.Bind().FromInstance(_mainLocationSettings).AsSingle(); - Container.Bind().FromInstance(_dungeonRoomSettings).AsSingle(); - Container.Bind().FromInstance(_mainMenuSettings).AsSingle(); - } - private void BindPersistentProgressService() { Container.BindInterfacesTo().AsSingle(); @@ -64,14 +62,19 @@ private void BindSaveLoadInstancesWatcher() Container.BindInterfacesTo().AsSingle(); } - private void BindSaveLoadService() + private void BindAssetsAddressable() { - Container.BindInterfacesTo().AsSingle(); + Container.BindInterfacesTo().AsSingle(); } private void BindStaticDataService() { Container.BindInterfacesTo().AsSingle(); } + + private void BindSaveLoadService() + { + Container.BindInterfacesTo().AsSingle(); + } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/Installers/StatesInstaller.cs b/Assets/Internal assets/Scripts/Infrastructure/Installers/StateInstaller.cs similarity index 84% rename from Assets/Internal assets/Scripts/Infrastructure/Installers/StatesInstaller.cs rename to Assets/Internal assets/Scripts/Infrastructure/Installers/StateInstaller.cs index cc85460..e4977b9 100644 --- a/Assets/Internal assets/Scripts/Infrastructure/Installers/StatesInstaller.cs +++ b/Assets/Internal assets/Scripts/Infrastructure/Installers/StateInstaller.cs @@ -1,18 +1,22 @@ -using Infrastructure.GlobalStateMachine.States; -using Zenject; - -namespace Infrastructure.Installers -{ - public class StatesInstaller : MonoInstaller - { - public override void InstallBindings() - { - BindBootstrapState(); - } - - private void BindBootstrapState() - { - Container.Bind().To().AsSingle().NonLazy(); - } - } -} +#region + +using Infrastructure.GlobalStateMachine.States; +using Zenject; + +#endregion + +namespace Infrastructure.Installers +{ + public class StateInstaller : MonoInstaller + { + public override void InstallBindings() + { + BindBootstrapState(); + } + + private void BindBootstrapState() + { + Container.Bind().To().AsSingle().NonLazy(); + } + } +} diff --git a/Assets/Internal assets/Scripts/Infrastructure/Installers/StatesInstaller.cs.meta b/Assets/Internal assets/Scripts/Infrastructure/Installers/StateInstaller.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Infrastructure/Installers/StatesInstaller.cs.meta rename to Assets/Internal assets/Scripts/Infrastructure/Installers/StateInstaller.cs.meta diff --git a/Assets/Internal assets/Scripts/Item/Interface/IItemDamage.cs b/Assets/Internal assets/Scripts/Item/Interface/IItemDamage.cs index 56f5402..a79940f 100644 --- a/Assets/Internal assets/Scripts/Item/Interface/IItemDamage.cs +++ b/Assets/Internal assets/Scripts/Item/Interface/IItemDamage.cs @@ -1,12 +1,11 @@ -using UnityEngine; - -namespace Item +namespace Item { public interface IItemDamage { - bool IsDamage { get; set; } - float Damage { get; set; } + float Damage { get; } + bool IsDamage { get; } + void SetDamage(float value); void ItemIsDamage(bool value); } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Item/Interface/IWeaponManager.cs b/Assets/Internal assets/Scripts/Item/Interface/IWeaponManager.cs deleted file mode 100644 index a5c401d..0000000 --- a/Assets/Internal assets/Scripts/Item/Interface/IWeaponManager.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; -using Data.Static; -using Item.Weapon; -using Services.PersistentProgress; -using UnityEngine; - -namespace Item -{ - public interface IWeaponManager : IProgressLoadable - { - WeaponType SelectedWeaponType { get; set; } - Transform SocketTransform { get; set; } - Dictionary WeaponsTransform { get; } - - void SetUp(Transform socketTransform, PlayerStaticDefaultData playerStaticDefaultData, - params GameObject[] weapons); - void MoveWeaponInSocket(WeaponType selectedWeaponType); - } -} \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Item/Interface/IWeapon.cs b/Assets/Internal assets/Scripts/Item/Weapon/IWeapon.cs similarity index 63% rename from Assets/Internal assets/Scripts/Item/Interface/IWeapon.cs rename to Assets/Internal assets/Scripts/Item/Weapon/IWeapon.cs index 8bcd8b4..aa4178b 100644 --- a/Assets/Internal assets/Scripts/Item/Interface/IWeapon.cs +++ b/Assets/Internal assets/Scripts/Item/Weapon/IWeapon.cs @@ -1,9 +1,7 @@ -using Item.Weapon; - -namespace Item -{ - public interface IWeapon - { - WeaponType WeaponType { get; } - } -} \ No newline at end of file +namespace Item.Weapon +{ + public interface IWeapon + { + WeaponType WeaponType { get; } + } +} diff --git a/Assets/Internal assets/Scripts/Item/Interface/IWeapon.cs.meta b/Assets/Internal assets/Scripts/Item/Weapon/IWeapon.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Item/Interface/IWeapon.cs.meta rename to Assets/Internal assets/Scripts/Item/Weapon/IWeapon.cs.meta diff --git a/Assets/Internal assets/Scripts/Item/Weapon/Weapon.cs b/Assets/Internal assets/Scripts/Item/Weapon/Weapon.cs index 0c0a203..bed42c2 100644 --- a/Assets/Internal assets/Scripts/Item/Weapon/Weapon.cs +++ b/Assets/Internal assets/Scripts/Item/Weapon/Weapon.cs @@ -1,24 +1,36 @@ -using UnityEngine; +#region + +using UnityEngine; using UnityEngine.XR.Interaction.Toolkit; +#endregion + namespace Item.Weapon { - public class Weapon : MonoBehaviour, IItemDamage, IWeapon + public class Weapon : MonoBehaviour, IWeapon, IItemDamage { - public WeaponType WeaponType => weaponType; - [SerializeField] private WeaponType weaponType; - - [field: SerializeField] public bool IsDamage { get; set; } - [field: SerializeField] public float Damage { get; set; } - private void Start() { - var grabInteractable = GetComponent(); + if (TryGetComponent(out var xrGrabInteractable)) + { + xrGrabInteractable.selectEntered.AddListener(_ => ItemIsDamage(true)); + xrGrabInteractable.selectExited.AddListener(_ => ItemIsDamage(false)); + } + } + + public float Damage { get; private set; } + public bool IsDamage { get; private set; } + + public void SetDamage(float value) + { + Damage = value; + } - grabInteractable.selectEntered.AddListener(_ => ItemIsDamage(true)); - grabInteractable.selectExited.AddListener(_ => ItemIsDamage(false)); - + public void ItemIsDamage(bool value) + { + IsDamage = value; } - public void ItemIsDamage(bool value) => IsDamage = value; + + [field: SerializeField] public WeaponType WeaponType { get; private set; } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Item/Weapon/WeaponManagerDungeonRoom.cs b/Assets/Internal assets/Scripts/Item/Weapon/WeaponManagerDungeonRoom.cs deleted file mode 100644 index 019b2f6..0000000 --- a/Assets/Internal assets/Scripts/Item/Weapon/WeaponManagerDungeonRoom.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System.Collections.Generic; -using Data.Dynamic; -using Data.Dynamic.Player; -using Data.Static; -using Skill; -using UnityEngine; -using UnityEngine.XR.Interaction.Toolkit; - -namespace Item.Weapon -{ - public class WeaponManagerDungeonRoom : MonoBehaviour, IWeaponManager - { - public WeaponType SelectedWeaponType { get; set; } - public Transform SocketTransform { get; set; } - private PlayerStaticDefaultData _defaultData; - - public Dictionary WeaponsTransform { get; } = new() - { - [WeaponType.Sword] = null, - [WeaponType.Ax] = null, - [WeaponType.Hammer] = null - }; - - public void SetUp(Transform socketTransform, PlayerStaticDefaultData playerStaticDefaultData, - params GameObject[] weapons) - { - SocketTransform = socketTransform; - _defaultData = playerStaticDefaultData; - foreach (var weapon in weapons) - { - if (!weapon.TryGetComponent(out var weaponComponent)) continue; - WeaponsTransform[weaponComponent.WeaponType] = weapon.transform; - if (weapon.TryGetComponent(out var grabComponent)) - grabComponent.selectEntered.AddListener(_ => ChangeSelectedWeapon(weaponComponent.WeaponType)); - } - } - - public void MoveWeaponInSocket(WeaponType selectedWeaponType) - { - WeaponsTransform[selectedWeaponType].GetComponent().isKinematic = true; - WeaponsTransform[selectedWeaponType].GetComponent().enabled = false; - WeaponsTransform[selectedWeaponType].position = SocketTransform.position; - WeaponsTransform[selectedWeaponType].GetComponent().enabled = true; - WeaponsTransform[selectedWeaponType].GetComponent().isKinematic = false; - } - - public void LoadProgress(Progress progress) - { - var skills = progress.skillsLevel.Skills; - var damage = _defaultData.DamagePoints; - SelectedWeaponType = progress.selectedWeapon.weaponType; - - foreach (var (weaponType, weaponTransform) in WeaponsTransform) - { - weaponTransform.GetComponent().Damage = - (damage + skills[SkillType.STREANGHT_Count]) * - (1 + skills[SkillType.STREANGHT_Percent]); - - weaponTransform.gameObject.SetActive(weaponType == SelectedWeaponType); - } - - MoveWeaponInSocket(SelectedWeaponType); - } - - private void ChangeSelectedWeapon(WeaponType newSelectedWeaponType) - { - SelectedWeaponType = newSelectedWeaponType; - } - } -} \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Item/Weapon/WeaponManagerMainLocation.cs b/Assets/Internal assets/Scripts/Item/Weapon/WeaponManagerMainLocation.cs deleted file mode 100644 index 59d3646..0000000 --- a/Assets/Internal assets/Scripts/Item/Weapon/WeaponManagerMainLocation.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System.Collections.Generic; -using Data.Dynamic; -using Data.Dynamic.Player; -using Data.Static; -using Services.PersistentProgress; -using Skill; -using UnityEngine; -using UnityEngine.XR.Interaction.Toolkit; - -namespace Item.Weapon -{ - public class WeaponManagerMainLocation : MonoBehaviour, IProgressSavable, IWeaponManager - { - public WeaponType SelectedWeaponType { get; set; } - public Transform SocketTransform { get; set; } - private PlayerStaticDefaultData _defaultData; - - public Dictionary WeaponsTransform { get; } = new() - { - [WeaponType.Sword] = null, - [WeaponType.Ax] = null, - [WeaponType.Hammer] = null - }; - - public void SetUp(Transform socketTransform, PlayerStaticDefaultData playerStaticDefaultData, - params GameObject[] weapons) - { - SocketTransform = socketTransform.transform; - _defaultData = playerStaticDefaultData; - foreach (var weapon in weapons) - { - if (!weapon.TryGetComponent(out var weaponComponent)) continue; - WeaponsTransform[weaponComponent.WeaponType] = weapon.transform; - if (weapon.TryGetComponent(out var grabComponent)) - grabComponent.selectEntered.AddListener(_ => ChangeSelectedWeapon(weaponComponent.WeaponType)); - } - } - - public void UpdateProgress(Progress progress) - { - progress.selectedWeapon.weaponType = SelectedWeaponType; - } - - public void MoveWeaponInSocket(WeaponType selectedWeaponType) - { - WeaponsTransform[selectedWeaponType].GetComponent().enabled = false; - WeaponsTransform[selectedWeaponType].position = SocketTransform.position; - WeaponsTransform[selectedWeaponType].GetComponent().enabled = true; - } - - public void LoadProgress(Progress progress) - { - var skills = progress.skillsLevel.Skills; - var damage = _defaultData.DamagePoints; - - foreach (var (_, weaponTransform) in WeaponsTransform) - { - weaponTransform.GetComponent().Damage = - (damage + skills[SkillType.STREANGHT_Count]) * - (1 + skills[SkillType.STREANGHT_Percent]); - } - - SelectedWeaponType = progress.selectedWeapon.weaponType; - MoveWeaponInSocket(SelectedWeaponType); - } - - private void ChangeSelectedWeapon(WeaponType newSelectedWeaponType) - { - SelectedWeaponType = newSelectedWeaponType; - } - } -} \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Item/Weapon/WeaponType.cs b/Assets/Internal assets/Scripts/Item/Weapon/WeaponType.cs index 640a69f..381698d 100644 --- a/Assets/Internal assets/Scripts/Item/Weapon/WeaponType.cs +++ b/Assets/Internal assets/Scripts/Item/Weapon/WeaponType.cs @@ -2,8 +2,8 @@ { public enum WeaponType { - Sword, - Hammer, - Ax, + Ax = 0, + Hammer = 1, + Sword = 2 } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Item/WeaponManager.meta b/Assets/Internal assets/Scripts/Item/WeaponManager.meta new file mode 100644 index 0000000..7d70f80 --- /dev/null +++ b/Assets/Internal assets/Scripts/Item/WeaponManager.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5f50a16fd9d343d599e8d61e3d725984 +timeCreated: 1685058452 \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Item/WeaponManager/IWeaponManager.cs b/Assets/Internal assets/Scripts/Item/WeaponManager/IWeaponManager.cs new file mode 100644 index 0000000..b7276ce --- /dev/null +++ b/Assets/Internal assets/Scripts/Item/WeaponManager/IWeaponManager.cs @@ -0,0 +1,23 @@ +#region + +using System.Collections.Generic; +using Item.Weapon; +using Services.Watchers.PersistentProgressWatcher; +using UnityEngine; + +#endregion + +namespace Item.WeaponManager +{ + public interface IWeaponManager : IProgressLoadableWatcher + { + WeaponType SelectedWeaponType { get; } + float DamageDefault { get; } + Transform SocketTransform { get; } + Dictionary WeaponsTransform { get; } + + void SetUp(Transform socketTransform, float damage, params GameObject[] weapons); + + void MoveWeaponInSocket(WeaponType selectedWeaponType); + } +} diff --git a/Assets/Internal assets/Scripts/Item/Interface/IWeaponManager.cs.meta b/Assets/Internal assets/Scripts/Item/WeaponManager/IWeaponManager.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Item/Interface/IWeaponManager.cs.meta rename to Assets/Internal assets/Scripts/Item/WeaponManager/IWeaponManager.cs.meta diff --git a/Assets/Internal assets/Scripts/Item/WeaponManager/WeaponManagerDungeonRoom.cs b/Assets/Internal assets/Scripts/Item/WeaponManager/WeaponManagerDungeonRoom.cs new file mode 100644 index 0000000..3d1ee66 --- /dev/null +++ b/Assets/Internal assets/Scripts/Item/WeaponManager/WeaponManagerDungeonRoom.cs @@ -0,0 +1,73 @@ +#region + +using System.Collections.Generic; +using Data.Dynamic; +using Item.Weapon; +using Skill; +using UnityEngine; +using UnityEngine.XR.Interaction.Toolkit; + +#endregion + +namespace Item.WeaponManager +{ + public class WeaponManagerDungeonRoom : MonoBehaviour, IWeaponManager + { + public WeaponType SelectedWeaponType { get; private set; } + public Transform SocketTransform { get; private set; } + public float DamageDefault { get; private set; } + + public Dictionary WeaponsTransform { get; } = new Dictionary + { + [WeaponType.Ax] = null, + [WeaponType.Hammer] = null, + [WeaponType.Sword] = null + }; + + public void SetUp(Transform socketTransform, float damage, params GameObject[] weapons) + { + SocketTransform = socketTransform; + DamageDefault = damage; + foreach (var weapon in weapons) + { + if (weapon.TryGetComponent(out var weaponComponent)) + { + WeaponsTransform[weaponComponent.WeaponType] = weapon.transform; + } + } + } + + public void MoveWeaponInSocket(WeaponType selectedWeaponType) + { + if (WeaponsTransform[selectedWeaponType] == null) return; + WeaponsTransform[selectedWeaponType].GetComponent().isKinematic = true; + WeaponsTransform[selectedWeaponType].GetComponent().enabled = false; + WeaponsTransform[selectedWeaponType].position = SocketTransform.position; + WeaponsTransform[selectedWeaponType].GetComponent().enabled = true; + WeaponsTransform[selectedWeaponType].GetComponent().isKinematic = false; + } + + public void LoadProgress(Progress progress) + { + var skills = progress.skillsLevel.skills; + SelectedWeaponType = progress.selectedWeapon.weaponType; + + foreach (var (weaponType, weaponTransform) in WeaponsTransform) + { + if (weaponTransform == null) return; + if (weaponType == SelectedWeaponType) + { + weaponTransform.GetComponent().SetDamage( + (DamageDefault + skills[SkillType.StrengthCount]) * + (1 + skills[SkillType.StrengthPercent])); + } + else + { + weaponTransform.gameObject.SetActive(false); + } + + MoveWeaponInSocket(SelectedWeaponType); + } + } + } +} diff --git a/Assets/Internal assets/Scripts/Item/Weapon/WeaponManagerDungeonRoom.cs.meta b/Assets/Internal assets/Scripts/Item/WeaponManager/WeaponManagerDungeonRoom.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Item/Weapon/WeaponManagerDungeonRoom.cs.meta rename to Assets/Internal assets/Scripts/Item/WeaponManager/WeaponManagerDungeonRoom.cs.meta diff --git a/Assets/Internal assets/Scripts/Item/WeaponManager/WeaponManagerMainLocation.cs b/Assets/Internal assets/Scripts/Item/WeaponManager/WeaponManagerMainLocation.cs new file mode 100644 index 0000000..f0e3b16 --- /dev/null +++ b/Assets/Internal assets/Scripts/Item/WeaponManager/WeaponManagerMainLocation.cs @@ -0,0 +1,82 @@ +#region + +using System.Collections.Generic; +using Data.Dynamic; +using Item.Weapon; +using Services.Watchers.PersistentProgressWatcher; +using Skill; +using UnityEngine; +using UnityEngine.XR.Interaction.Toolkit; + +#endregion + +namespace Item.WeaponManager +{ + public class WeaponManagerMainLocation : MonoBehaviour, IWeaponManager, IProgressSavableWatcher + { + public void UpdateProgress(Progress progress) + { + progress.selectedWeapon.weaponType = SelectedWeaponType; + } + + public WeaponType SelectedWeaponType { get; private set; } + public Transform SocketTransform { get; private set; } + + public float DamageDefault { get; private set; } + + public Dictionary WeaponsTransform { get; } = new Dictionary + { + [WeaponType.Ax] = null, + [WeaponType.Hammer] = null, + [WeaponType.Sword] = null + }; + + public void SetUp(Transform socketTransform, float damage, params GameObject[] weapons) + { + SocketTransform = socketTransform.transform; + DamageDefault = damage; + foreach (var weapon in weapons) + { + if (weapon.TryGetComponent(out var weaponComponent)) + { + WeaponsTransform[weaponComponent.WeaponType] = weapon.transform; + if (weapon.TryGetComponent(out var grabComponent)) + { + grabComponent.selectEntered.AddListener(_ => ChangeSelectedWeapon(weaponComponent.WeaponType)); + } + } + } + } + + public void MoveWeaponInSocket(WeaponType selectedWeaponType) + { + if (WeaponsTransform[selectedWeaponType] == null) return; + WeaponsTransform[selectedWeaponType].GetComponent().isKinematic = true; + WeaponsTransform[selectedWeaponType].GetComponent().enabled = false; + WeaponsTransform[selectedWeaponType].position = SocketTransform.position; + WeaponsTransform[selectedWeaponType].GetComponent().enabled = true; + WeaponsTransform[selectedWeaponType].GetComponent().isKinematic = false; + } + + public void LoadProgress(Progress progress) + { + var skills = progress.skillsLevel.skills; + SelectedWeaponType = progress.selectedWeapon.weaponType; + + foreach (var (_, weaponTransform) in WeaponsTransform) + { + if (weaponTransform == null) return; + weaponTransform.GetComponent().SetDamage( + (DamageDefault + skills[SkillType.StrengthCount]) * + (1 + skills[SkillType.StrengthPercent])); + } + + MoveWeaponInSocket(SelectedWeaponType); + } + + private void ChangeSelectedWeapon(WeaponType newSelectedWeaponType) + { + SelectedWeaponType = newSelectedWeaponType; + } + } +} diff --git a/Assets/Internal assets/Scripts/Item/Weapon/WeaponManagerMainLocation.cs.meta b/Assets/Internal assets/Scripts/Item/WeaponManager/WeaponManagerMainLocation.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Item/Weapon/WeaponManagerMainLocation.cs.meta rename to Assets/Internal assets/Scripts/Item/WeaponManager/WeaponManagerMainLocation.cs.meta diff --git a/Assets/Internal assets/Scripts/Loot/LootManager.cs b/Assets/Internal assets/Scripts/Loot/LootManager.cs index f039a6f..ec50bc0 100644 --- a/Assets/Internal assets/Scripts/Loot/LootManager.cs +++ b/Assets/Internal assets/Scripts/Loot/LootManager.cs @@ -1,37 +1,46 @@ -using System; +#region + +using System; using Data.Dynamic; -using Services.PersistentProgress; +using Services.Watchers.PersistentProgressWatcher; using UnityEngine; +#endregion + namespace Loot { - public class LootManager : MonoBehaviour, IProgressLoadable, IProgressSavable + public class LootManager : MonoBehaviour, IProgressLoadableWatcher, IProgressSavableWatcher { + private Action _onAmountChanged; public int SoulsOfTheDungeon { get; private set; } - private Action _isAmountChanged; - public void RegisterOnTheAmountChange(Action isAmountChanged) + public void LoadProgress(Progress progress) { - _isAmountChanged += isAmountChanged; + SoulsOfTheDungeon = progress.lootData.loot; + _onAmountChanged?.Invoke(SoulsOfTheDungeon); } - public bool TryAmountChangeOnThe(int value) + public void UpdateProgress(Progress progress) { - if (SoulsOfTheDungeon + value < 0) return false; - SoulsOfTheDungeon += value; - _isAmountChanged?.Invoke(SoulsOfTheDungeon); - return true; + progress.lootData.loot = SoulsOfTheDungeon; } - public void LoadProgress(Progress progress) + public void RegisterWatcherOnTheAmountChange(Action isAmountChanged) + { + _onAmountChanged += isAmountChanged; + } + + public void UnregisterWatcherOnTheAmountChange(Action isAmountChanged) { - SoulsOfTheDungeon = progress.lootData.soulsOfTheDungeon; - _isAmountChanged?.Invoke(SoulsOfTheDungeon); + _onAmountChanged -= isAmountChanged; } - public void UpdateProgress(Progress progress) + public bool TryAmountChangeOnThe(int value) { - progress.lootData.soulsOfTheDungeon = SoulsOfTheDungeon; + if (SoulsOfTheDungeon + value < 0) return false; + SoulsOfTheDungeon += value; + _onAmountChanged?.Invoke(SoulsOfTheDungeon); + return true; } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Portal/PortalTrigger.cs b/Assets/Internal assets/Scripts/Portal/PortalTrigger.cs deleted file mode 100644 index 644a8f2..0000000 --- a/Assets/Internal assets/Scripts/Portal/PortalTrigger.cs +++ /dev/null @@ -1,21 +0,0 @@ -using UnityEngine; -using UnityEngine.Events; - -namespace Portal -{ - public class PortalTrigger : MonoBehaviour - { - private UnityAction _action; - private bool _isTrigger; - - public void SetUp(UnityAction action) => _action = action; - - private void OnTriggerEnter(Collider other) - { - if (!other.CompareTag("Player") || _isTrigger) return; - - _action?.Invoke(); - _isTrigger = true; - } - } -} \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Services/AssetsAddressableService/AssetsAddressableService.cs b/Assets/Internal assets/Scripts/Services/AssetsAddressableService/AssetsAddressableService.cs index 4f8e9f2..e2c3bfa 100644 --- a/Assets/Internal assets/Scripts/Services/AssetsAddressableService/AssetsAddressableService.cs +++ b/Assets/Internal assets/Scripts/Services/AssetsAddressableService/AssetsAddressableService.cs @@ -1,7 +1,11 @@ -using System.Threading.Tasks; +#region + +using System.Threading.Tasks; using UnityEngine; using UnityEngine.AddressableAssets; +#endregion + namespace Services.AssetsAddressableService { public class AssetsAddressableService : IAssetsAddressableService @@ -14,14 +18,14 @@ public async Task GetAsset(string path) where T : Object return asyncOperationHandle.Result; } - + public async Task GetAsset(AssetReference assetReference) where T : Object { - var asyncOperationHandle = Addressables.LoadAssetAsync(assetReference.AssetGUID); - - await asyncOperationHandle.Task; - - return asyncOperationHandle.Result; + var asyncOperationHandle = Addressables.LoadAssetAsync(assetReference.AssetGUID); + + await asyncOperationHandle.Task; + + return asyncOperationHandle.Result; } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Services/AssetsAddressableService/IAssetsAddressableService.cs b/Assets/Internal assets/Scripts/Services/AssetsAddressableService/IAssetsAddressableService.cs index d2f03db..4b99093 100644 --- a/Assets/Internal assets/Scripts/Services/AssetsAddressableService/IAssetsAddressableService.cs +++ b/Assets/Internal assets/Scripts/Services/AssetsAddressableService/IAssetsAddressableService.cs @@ -1,13 +1,16 @@ +#region + using System.Threading.Tasks; using UnityEngine; using UnityEngine.AddressableAssets; +#endregion + namespace Services.AssetsAddressableService { public interface IAssetsAddressableService { - public Task GetAsset(string path) where T : Object; - public Task GetAsset(AssetReference assetReference) where T : Object; + Task GetAsset(string path) where T : Object; + Task GetAsset(AssetReference assetReference) where T : Object; } } - diff --git a/Assets/Internal assets/Scripts/Services/PersistentProgress/IPersistentProgressService.cs b/Assets/Internal assets/Scripts/Services/PersistentProgress/IPersistentProgressService.cs index 4d00858..7e7c44c 100644 --- a/Assets/Internal assets/Scripts/Services/PersistentProgress/IPersistentProgressService.cs +++ b/Assets/Internal assets/Scripts/Services/PersistentProgress/IPersistentProgressService.cs @@ -1,10 +1,14 @@ -using Data.Dynamic; +#region + +using Data.Dynamic; + +#endregion namespace Services.PersistentProgress { public interface IPersistentProgressService { - public Progress Progress { get; } - public void SetProgress(Progress progress); + Progress Progress { get; } + void SetProgress(Progress progress); } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Services/PersistentProgress/IProgressLoadable.cs b/Assets/Internal assets/Scripts/Services/PersistentProgress/IProgressLoadable.cs deleted file mode 100644 index 1d8ba35..0000000 --- a/Assets/Internal assets/Scripts/Services/PersistentProgress/IProgressLoadable.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Data.Dynamic; - -namespace Services.PersistentProgress -{ - public interface IProgressLoadable - { - public void LoadProgress(Progress progress); - } -} \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Services/PersistentProgress/IProgressSavable.cs b/Assets/Internal assets/Scripts/Services/PersistentProgress/IProgressSavable.cs deleted file mode 100644 index b3ec4d6..0000000 --- a/Assets/Internal assets/Scripts/Services/PersistentProgress/IProgressSavable.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Data.Dynamic; - -namespace Services.PersistentProgress -{ - public interface IProgressSavable - { - public void UpdateProgress(Progress progress); - } -} \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Services/PersistentProgress/PersistentProgressService.cs b/Assets/Internal assets/Scripts/Services/PersistentProgress/PersistentProgressService.cs index 24f54b8..8a8f8c3 100644 --- a/Assets/Internal assets/Scripts/Services/PersistentProgress/PersistentProgressService.cs +++ b/Assets/Internal assets/Scripts/Services/PersistentProgress/PersistentProgressService.cs @@ -1,4 +1,8 @@ -using Data.Dynamic; +#region + +using Data.Dynamic; + +#endregion namespace Services.PersistentProgress { @@ -11,4 +15,4 @@ public void SetProgress(Progress progress) Progress = progress; } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Services/SaveLoad/ISaveLoadService.cs b/Assets/Internal assets/Scripts/Services/SaveLoad/ISaveLoadService.cs index 8f2a7df..e4b3065 100644 --- a/Assets/Internal assets/Scripts/Services/SaveLoad/ISaveLoadService.cs +++ b/Assets/Internal assets/Scripts/Services/SaveLoad/ISaveLoadService.cs @@ -1,5 +1,8 @@ -using Data.Dynamic; -using Data.Dynamic.Loot; +#region + +using Data.Dynamic; + +#endregion namespace Services.SaveLoad { @@ -10,4 +13,4 @@ public interface ISaveLoadService void ClearProgress(); bool IsInStockSave(); } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Services/SaveLoad/SaveLoadService.cs b/Assets/Internal assets/Scripts/Services/SaveLoad/SaveLoadService.cs index 2d06b31..0892334 100644 --- a/Assets/Internal assets/Scripts/Services/SaveLoad/SaveLoadService.cs +++ b/Assets/Internal assets/Scripts/Services/SaveLoad/SaveLoadService.cs @@ -1,8 +1,12 @@ -using Data.Dynamic; +#region + +using Data.Dynamic; using Services.PersistentProgress; using Services.Watchers.SaveLoadWatcher; using UnityEngine; +#endregion + namespace Services.SaveLoad { public class SaveLoadService : ISaveLoadService @@ -14,11 +18,11 @@ public SaveLoadService(IPersistentProgressService persistentProgressService, _saveLoadInstancesWatcher = saveLoadInstancesWatcher; } + private const string SAVE_LOAD_KEY = "SaveLoadKey"; + private readonly IPersistentProgressService _persistentProgressService; private readonly ISaveLoadInstancesWatcher _saveLoadInstancesWatcher; - private const string SAVE_LOAD_KEY = "SaveLoadKey"; - public void SaveProgress() { foreach (var progressSavable in _saveLoadInstancesWatcher.ProgressSavable) @@ -49,4 +53,4 @@ public bool IsInStockSave() return PlayerPrefs.HasKey(SAVE_LOAD_KEY); } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Services/StaticData/IStaticDataService.cs b/Assets/Internal assets/Scripts/Services/StaticData/IStaticDataService.cs index 1e906c7..9d1e9bc 100644 --- a/Assets/Internal assets/Scripts/Services/StaticData/IStaticDataService.cs +++ b/Assets/Internal assets/Scripts/Services/StaticData/IStaticDataService.cs @@ -1,6 +1,10 @@ -using Data.Static; +#region + +using Data.Static; using Units.Enemy; +#endregion + namespace Services.StaticData { public interface IStaticDataService @@ -8,4 +12,4 @@ public interface IStaticDataService public void LoadStaticData(); public EnemyStaticData GetEnemyData(EnemyType enemyType); } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Services/StaticData/StaticDataService.cs b/Assets/Internal assets/Scripts/Services/StaticData/StaticDataService.cs index c921d77..96664a5 100644 --- a/Assets/Internal assets/Scripts/Services/StaticData/StaticDataService.cs +++ b/Assets/Internal assets/Scripts/Services/StaticData/StaticDataService.cs @@ -1,26 +1,25 @@ -using System.Collections.Generic; +#region + +using System.Collections.Generic; using System.Linq; -using Data.Addressable; using Data.Static; -using Services.AssetsAddressableService; using Units.Enemy; using UnityEngine; +#endregion + namespace Services.StaticData { public class StaticDataService : IStaticDataService { - private const string ENEMIES_STATIC_DATA_PATH = "Data/Static/Enemies"; - - private Dictionary _enemies; - - public StaticDataService(IAssetsAddressableService assetsAddressableService) + public StaticDataService() { - _assetsAddressableService = assetsAddressableService; LoadStaticData(); } - private readonly IAssetsAddressableService _assetsAddressableService; + private const string ENEMIES_STATIC_DATA_PATH = "Data/Static/Enemies"; + + private Dictionary _enemies; public void LoadStaticData() { @@ -34,4 +33,4 @@ public EnemyStaticData GetEnemyData(EnemyType enemyType) return _enemies.TryGetValue(enemyType, out var staticData) ? staticData : null; } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Services/Watchers/PersistentProgressWatcher.meta b/Assets/Internal assets/Scripts/Services/Watchers/PersistentProgressWatcher.meta new file mode 100644 index 0000000..6082301 --- /dev/null +++ b/Assets/Internal assets/Scripts/Services/Watchers/PersistentProgressWatcher.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4fdd8f3ed4424f1eaa8a4e8e6dfae8b4 +timeCreated: 1685005234 \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Services/Watchers/PersistentProgressWatcher/IProgressLoadableWatcher.cs b/Assets/Internal assets/Scripts/Services/Watchers/PersistentProgressWatcher/IProgressLoadableWatcher.cs new file mode 100644 index 0000000..998fc84 --- /dev/null +++ b/Assets/Internal assets/Scripts/Services/Watchers/PersistentProgressWatcher/IProgressLoadableWatcher.cs @@ -0,0 +1,13 @@ +#region + +using Data.Dynamic; + +#endregion + +namespace Services.Watchers.PersistentProgressWatcher +{ + public interface IProgressLoadableWatcher + { + public void LoadProgress(Progress progress); + } +} diff --git a/Assets/Internal assets/Scripts/Services/PersistentProgress/IProgressLoadable.cs.meta b/Assets/Internal assets/Scripts/Services/Watchers/PersistentProgressWatcher/IProgressLoadableWatcher.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Services/PersistentProgress/IProgressLoadable.cs.meta rename to Assets/Internal assets/Scripts/Services/Watchers/PersistentProgressWatcher/IProgressLoadableWatcher.cs.meta diff --git a/Assets/Internal assets/Scripts/Services/Watchers/PersistentProgressWatcher/IProgressSavableWatcher.cs b/Assets/Internal assets/Scripts/Services/Watchers/PersistentProgressWatcher/IProgressSavableWatcher.cs new file mode 100644 index 0000000..9491126 --- /dev/null +++ b/Assets/Internal assets/Scripts/Services/Watchers/PersistentProgressWatcher/IProgressSavableWatcher.cs @@ -0,0 +1,13 @@ +#region + +using Data.Dynamic; + +#endregion + +namespace Services.Watchers.PersistentProgressWatcher +{ + public interface IProgressSavableWatcher + { + public void UpdateProgress(Progress progress); + } +} diff --git a/Assets/Internal assets/Scripts/Services/PersistentProgress/IProgressSavable.cs.meta b/Assets/Internal assets/Scripts/Services/Watchers/PersistentProgressWatcher/IProgressSavableWatcher.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Services/PersistentProgress/IProgressSavable.cs.meta rename to Assets/Internal assets/Scripts/Services/Watchers/PersistentProgressWatcher/IProgressSavableWatcher.cs.meta diff --git a/Assets/Internal assets/Scripts/Services/Watchers/SaveLoadWatcher/ISaveLoadInstancesWatcher.cs b/Assets/Internal assets/Scripts/Services/Watchers/SaveLoadWatcher/ISaveLoadInstancesWatcher.cs index bdcfc34..590eec8 100644 --- a/Assets/Internal assets/Scripts/Services/Watchers/SaveLoadWatcher/ISaveLoadInstancesWatcher.cs +++ b/Assets/Internal assets/Scripts/Services/Watchers/SaveLoadWatcher/ISaveLoadInstancesWatcher.cs @@ -1,15 +1,19 @@ -using System.Collections.Generic; -using Services.PersistentProgress; +#region + +using System.Collections.Generic; +using Services.Watchers.PersistentProgressWatcher; using UnityEngine; +#endregion + namespace Services.Watchers.SaveLoadWatcher { public interface ISaveLoadInstancesWatcher { - public List ProgressSavable { get; } - public List ProgressLoadable { get; } - public void RegisterProgress(params GameObject[] instances); - public void DeleteProgress(params GameObject[] instances); - public void ClearProgress(); + public List ProgressSavable { get; } + public List ProgressLoadable { get; } + public void RegisterProgressWatchers(params GameObject[] instances); + public void DeleteProgressWatchers(params GameObject[] instances); + public void ClearProgressWatchers(); } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Services/Watchers/SaveLoadWatcher/SaveLoadInstancesWatcher.cs b/Assets/Internal assets/Scripts/Services/Watchers/SaveLoadWatcher/SaveLoadInstancesWatcher.cs index 4f3f096..54dae3a 100644 --- a/Assets/Internal assets/Scripts/Services/Watchers/SaveLoadWatcher/SaveLoadInstancesWatcher.cs +++ b/Assets/Internal assets/Scripts/Services/Watchers/SaveLoadWatcher/SaveLoadInstancesWatcher.cs @@ -1,60 +1,54 @@ -using System.Collections.Generic; -using Services.PersistentProgress; +#region + +using System.Collections.Generic; +using Services.Watchers.PersistentProgressWatcher; using UnityEngine; +#endregion + namespace Services.Watchers.SaveLoadWatcher { public class SaveLoadInstancesWatcher : ISaveLoadInstancesWatcher { - public List ProgressSavable { get; } = new(); - public List ProgressLoadable { get; } = new(); + public List ProgressSavable { get; } = new List(); + public List ProgressLoadable { get; } = new List(); - public void RegisterProgress(params GameObject[] instances) + public void RegisterProgressWatchers(params GameObject[] instances) { foreach (var instance in instances) { - foreach (var progressLoader in instance.GetComponentsInChildren()) + foreach (var progressLoadable in instance.GetComponentsInChildren()) { - Register(progressLoader); + if (progressLoadable is IProgressSavableWatcher progressSavable) + { + ProgressSavable.Add(progressSavable); + } + + ProgressLoadable.Add(progressLoadable); } } } - public void DeleteProgress(params GameObject[] instances) + public void DeleteProgressWatchers(params GameObject[] instances) { foreach (var instance in instances) { - foreach (var progressLoader in instance.GetComponentsInChildren()) + foreach (var progressLoadable in instance.GetComponentsInChildren()) { - Deletion(progressLoader); + if (progressLoadable is IProgressSavableWatcher progressSavable) + { + ProgressSavable.Remove(progressSavable); + } + + ProgressLoadable.Remove(progressLoadable); } } } - public void ClearProgress() + public void ClearProgressWatchers() { ProgressSavable.Clear(); ProgressLoadable.Clear(); } - - private void Register(IProgressLoadable progressLoadable) - { - if (progressLoadable is IProgressSavable progressSavable) - { - ProgressSavable.Add(progressSavable); - } - - ProgressLoadable.Add(progressLoadable); - } - - private void Deletion(IProgressLoadable progressLoadable) - { - if (progressLoadable is IProgressSavable progressSavable) - { - ProgressSavable.Remove(progressSavable); - } - - ProgressLoadable.Remove(progressLoadable); - } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Skill/SkillType.cs b/Assets/Internal assets/Scripts/Skill/SkillType.cs index 23b8a1a..d3f3a23 100644 --- a/Assets/Internal assets/Scripts/Skill/SkillType.cs +++ b/Assets/Internal assets/Scripts/Skill/SkillType.cs @@ -2,11 +2,11 @@ { public enum SkillType { - STREANGHT_Count = 0, - STREANGHT_Percent = 1, - PROTECTION_Count = 2, - PROTECTION_Percent = 3, - HEALTH_Count = 4, - HEALTH_Percent = 5, + StrengthCount = 0, + StrengthPercent = 1, + ProtectionCount = 2, + ProtectionPercent = 3, + HealthCount = 4, + HealthPercent = 5 } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Skill/SkillsBook.cs b/Assets/Internal assets/Scripts/Skill/SkillsBook.cs deleted file mode 100644 index 80a6886..0000000 --- a/Assets/Internal assets/Scripts/Skill/SkillsBook.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Collections.Generic; -using Data.Dynamic; -using Data.Dynamic.Player; -using Data.Static; -using Loot; -using Services.PersistentProgress; -using UI.MainLocation; -using UnityEngine; -using UnityEngine.UI; - -namespace Skill -{ - public class SkillsBook : MonoBehaviour, IProgressLoadable, IProgressSavable - { - [SerializeField] private SkillsBookScreen skillsBookScreen; - [SerializeField] private SkillStaticData[] skillStaticDatas; - - private readonly Dictionary _skillsLevelDictionary = new() - { - [SkillType.STREANGHT_Count] = 0, - [SkillType.STREANGHT_Percent] = 0, - [SkillType.PROTECTION_Count] = 0, - [SkillType.PROTECTION_Percent] = 0, - [SkillType.HEALTH_Count] = 0, - [SkillType.HEALTH_Percent] = 0, - }; - - private readonly Dictionary _skillStaticDataDictionary = new() - { - [SkillType.STREANGHT_Count] = null, - [SkillType.STREANGHT_Percent] = null, - [SkillType.PROTECTION_Count] = null, - [SkillType.PROTECTION_Percent] = null, - [SkillType.HEALTH_Count] = null, - [SkillType.HEALTH_Percent] = null, - }; - - private Action, int> _onChangeSkills; - private LootManager _lootManager; - - public void SetUp(LootManager lootManager) - { - _lootManager = lootManager; - - foreach (var data in skillStaticDatas) - _skillStaticDataDictionary[data.SkillType] = data; - - skillsBookScreen.SetUp(this, _skillStaticDataDictionary); - } - - public void TryIncreaseSkill(SkillType skillType) - { - var level = _skillsLevelDictionary[skillType]; - var price = _skillStaticDataDictionary[skillType].GetPriceForLevel(level); - if (!_lootManager.TryAmountChangeOnThe(-price)) return; - _skillsLevelDictionary[skillType]++; - _onChangeSkills?.Invoke(_skillsLevelDictionary, _lootManager.SoulsOfTheDungeon); - } - - public void RegisterOnChangeSkill(Action, int> onChangeSkill) - { - _onChangeSkills += onChangeSkill; - } - - public void LoadProgress(Progress progress) - { - progress.skillsLevel.DeserializeSkills(); - - foreach (var (key, level) in progress.skillsLevel.Skills) - _skillsLevelDictionary[key] = level; - - _onChangeSkills?.Invoke(_skillsLevelDictionary, _lootManager.SoulsOfTheDungeon); - } - - public void UpdateProgress(Progress progress) - { - progress.skillsLevel.Skills = _skillsLevelDictionary; - progress.skillsLevel.SerializeSkills(); - } - } -} \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Skill/SkillsManager.cs b/Assets/Internal assets/Scripts/Skill/SkillsManager.cs new file mode 100644 index 0000000..032d1ea --- /dev/null +++ b/Assets/Internal assets/Scripts/Skill/SkillsManager.cs @@ -0,0 +1,69 @@ +#region + +using System; +using System.Collections.Generic; +using System.Linq; +using Data.Dynamic; +using Data.Static; +using Services.Watchers.PersistentProgressWatcher; +using UI.MainLocation; +using UnityEngine; + +#endregion + +namespace Skill +{ + public class SkillsManager : MonoBehaviour, IProgressLoadableWatcher, IProgressSavableWatcher + { + [SerializeField] private SkillsBookScreen skillsBookScreen; + [SerializeField] private SkillStaticData[] skillStaticData; + private Func _getCountLoot; + + private Action, int> _onChangeSkills; + + private Dictionary _skillsLevelDictionary; + + private Dictionary _skillStaticDataDictionary; + + private Predicate _tryToByASkill; + + public void LoadProgress(Progress progress) + { + progress.skillsLevel.DeserializeSkills(); + + _skillsLevelDictionary = progress.skillsLevel.skills; + + _onChangeSkills?.Invoke(_skillsLevelDictionary, _getCountLoot?.Invoke() ?? 0); + } + + public void UpdateProgress(Progress progress) + { + progress.skillsLevel.skills = _skillsLevelDictionary; + progress.skillsLevel.SerializeSkills(); + } + + public void SetUp(Predicate tryToByASkill, Func getCountLoot) + { + _tryToByASkill = tryToByASkill; + _getCountLoot = getCountLoot; + _skillStaticDataDictionary = skillStaticData.ToDictionary(data => data.SkillType, data => data); + + skillsBookScreen.SetUp(TryIncreaseSkill, ref _onChangeSkills, _skillStaticDataDictionary); + } + + private bool TryIncreaseSkill(SkillType skillType) + { + var level = _skillsLevelDictionary[skillType]; + var price = _skillStaticDataDictionary[skillType].GetPriceForLevel(level); + if (_tryToByASkill?.Invoke(-price) ?? false) + { + _skillsLevelDictionary[skillType]++; + _onChangeSkills?.Invoke(_skillsLevelDictionary, _getCountLoot?.Invoke() ?? 0); + + return true; + } + + return false; + } + } +} diff --git a/Assets/Internal assets/Scripts/Skill/SkillsBook.cs.meta b/Assets/Internal assets/Scripts/Skill/SkillsManager.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Skill/SkillsBook.cs.meta rename to Assets/Internal assets/Scripts/Skill/SkillsManager.cs.meta diff --git a/Assets/Internal assets/Scripts/Socket/FollowThePlayer.cs b/Assets/Internal assets/Scripts/Socket/FollowThePlayer.cs new file mode 100644 index 0000000..1f64840 --- /dev/null +++ b/Assets/Internal assets/Scripts/Socket/FollowThePlayer.cs @@ -0,0 +1,21 @@ +#region + +using UnityEngine; + +#endregion + +namespace Socket +{ + public class FollowThePlayer : MonoBehaviour + { + [SerializeField] private Transform triggerTransform; + + private void LateUpdate() + { + var rotation = triggerTransform.rotation; + transform.rotation = Quaternion.Euler(new Vector3(0, rotation.eulerAngles.y, 0)); + } + + + } +} diff --git a/Assets/Internal assets/Scripts/Socket/SocketInPlayer/RotationForwardPlayer.cs.meta b/Assets/Internal assets/Scripts/Socket/FollowThePlayer.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Socket/SocketInPlayer/RotationForwardPlayer.cs.meta rename to Assets/Internal assets/Scripts/Socket/FollowThePlayer.cs.meta diff --git a/Assets/Internal assets/Scripts/Socket/SocketInPlayer.meta b/Assets/Internal assets/Scripts/Socket/SocketInPlayer.meta deleted file mode 100644 index e82ddf7..0000000 --- a/Assets/Internal assets/Scripts/Socket/SocketInPlayer.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: fe32143b35c360447943aaca2491314b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Internal assets/Scripts/Socket/SocketInPlayer/RotationForwardPlayer.cs b/Assets/Internal assets/Scripts/Socket/SocketInPlayer/RotationForwardPlayer.cs deleted file mode 100644 index 420bd9f..0000000 --- a/Assets/Internal assets/Scripts/Socket/SocketInPlayer/RotationForwardPlayer.cs +++ /dev/null @@ -1,15 +0,0 @@ -using UnityEngine; - -namespace Socket.SocketInPlayer -{ - public class RotationForwardPlayer : MonoBehaviour - { - [SerializeField] private Transform _triggerTransform; - - private void Update() - { - var rotation = _triggerTransform.rotation; - transform.rotation = Quaternion.Euler(new Vector3(0, rotation.eulerAngles.y, 0)); - } - } -} \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Portal.meta b/Assets/Internal assets/Scripts/TransitionToTheDungeon.meta similarity index 100% rename from Assets/Internal assets/Scripts/Portal.meta rename to Assets/Internal assets/Scripts/TransitionToTheDungeon.meta diff --git a/Assets/Internal assets/Scripts/TransitionToTheDungeon/TransitionToTheDungeonTrigger.cs b/Assets/Internal assets/Scripts/TransitionToTheDungeon/TransitionToTheDungeonTrigger.cs new file mode 100644 index 0000000..f91930b --- /dev/null +++ b/Assets/Internal assets/Scripts/TransitionToTheDungeon/TransitionToTheDungeonTrigger.cs @@ -0,0 +1,34 @@ +#region + +using UnityEngine; +using UnityEngine.Events; + +#endregion + +namespace TransitionToTheDungeon +{ + public class TransitionToTheDungeonTrigger : MonoBehaviour + { + private bool _isTrigger; + private UnityAction _onTransitionToTheDungeon; + + private void OnTriggerEnter(Collider other) + { + if (other.CompareTag("Player") && !_isTrigger) + { + _onTransitionToTheDungeon?.Invoke(); + _isTrigger = true; + } + } + + public void RegisterOnTransitionToTheDungeon(UnityAction onTransitionToTheDungeon) + { + _onTransitionToTheDungeon = onTransitionToTheDungeon; + } + + public void UnregisterOnTransitionToTheDungeon(UnityAction onTransitionToTheDungeon) + { + _onTransitionToTheDungeon -= onTransitionToTheDungeon; + } + } +} diff --git a/Assets/Internal assets/Scripts/Portal/PortalTrigger.cs.meta b/Assets/Internal assets/Scripts/TransitionToTheDungeon/TransitionToTheDungeonTrigger.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/Portal/PortalTrigger.cs.meta rename to Assets/Internal assets/Scripts/TransitionToTheDungeon/TransitionToTheDungeonTrigger.cs.meta diff --git a/Assets/Internal assets/Scripts/UI/DungeonRoom/MenuInDungeonRoomScreen.cs b/Assets/Internal assets/Scripts/UI/DungeonRoom/MenuInDungeonLocationScreen.cs similarity index 78% rename from Assets/Internal assets/Scripts/UI/DungeonRoom/MenuInDungeonRoomScreen.cs rename to Assets/Internal assets/Scripts/UI/DungeonRoom/MenuInDungeonLocationScreen.cs index cc6781f..a0f86bf 100644 --- a/Assets/Internal assets/Scripts/UI/DungeonRoom/MenuInDungeonRoomScreen.cs +++ b/Assets/Internal assets/Scripts/UI/DungeonRoom/MenuInDungeonLocationScreen.cs @@ -1,10 +1,14 @@ +#region + using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; +#endregion + namespace UI.DungeonRoom { - public class MenuInDungeonRoomScreen : MonoBehaviour + public class MenuInDungeonLocationScreen : MonoBehaviour { [SerializeField] private Button exitButton; diff --git a/Assets/Internal assets/Scripts/UI/DungeonRoom/MenuInDungeonRoomScreen.cs.meta b/Assets/Internal assets/Scripts/UI/DungeonRoom/MenuInDungeonLocationScreen.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/UI/DungeonRoom/MenuInDungeonRoomScreen.cs.meta rename to Assets/Internal assets/Scripts/UI/DungeonRoom/MenuInDungeonLocationScreen.cs.meta diff --git a/Assets/Internal assets/Scripts/UI/MainLocation/MenuInMainLocationScreen.cs b/Assets/Internal assets/Scripts/UI/MainLocation/MenuInMainLocationScreen.cs index bf23ab5..56d7f09 100644 --- a/Assets/Internal assets/Scripts/UI/MainLocation/MenuInMainLocationScreen.cs +++ b/Assets/Internal assets/Scripts/UI/MainLocation/MenuInMainLocationScreen.cs @@ -1,7 +1,11 @@ -using UnityEngine; +#region + +using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; +#endregion + namespace UI.MainLocation { public class MenuInMainLocationScreen : MonoBehaviour @@ -15,4 +19,4 @@ public void SetUp(UnityAction saveProgress, UnityAction exitInMainMenu) exitButton.onClick.AddListener(exitInMainMenu); } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/UI/MainLocation/SkillScreen.cs b/Assets/Internal assets/Scripts/UI/MainLocation/SkillScreen.cs index 1405dc4..51d99aa 100644 --- a/Assets/Internal assets/Scripts/UI/MainLocation/SkillScreen.cs +++ b/Assets/Internal assets/Scripts/UI/MainLocation/SkillScreen.cs @@ -1,17 +1,21 @@ -using UnityEngine; +#region + +using UnityEngine; using UnityEngine.UI; +#endregion + namespace UI.MainLocation { public class SkillScreen : MonoBehaviour { - [field: SerializeField] public Image BackgroundSkill {get; private set;} - [field: SerializeField] public Text NameSkill {get; private set;} - [field: SerializeField] public Text LevelSkill {get; private set;} - [field: SerializeField] public Text ValueSkill {get; private set;} - [field: SerializeField] public Text TypeSkill {get; private set;} - [field: SerializeField] public Text PriceSkill {get; private set;} - [field: SerializeField] public Text DescriptionSkill {get; private set;} + [field: SerializeField] public Image BackgroundSkill { get; private set; } + [field: SerializeField] public Text NameSkill { get; private set; } + [field: SerializeField] public Text LevelSkill { get; private set; } + [field: SerializeField] public Text ValueSkill { get; private set; } + [field: SerializeField] public Text TypeSkill { get; private set; } + [field: SerializeField] public Text PriceSkill { get; private set; } + [field: SerializeField] public Text DescriptionSkill { get; private set; } [field: SerializeField] public Button PriceSkillButton { get; private set; } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/UI/MainLocation/SkillsBookScreen.cs b/Assets/Internal assets/Scripts/UI/MainLocation/SkillsBookScreen.cs index 00f0066..fa0bc51 100644 --- a/Assets/Internal assets/Scripts/UI/MainLocation/SkillsBookScreen.cs +++ b/Assets/Internal assets/Scripts/UI/MainLocation/SkillsBookScreen.cs @@ -1,24 +1,29 @@ +#region + using System; using System.Collections.Generic; using Data.Static; using Skill; using UnityEngine; +#endregion + namespace UI.MainLocation { public class SkillsBookScreen : MonoBehaviour { [SerializeField] private SkillScreen[] skillScreens; + private Predicate _onTryIncreaseSkill; + private Dictionary _skillScreenDictionary; private Dictionary _skillStaticDataDictionary; - private SkillsBook _skillsBook; - - public void SetUp(SkillsBook skillsBook, Dictionary skillStaticDatas) + public void SetUp(Predicate onTryIncreaseSkill, + ref Action, int> onChangeSkills, + Dictionary skillStaticDictionary) { - _skillsBook = skillsBook; - _skillStaticDataDictionary = skillStaticDatas; + _skillStaticDataDictionary = skillStaticDictionary; _skillScreenDictionary = new Dictionary(); for (var i = 0; i < skillScreens.Length; i++) @@ -28,30 +33,42 @@ public void SetUp(SkillsBook skillsBook, Dictionary SetUISkill(skillsType); } - _skillsBook.RegisterOnChangeSkill(UpdateUISkill); + _onTryIncreaseSkill = onTryIncreaseSkill; + onChangeSkills += UpdateAllUISkills; } - private void UpdateUISkill(Dictionary levelDictionary, int amountMoney) + private void UpdateAllUISkills(Dictionary levelDictionary, int amountMoney) { - foreach (var (skillType, skillScreen) in _skillScreenDictionary) + foreach (var (skillType, skillLevel) in levelDictionary) { - var level = levelDictionary[skillType]; - skillScreen.LevelSkill.text = level.ToString(); - skillScreen.PriceSkill.text = _skillStaticDataDictionary[skillType].GetPriceForLevel(level).ToString(); - skillScreen.PriceSkill.text = (_skillStaticDataDictionary[skillType].BaseValueSkill * level).ToString(); - skillScreen.BackgroundSkill.color = _skillStaticDataDictionary[skillType].GetPriceForLevel(level) > amountMoney ? new Color(1f, 1f, 1f, 0.2f) : new Color(0f, 0f, 0f, 0.2f); + UpdateUISkill(skillType, skillLevel, amountMoney); } } + private void UpdateUISkill(SkillType skillType, int skillLevel, int amountMoney) + { + if (!_skillScreenDictionary.TryGetValue(skillType, out var skillScreen) || + !_skillStaticDataDictionary.TryGetValue(skillType, out var skillStaticData)) return; + + skillScreen.LevelSkill.text = $"{skillLevel}"; + skillScreen.PriceSkill.text = $"{skillStaticData.GetPriceForLevel(skillLevel)}"; + skillScreen.ValueSkill.text = $"{skillStaticData.BaseValueSkill * skillLevel}"; + skillScreen.BackgroundSkill.color = + skillStaticData.GetPriceForLevel(skillLevel) > amountMoney + ? new Color(1f, 1f, 1f, 0.2f) + : new Color(0f, 0f, 0f, 0.2f); + } + private void SetUISkill(SkillType skillType) { - _skillScreenDictionary[skillType].NameSkill.text = _skillStaticDataDictionary[skillType].NameSkill; - _skillScreenDictionary[skillType].DescriptionSkill.text = - _skillStaticDataDictionary[skillType].DescriptionSkill; + if (!_skillScreenDictionary.TryGetValue(skillType, out var skillScreen) || + !_skillStaticDataDictionary.TryGetValue(skillType, out var skillStaticData)) return; + + skillScreen.PriceSkillButton.onClick.AddListener(() => _onTryIncreaseSkill?.Invoke(skillType)); + skillScreen.DescriptionSkill.text = skillStaticData.DescriptionSkill; + skillScreen.NameSkill.text = skillStaticData.NameSkill; + skillScreen.TypeSkill.text = skillStaticData.TypeSkill; - _skillScreenDictionary[skillType].TypeSkill.text = _skillStaticDataDictionary[skillType].TypeSkill; - _skillScreenDictionary[skillType].PriceSkillButton.onClick - .AddListener(() => _skillsBook.TryIncreaseSkill(skillType)); } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/UI/MainMenu/MainMenuScreen.cs b/Assets/Internal assets/Scripts/UI/MainMenu/MainMenuScreen.cs index 6dd5676..d5dc71f 100644 --- a/Assets/Internal assets/Scripts/UI/MainMenu/MainMenuScreen.cs +++ b/Assets/Internal assets/Scripts/UI/MainMenu/MainMenuScreen.cs @@ -1,26 +1,30 @@ -using UnityEngine; +#region + +using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; +#endregion + namespace UI.MainMenu { public class MainMenuScreen : MonoBehaviour { - [SerializeField] private Button _loadGameButton; - [SerializeField] private Button _newGameButton; - [SerializeField] private Button _exitButton; - [Space] - [SerializeField] private Button _confirmationTrueButton; - [SerializeField] private Button _confirmationFalseButton; - [Space] - [SerializeField] private GameObject _mainPanel; - [SerializeField] private GameObject _confirmationPanel; + [SerializeField] private Button loadGameButton; + [SerializeField] private Button newGameButton; + [SerializeField] private Button exitButton; + + [Space] [SerializeField] private Button confirmationTrueButton; + [SerializeField] private Button confirmationFalseButton; + + [Space] [SerializeField] private GameObject mainPanel; + [SerializeField] private GameObject confirmationPanel; private readonly UnityAction _exitGame = Application.Quit; - private UnityAction _newGame; - private UnityAction _loadGame; private bool _isInStockSave; + private UnityAction _loadGame; + private UnityAction _newGame; public void SetUp(UnityAction newGame, UnityAction loadGame, bool isInStockSave) { @@ -28,14 +32,14 @@ public void SetUp(UnityAction newGame, UnityAction loadGame, bool isInStockSave) _newGame = newGame; _loadGame = loadGame; - _loadGameButton.onClick.AddListener(LoadGame); - _newGameButton.onClick.AddListener(NewGame); - _exitButton.onClick.AddListener(ExitGame); + loadGameButton.onClick.AddListener(LoadGame); + newGameButton.onClick.AddListener(NewGame); + exitButton.onClick.AddListener(ExitGame); - _mainPanel.SetActive(true); - _confirmationPanel.SetActive(false); + mainPanel.SetActive(true); + confirmationPanel.SetActive(false); - _loadGameButton.gameObject.SetActive(_isInStockSave); + loadGameButton.gameObject.SetActive(_isInStockSave); } private void LoadGame() @@ -56,17 +60,17 @@ private void ExitGame() private void ActionConfirmation(UnityAction unityAction) { - _mainPanel.SetActive(false); - _confirmationPanel.SetActive(true); - _confirmationTrueButton.onClick.AddListener(unityAction); - _confirmationFalseButton.onClick.AddListener( + mainPanel.SetActive(false); + confirmationPanel.SetActive(true); + confirmationTrueButton.onClick.AddListener(unityAction); + confirmationFalseButton.onClick.AddListener( () => { - _confirmationFalseButton.onClick.RemoveAllListeners(); - _confirmationTrueButton.onClick.RemoveAllListeners(); - _mainPanel.SetActive(true); - _confirmationPanel.SetActive(false); + confirmationFalseButton.onClick.RemoveAllListeners(); + confirmationTrueButton.onClick.RemoveAllListeners(); + mainPanel.SetActive(true); + confirmationPanel.SetActive(false); }); } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Units/Enemy/Enemy.cs b/Assets/Internal assets/Scripts/Units/Enemy/Enemy.cs index 7640831..4eaaf88 100644 --- a/Assets/Internal assets/Scripts/Units/Enemy/Enemy.cs +++ b/Assets/Internal assets/Scripts/Units/Enemy/Enemy.cs @@ -1,22 +1,31 @@ -using System; -using Infrastructure.Factory.EnemyFactory; -using Item; +#region + +using System; using Units.Enemy.State_Machines; using Units.Enemy.State_Machines.State; using UnityEngine; using UnityEngine.AI; +using UnityEngine.Events; + +#endregion namespace Units.Enemy { public class Enemy : MonoBehaviour { - [NonSerialized] public bool PlayerInRange; - public Action AnimationTriggerName; - private StateMachine _stateMachine; private float _healthPoints; + private StateMachine _stateMachine; + private UnityAction _onAnimationTriggerName; + [NonSerialized] public bool PlayerInRange; + + private void Update() + { + _stateMachine?.Tick(); + } - public void SetUp(float healthPoints, float effectiveDistance, float cleavage, float attackCooldown, - float damage, float movementSpeed, float rotationSpeed, Transform playerTransform, IEnemyFactory enemyFactory) + public void SetUp(float healthPoints, float effectiveDistance, float attackCooldown, + float damage, float movementSpeed, float rotationSpeed, Transform playerTransform, + UnityAction onEnemyDead) { _healthPoints = healthPoints; var healthPointsLateUpdate = _healthPoints; @@ -31,17 +40,24 @@ public void SetUp(float healthPoints, float effectiveDistance, float cleavage, f : gameObject.AddComponent(); var enemyDamages = GetComponentsInChildren(); + foreach (var enemyDamage in enemyDamages) + { + enemyDamage.Damage = damage; + } + foreach (var enemyOnTriggerEnter in GetComponents()) - enemyOnTriggerEnter.RegisterOnGetHit(getHitDamage => _healthPoints -= getHitDamage); + { + enemyOnTriggerEnter.RegisterOnGetHitWatcher(getHitDamage => _healthPoints -= getHitDamage); + } _stateMachine = new StateMachine(); var searchPositionForPatrol = new SearchPositionForPatrol(thisTransform, out var targetTransform); var patrol = new Patrol(animator, navMeshAgent, thisTransform, targetTransform, movementSpeed / 2); - var combatReadiness = new CombatReadiness(animator, thisTransform, playerTransform, rotationSpeed); - var attack = new Attack(this, animator, damage, enemyDamages); - var getHit = new GetHit(this, animator); - var dead = new Dead(this, animator, enemyFactory); + var combatReadiness = new CombatReadiness(thisTransform, playerTransform, rotationSpeed); + var attack = new Attack(ref _onAnimationTriggerName, animator, enemyDamages); + var getHit = new GetHit(ref _onAnimationTriggerName, animator); + var dead = new Dead(this, animator, onEnemyDead); var moveToPlayer = new MoveToPlayer( animator, navMeshAgent, @@ -53,60 +69,111 @@ public void SetUp(float healthPoints, float effectiveDistance, float cleavage, f At(combatReadiness, attack, AttackOver()); At(combatReadiness, getHit, GetHitOver()); At(patrol, searchPositionForPatrol, HasTargetForPatrol()); - At(dead, combatReadiness, IsDead()); At(attack, combatReadiness, CanAttack()); At(moveToPlayer, combatReadiness, PlayerNonInReachOfAttack()); + At(searchPositionForPatrol, moveToPlayer, StuckForOverATwoSecondInMoveToPlayer()); At(searchPositionForPatrol, moveToPlayer, PlayerNonInRangeVisible()); At(combatReadiness, moveToPlayer, PlayerInReachOfAttack()); At(moveToPlayer, patrol, PlayerInRangeVisible()); At(searchPositionForPatrol, patrol, StuckForOverATwoSecondInPatrol()); At(searchPositionForPatrol, patrol, ReachedPatrolPoint()); + At(dead, getHit, IsDead()); + AtAny(dead, Failed()); AtAny(getHit, IsGetHit()); - // AtAny(dead, Failed()); _stateMachine.SetState(searchPositionForPatrol); - void At(IState to, IState from, Func condition) => _stateMachine.AddTransition(to, from, condition); - void AtAny(IState to, Func condition) => _stateMachine.AddAnyTransition(to, condition); + void At(IState to, IState from, Func condition) + { + _stateMachine.AddTransition(to, from, condition); + } + + void AtAny(IState to, Func condition) + { + _stateMachine.AddAnyTransition(to, condition); + } + + Func StuckForOverATwoSecondInPatrol() + { + return () => patrol.TimeStuck >= 2f; + } + + Func StuckForOverATwoSecondInMoveToPlayer() + { + return () => moveToPlayer.TimeStuck >= 2f; + } - Func StuckForOverATwoSecondInPatrol() => () => patrol.TimeStuck >= 2f; - Func PlayerInRangeVisible() => () => playerTransform != null && PlayerInRange; - Func PlayerNonInRangeVisible() => () => !PlayerInRange; - Func CanAttack() => () => combatReadiness.TimePassed >= attackCooldown; - Func AttackOver() => () => attack.EndAttack; - Func GetHitOver() => () => getHit.EndGetHit; - Func IsDead() => () => _healthPoints <= 0; - // Func Failed() => () => thisTransform.position.y < -50; + Func PlayerInRangeVisible() + { + return () => playerTransform != null && PlayerInRange; + } - Func PlayerInReachOfAttack() => () => - Vector3.Distance(thisTransform.position, playerTransform.position) <= effectiveDistance * 0.9; + Func PlayerNonInRangeVisible() + { + return () => !PlayerInRange; + } - Func PlayerNonInReachOfAttack() => () => - Vector3.Distance(thisTransform.position, playerTransform.position) > effectiveDistance * 1.1; + Func CanAttack() + { + return () => combatReadiness.TimePassed >= attackCooldown; + } - Func HasTargetForPatrol() => () => - Vector3.Distance(thisTransform.position, targetTransform.position) > 5f; + Func AttackOver() + { + return () => attack.EndAttack; + } - Func ReachedPatrolPoint() => () => - Vector3.Distance(thisTransform.position, targetTransform.position) < 1f; + Func GetHitOver() + { + return () => getHit.EndGetHit; + } - Func IsGetHit() => () => + Func IsDead() { - if (_healthPoints == healthPointsLateUpdate || _healthPoints <= 0) - return false; + return () => _healthPoints <= 0; + } - healthPointsLateUpdate = _healthPoints; - return true; - }; - } + Func Failed() + { + return () => thisTransform.position.y < -50; + } + + Func PlayerInReachOfAttack() + { + return () => Vector3.Distance(thisTransform.position, playerTransform.position) <= effectiveDistance * 0.9; + } + + Func PlayerNonInReachOfAttack() + { + return () => Vector3.Distance(thisTransform.position, playerTransform.position) > effectiveDistance * 1.1; + } + + Func HasTargetForPatrol() + { + return () => Vector3.Distance(thisTransform.position, targetTransform.position) > 5f; + } - private void Update() => _stateMachine?.Tick(); - public void AnimationTrigger(string triggerName) => AnimationTriggerName?.Invoke(triggerName); + Func ReachedPatrolPoint() + { + return () => Vector3.Distance(thisTransform.position, targetTransform.position) < 1f; + } + + Func IsGetHit() + { + return () => + { + if (Math.Abs(_healthPoints - healthPointsLateUpdate) < 0 || _healthPoints <= 0) + return false; + + healthPointsLateUpdate = _healthPoints; + return true; + }; + } + } - private void OnTriggerEnter(Collider other) + public void AnimationTrigger(string triggerName) { - if (other.TryGetComponent(out var itemDamage) && itemDamage.IsDamage) - _healthPoints -= itemDamage.Damage; + _onAnimationTriggerName?.Invoke(triggerName); } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Units/Enemy/EnemyDamage.cs b/Assets/Internal assets/Scripts/Units/Enemy/EnemyDamage.cs index 523fd64..3f18917 100644 --- a/Assets/Internal assets/Scripts/Units/Enemy/EnemyDamage.cs +++ b/Assets/Internal assets/Scripts/Units/Enemy/EnemyDamage.cs @@ -1,19 +1,20 @@ -using UnityEngine; +#region + +using UnityEngine; + +#endregion namespace Units.Enemy { public class EnemyDamage : MonoBehaviour { + [field: SerializeField] public Side Side { get; private set; } public float Damage { get; set; } public bool IsDamage { get; private set; } - [field: SerializeField] public Side side { get; private set; } - - public void SetIsDamage(bool value) => IsDamage = value; - public enum Side + public void SetIsDamage(bool value) { - Left, - Right, + IsDamage = value; } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Units/Enemy/EnemyGetHit.cs b/Assets/Internal assets/Scripts/Units/Enemy/EnemyGetHit.cs index bdcbbff..70adcc5 100644 --- a/Assets/Internal assets/Scripts/Units/Enemy/EnemyGetHit.cs +++ b/Assets/Internal assets/Scripts/Units/Enemy/EnemyGetHit.cs @@ -1,7 +1,11 @@ -using Item; +#region + +using Item; using UnityEngine; using UnityEngine.Events; +#endregion + namespace Units.Enemy { public class EnemyGetHit : MonoBehaviour @@ -14,14 +18,14 @@ private void OnTriggerEnter(Collider other) _onGetHit?.Invoke(itemDamage.Damage); } - public void RegisterOnGetHit(UnityAction action) + public void RegisterOnGetHitWatcher(UnityAction action) { _onGetHit += action; } - - public void RemoveOnGetHit(UnityAction action) + + public void RemoveOnGetHitWatcher(UnityAction action) { _onGetHit -= action; } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Units/Enemy/EnemyType.cs b/Assets/Internal assets/Scripts/Units/Enemy/EnemyType.cs index 71cc17f..c3e0e9e 100644 --- a/Assets/Internal assets/Scripts/Units/Enemy/EnemyType.cs +++ b/Assets/Internal assets/Scripts/Units/Enemy/EnemyType.cs @@ -7,6 +7,6 @@ public enum EnemyType Grunt = 2, Footman = 3, Beholder = 4, - ChestMonster = 5, + ChestMonster = 5 } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Units/Enemy/Side.cs b/Assets/Internal assets/Scripts/Units/Enemy/Side.cs new file mode 100644 index 0000000..deeafc5 --- /dev/null +++ b/Assets/Internal assets/Scripts/Units/Enemy/Side.cs @@ -0,0 +1,8 @@ +namespace Units.Enemy +{ + public enum Side + { + Left, + Right + } +} diff --git a/Assets/Internal assets/Scripts/Units/Enemy/Side.cs.meta b/Assets/Internal assets/Scripts/Units/Enemy/Side.cs.meta new file mode 100644 index 0000000..50ebc8c --- /dev/null +++ b/Assets/Internal assets/Scripts/Units/Enemy/Side.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 57c52cf1e30c41c7a2f93872df9c98e4 +timeCreated: 1684881883 \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/IState.cs b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/IState.cs index 80ecee7..d6e4b05 100644 --- a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/IState.cs +++ b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/IState.cs @@ -6,4 +6,4 @@ public interface IState void Tick(); void OnExit(); } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/Attack.cs b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/Attack.cs index d78e13f..a4c572b 100644 --- a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/Attack.cs +++ b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/Attack.cs @@ -1,51 +1,48 @@ -using System; +#region + using System.Collections.Generic; +using System.Linq; using UnityEngine; +using UnityEngine.Events; + +#endregion namespace Units.Enemy.State_Machines.State { public class Attack : IState { - #region Variables - - public bool EndAttack; - - private readonly Animator _animator; - private readonly Enemy _enemy; - private readonly static int ATTACK1 = Animator.StringToHash("Attack1"); - - private readonly Dictionary _enemyDamages = new() - { - { EnemyDamage.Side.Left, null }, - { EnemyDamage.Side.Right, null }, - }; - - private Action _animationTriggerName; - - #endregion - - #region Constructors - - public Attack(Enemy enemy, Animator animator, float damage, params EnemyDamage[] enemyDamages) + public Attack(ref UnityAction onAnimationTrigger, Animator animator, params EnemyDamage[] enemyDamages) { - _enemy = enemy; + onAnimationTrigger += HandlerAnimationTrigger; _animator = animator; - foreach (var enemyDamage in enemyDamages) + var dictionary = new Dictionary>(); + foreach (var damage in enemyDamages) { - enemyDamage.Damage = damage; - _enemyDamages[enemyDamage.side] = enemyDamage; + if (dictionary.TryGetValue(damage.Side, out var damages)) + { + damages.Add(damage); + } + else + { + dictionary.Add(damage.Side, new List()); + dictionary[damage.Side].Add(damage); + } } + + _enemyDamages = dictionary; } + private readonly static int Attack1 = Animator.StringToHash("Attack1"); + + private readonly Animator _animator; - #endregion + private readonly Dictionary> _enemyDamages; - #region Methods + public bool EndAttack; public void OnEnter() { - _animator.SetBool(ATTACK1, true); - _enemy.AnimationTriggerName = HandlerAnimationTrigger; + _animator.SetBool(Attack1, true); EndAttack = false; } @@ -55,36 +52,42 @@ public void Tick() public void OnExit() { - _animator.SetBool(ATTACK1, false); - _enemy.AnimationTriggerName -= HandlerAnimationTrigger; + _animator.SetBool(Attack1, false); } - #endregion - - #region Methods Other - private void HandlerAnimationTrigger(string animationTriggerName) { + List enemyDamages; switch (animationTriggerName) { case "attackLeft": - _enemyDamages[EnemyDamage.Side.Left].SetIsDamage(true); + if (_enemyDamages.TryGetValue(Side.Left, out enemyDamages)) + foreach (var enemyDamage in enemyDamages) + enemyDamage.SetIsDamage(true); + break; case "attackEndLeft": - _enemyDamages[EnemyDamage.Side.Left].SetIsDamage(false); + if (_enemyDamages.TryGetValue(Side.Left, out enemyDamages)) + foreach (var enemyDamage in enemyDamages) + enemyDamage.SetIsDamage(false); + break; case "attackRight": - _enemyDamages[EnemyDamage.Side.Right].SetIsDamage(true); + if (_enemyDamages.TryGetValue(Side.Right, out enemyDamages)) + foreach (var enemyDamage in enemyDamages) + enemyDamage.SetIsDamage(true); + break; case "attackEndRight": - _enemyDamages[EnemyDamage.Side.Right].SetIsDamage(false); + if (_enemyDamages.TryGetValue(Side.Right, out enemyDamages)) + foreach (var enemyDamage in enemyDamages) + enemyDamage.SetIsDamage(false); + break; case "animationEnd": EndAttack = true; break; } } - - #endregion } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/CombatReadiness.cs b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/CombatReadiness.cs index b2a0d71..30cb201 100644 --- a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/CombatReadiness.cs +++ b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/CombatReadiness.cs @@ -1,32 +1,24 @@ -using UnityEngine; +#region + +using UnityEngine; + +#endregion namespace Units.Enemy.State_Machines.State { public class CombatReadiness : IState { - #region Variables - - public float TimePassed; - private readonly Animator _animator; - private Transform _playerTransform; - private Transform _transform; - private float _speedRotation; - - #endregion - - #region Constructors - - public CombatReadiness(Animator animator, Transform transform, Transform playerTransform, float speedRotation) + public CombatReadiness(Transform transform, Transform playerTransform, float speedRotation) { - _animator = animator; _transform = transform; _playerTransform = playerTransform; _speedRotation = speedRotation; } - #endregion - - #region Methods + private readonly Transform _playerTransform; + private readonly float _speedRotation; + private readonly Transform _transform; + public float TimePassed; public void OnEnter() { @@ -52,11 +44,5 @@ public void Tick() public void OnExit() { } - - #endregion - - #region Methods Other - - #endregion } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/Dead.cs b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/Dead.cs index a27043b..4c2bcb5 100644 --- a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/Dead.cs +++ b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/Dead.cs @@ -1,38 +1,29 @@ -using System; -using Infrastructure.Factory.EnemyFactory; +#region + using UnityEngine; +using UnityEngine.Events; + +#endregion namespace Units.Enemy.State_Machines.State { public class Dead : IState { - #region Variables - - private readonly Enemy _enemy; - private readonly Animator _animator; - private readonly IEnemyFactory _enemyFactory; - private readonly static int DEAD = Animator.StringToHash("Dead"); - - #endregion - - #region Constructors - - public Dead(Enemy enemy, Animator animator, IEnemyFactory enemyFactory) + public Dead(Enemy enemy, Animator animator, UnityAction onEnemyDead) { _enemy = enemy; _animator = animator; - _enemyFactory = enemyFactory; + _onEnemyDead = onEnemyDead; } - - #endregion - - #region Methods + private readonly static int Death = Animator.StringToHash("Dead"); + private readonly Animator _animator; + private readonly Enemy _enemy; + private readonly UnityAction _onEnemyDead; public void OnEnter() { - _animator.SetBool(DEAD, true); - _enemyFactory.DeadEnemy(_enemy); - Debug.Log("Dead"); + _animator.SetBool(Death, true); + _onEnemyDead?.Invoke(_enemy); } public void Tick() @@ -42,11 +33,5 @@ public void Tick() public void OnExit() { } - - #endregion - - #region Methods Other - - #endregion } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/GetHit.cs b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/GetHit.cs index 6cff364..75b7dd1 100644 --- a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/GetHit.cs +++ b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/GetHit.cs @@ -1,39 +1,27 @@ -using System; +#region + using UnityEngine; +using UnityEngine.Events; + +#endregion namespace Units.Enemy.State_Machines.State { public class GetHit : IState { - #region Variables - - public bool EndGetHit; - - private readonly Animator _animator; - private readonly Enemy _enemy; - private readonly static int DAMAGE = Animator.StringToHash("GetHit"); - - private Action _animationTriggerName; - - #endregion - - #region Constructors - - public GetHit(Enemy enemy, Animator animator) + public GetHit(ref UnityAction onAnimationTrigger, Animator animator) { - _enemy = enemy; + onAnimationTrigger += HandlerAnimationTrigger; _animator = animator; } - - #endregion - - #region Methods + private readonly static int Damage = Animator.StringToHash("GetHit"); + private readonly Animator _animator; + public bool EndGetHit; public void OnEnter() { EndGetHit = false; - _animator.SetBool(DAMAGE, true); - _enemy.AnimationTriggerName = HandlerAnimationTrigger; + _animator.SetBool(Damage, true); } public void Tick() @@ -42,23 +30,15 @@ public void Tick() public void OnExit() { - _animator.SetBool(DAMAGE, false); - _enemy.AnimationTriggerName -= HandlerAnimationTrigger; + _animator.SetBool(Damage, false); } - #endregion - - #region Methods Other - private void HandlerAnimationTrigger(string animationTriggerName) { if (animationTriggerName == "animationEnd") { EndGetHit = true; - Debug.Log("animationEnd GetHit"); } } - - #endregion } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/MoveToPlayer.cs b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/MoveToPlayer.cs index 9da350e..2cc1e92 100644 --- a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/MoveToPlayer.cs +++ b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/MoveToPlayer.cs @@ -1,27 +1,14 @@ -using UnityEngine; +#region + +using UnityEngine; using UnityEngine.AI; +#endregion + namespace Units.Enemy.State_Machines.State { public class MoveToPlayer : IState { - #region Variables - - public float TimeStuck; - - private readonly Animator _animator; - private readonly NavMeshAgent _navMeshAgent; - private readonly Transform _thisTransform; - private readonly Transform _playerTransform; - private readonly float _speedMove; - private readonly float _stoppingDistance; - private Vector3 _lastPosition = Vector3.zero; - private static readonly int WALK = Animator.StringToHash("Walk"); - - #endregion - - #region Constructors - public MoveToPlayer(Animator animator, NavMeshAgent navMeshAgent, Transform thisTransform, Transform playerTransform, float speedMove, float stoppingDistance) { @@ -32,10 +19,16 @@ public MoveToPlayer(Animator animator, NavMeshAgent navMeshAgent, Transform this _speedMove = speedMove; _stoppingDistance = stoppingDistance; } + private readonly static int Walk = Animator.StringToHash("Walk"); - #endregion - - #region Methods + private readonly Animator _animator; + private readonly NavMeshAgent _navMeshAgent; + private readonly Transform _playerTransform; + private readonly float _speedMove; + private readonly float _stoppingDistance; + private readonly Transform _thisTransform; + private Vector3 _lastPosition = Vector3.zero; + public float TimeStuck; public void OnEnter() { @@ -43,7 +36,7 @@ public void OnEnter() _navMeshAgent.speed = _speedMove; _navMeshAgent.stoppingDistance = _stoppingDistance; - _animator.SetBool(WALK, true); + _animator.SetBool(Walk, true); } public void Tick() @@ -58,10 +51,7 @@ public void Tick() public void OnExit() { _navMeshAgent.enabled = false; - - _animator.SetBool(WALK, false); + _animator.SetBool(Walk, false); } - - #endregion } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/Patrol.cs b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/Patrol.cs index ab695db..5940358 100644 --- a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/Patrol.cs +++ b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/Patrol.cs @@ -1,27 +1,16 @@ -using UnityEngine; +#region + +using UnityEngine; using UnityEngine.AI; +#endregion + namespace Units.Enemy.State_Machines.State { public class Patrol : IState { - #region Variables - - private readonly Animator _animator; - private readonly NavMeshAgent _navMeshAgent; - private readonly Transform _thisTransform; - private readonly Transform _targetTransform; - private readonly float _speed; - private Vector3 _lastPosition = Vector3.zero; - public float TimeStuck; - - private readonly static int WALK = Animator.StringToHash("Walk"); - - #endregion - - #region Constructors - - public Patrol(Animator animator, NavMeshAgent navMeshAgent, Transform thisTransform, Transform targetTransform, float speed) + public Patrol(Animator animator, NavMeshAgent navMeshAgent, Transform thisTransform, Transform targetTransform, + float speed) { _animator = animator; _navMeshAgent = navMeshAgent; @@ -30,9 +19,15 @@ public Patrol(Animator animator, NavMeshAgent navMeshAgent, Transform thisTransf _speed = speed; } - #endregion + private readonly static int Walk = Animator.StringToHash("Walk"); - #region Methods Unity + private readonly Animator _animator; + private readonly NavMeshAgent _navMeshAgent; + private readonly float _speed; + private readonly Transform _targetTransform; + private readonly Transform _thisTransform; + private Vector3 _lastPosition = Vector3.zero; + public float TimeStuck; public void OnEnter() { @@ -40,9 +35,7 @@ public void OnEnter() _navMeshAgent.speed = _speed; _navMeshAgent.stoppingDistance = 0f; _navMeshAgent.SetDestination(_targetTransform.position); - - _animator.SetBool(WALK, true); - + _animator.SetBool(Walk, true); TimeStuck = 0; } @@ -50,16 +43,14 @@ public void Tick() { if (Vector3.Distance(_thisTransform.position, _lastPosition) <= 0.025f) TimeStuck += Time.deltaTime; + _lastPosition = _thisTransform.position; } public void OnExit() { _navMeshAgent.enabled = false; - - _animator.SetBool(WALK, false); + _animator.SetBool(Walk, false); } - - #endregion } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/SearchPositionForPatrol.cs b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/SearchPositionForPatrol.cs index e01c7fc..1e21fcc 100644 --- a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/SearchPositionForPatrol.cs +++ b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/State/SearchPositionForPatrol.cs @@ -1,29 +1,21 @@ -using UnityEngine; +#region + +using UnityEngine; + +#endregion namespace Units.Enemy.State_Machines.State { public class SearchPositionForPatrol : IState { - #region Variables - - private readonly Transform _thisTransform; - private readonly Transform _targetTransform; - - #endregion - - #region Constructors - public SearchPositionForPatrol(Transform thisTransform, out Transform targetTransform) { _thisTransform = thisTransform; - _targetTransform = new GameObject().transform; targetTransform = _targetTransform; } - - #endregion - - #region Methods + private readonly Transform _targetTransform; + private readonly Transform _thisTransform; public void OnEnter() { @@ -38,17 +30,11 @@ public void OnExit() { } - #endregion - - #region Methods Other - private static Vector3 NewPositionPatrol(Transform transform) { return transform.position + - transform.forward * (Random.Range(10f, 20f) * Random.Range(-1, 2)) + - new Vector3(Random.Range(7.5f, 15f) * Random.Range(-1, 2), 0, 0); + transform.forward * (Random.Range(15f, 30f) * Random.Range(-1, 2)) + + new Vector3(Random.Range(10f, 25f) * Random.Range(-1, 2), 0, 0); } - - #endregion } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/StateMachine.cs b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/StateMachine.cs index 7874835..5db63e7 100644 --- a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/StateMachine.cs +++ b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/StateMachine.cs @@ -1,48 +1,32 @@ -using System; +#region + +using System; using System.Collections.Generic; -using UnityEngine; + +#endregion namespace Units.Enemy.State_Machines { public class StateMachine { - /// - /// Текущее состояние - /// - private IState _currentState; + private readonly static List EmptyTransitions = new List(0); - /// - /// Словарь всех переходов - /// - private Dictionary> _transitions = new(); + private readonly List _anyTransitions = new List(); - /// - /// Список переходов из текущего состояния - /// - private List _currentTransitions = new(); + private readonly Dictionary> _transitions = new Dictionary>(); - /// - /// Список переховов из любого состояния - /// - private List _anyTransitions = new(); + private IState _currentState; - private static readonly List EmptyTransitions = new(0); + private List _currentTransitions = new List(); - /// - /// Обновление каждый кадр (осуществление перехода если возможно) - /// public void Tick() { var transition = GetTransition(); if (transition != null) SetState(transition.To); - + _currentState?.Tick(); } - /// - /// Установить состояние - /// - /// Конечное состояние public void SetState(IState state) { if (state == _currentState) @@ -50,19 +34,12 @@ public void SetState(IState state) _currentState?.OnExit(); _currentState = state; - _transitions.TryGetValue(_currentState.GetType(), out _currentTransitions); // переход - if (_currentTransitions == null) - _currentTransitions = EmptyTransitions; + _transitions.TryGetValue(_currentState.GetType(), out _currentTransitions); + _currentTransitions ??= EmptyTransitions; _currentState.OnEnter(); } - /// - /// Добавить переход - /// - /// Начальное состояние - /// Конечное состояние - /// Условие перехода public void AddTransition(IState to, IState from, Func predicate) { if (_transitions.TryGetValue(from.GetType(), out var transitions) == false) @@ -74,46 +51,26 @@ public void AddTransition(IState to, IState from, Func predicate) transitions.Add(new Transition(to, predicate)); } - /// - /// Добавить переход с любого состояния - /// - /// Конечное состояние - /// Условие перехода public void AddAnyTransition(IState state, Func predicate) { _anyTransitions.Add(new Transition(state, predicate)); } - /// - /// Переход к состоянию - /// - private class Transition - { - public Func Condition { get; } - public IState To { get; } - - public Transition(IState to, Func condition) - { - To = to; - Condition = condition; - } - } - - /// - /// Перебираются переходы, проверяются на удовлетворённость условия - /// - /// Переход с удовлетворённым условием private Transition GetTransition() { foreach (var transition in _anyTransitions) + { if (transition.Condition()) return transition; + } foreach (var transition in _currentTransitions) + { if (transition.Condition()) return transition; + } return null; } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/Transition.cs b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/Transition.cs new file mode 100644 index 0000000..65a9dd0 --- /dev/null +++ b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/Transition.cs @@ -0,0 +1,15 @@ +using System; +namespace Units.Enemy.State_Machines +{ + public class Transition + { + public Transition(IState to, Func condition) + { + To = to; + Condition = condition; + } + + public Func Condition { get; } + public IState To { get; } + } +} diff --git a/Assets/Internal assets/Scripts/Units/Enemy/State Machines/Transition.cs.meta b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/Transition.cs.meta new file mode 100644 index 0000000..bf324c8 --- /dev/null +++ b/Assets/Internal assets/Scripts/Units/Enemy/State Machines/Transition.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1e09210e33d342dfbdfaad712102661d +timeCreated: 1685179007 \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/Units/Player/EnemyDetector.cs b/Assets/Internal assets/Scripts/Units/Player/EnemyDetector.cs index 393eb66..26c17c3 100644 --- a/Assets/Internal assets/Scripts/Units/Player/EnemyDetector.cs +++ b/Assets/Internal assets/Scripts/Units/Player/EnemyDetector.cs @@ -1,20 +1,27 @@ -using UnityEngine; +#region + +using UnityEngine; + +#endregion namespace Units.Player { public class EnemyDetector : MonoBehaviour { private void OnTriggerEnter(Collider other) - // private void OnTriggerStay(Collider other) { if (other.TryGetComponent(out var enemy)) + { enemy.PlayerInRange = true; + } } private void OnTriggerExit(Collider other) { if (other.TryGetComponent(out var enemy)) + { enemy.PlayerInRange = false; + } } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Units/Player/FireInHand.cs b/Assets/Internal assets/Scripts/Units/Player/FireInHand.cs index b534847..71b708a 100644 --- a/Assets/Internal assets/Scripts/Units/Player/FireInHand.cs +++ b/Assets/Internal assets/Scripts/Units/Player/FireInHand.cs @@ -1,4 +1,8 @@ -using UnityEngine; +#region + +using UnityEngine; + +#endregion namespace Units.Player { @@ -6,7 +10,6 @@ public class FireInHand : MonoBehaviour { private GameObject _fire; private Transform _transform; - private bool _state; private void Start() { @@ -16,9 +19,10 @@ private void Start() private void Update() { - var rotation = _transform.rotation.eulerAngles; - _state = rotation.z is > 75 and < 135 && rotation.x is > 330 or < 30; - _fire.SetActive(_state); + var rotation = _transform.rotation; + var rotationEulerAngles = rotation.eulerAngles; + var state = rotationEulerAngles.z is > 75 and < 135 && rotationEulerAngles.x is > 330 or < 30; + _fire.SetActive(state); } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Units/Player/HandAnimatorController.cs b/Assets/Internal assets/Scripts/Units/Player/HandAnimatorController.cs new file mode 100644 index 0000000..77d5be6 --- /dev/null +++ b/Assets/Internal assets/Scripts/Units/Player/HandAnimatorController.cs @@ -0,0 +1,29 @@ +#region + +using UnityEngine; +using UnityEngine.InputSystem; + +#endregion + +namespace Units.Player +{ + public class HandAnimatorController : MonoBehaviour + { + private readonly static int Grip = Animator.StringToHash("Grip"); + private readonly static int Trigger = Animator.StringToHash("Trigger"); + [SerializeField] private InputActionProperty grabAction; + [SerializeField] private InputActionProperty activateAction; + private Animator _animator; + + private void Awake() + { + _animator = GetComponent(); + } + + private void Update() + { + _animator.SetFloat(Grip, grabAction.action.ReadValue()); + _animator.SetFloat(Trigger, activateAction.action.ReadValue()); + } + } +} diff --git a/Assets/Internal assets/Scripts/XR/Hand/HandAnimatorController.cs.meta b/Assets/Internal assets/Scripts/Units/Player/HandAnimatorController.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/XR/Hand/HandAnimatorController.cs.meta rename to Assets/Internal assets/Scripts/Units/Player/HandAnimatorController.cs.meta diff --git a/Assets/Internal assets/Scripts/Units/Player/Player.cs b/Assets/Internal assets/Scripts/Units/Player/Player.cs index 4538683..2996fbd 100644 --- a/Assets/Internal assets/Scripts/Units/Player/Player.cs +++ b/Assets/Internal assets/Scripts/Units/Player/Player.cs @@ -1,24 +1,37 @@ +#region + using Data.Dynamic; -using Data.Static; -using Services.PersistentProgress; +using Services.Watchers.PersistentProgressWatcher; using Skill; using UnityEngine; using UnityEngine.Events; +#endregion + namespace Units.Player { - public class Player : MonoBehaviour, IProgressLoadable + public class Player : MonoBehaviour, IProgressLoadableWatcher { - private PlayerStaticDefaultData _defaultData; - private UnityAction _playerDead; - private float _healthPoint; - private float _protection; + private float _healthPoints; private bool _isDead; + private UnityAction _playerDead; + private float _protectionPoints; + + public void LoadProgress(Progress progress) + { + _healthPoints = + (_healthPoints + progress.skillsLevel.skills[SkillType.HealthCount]) * + (1 + progress.skillsLevel.skills[SkillType.HealthPercent] / 100f); + + _protectionPoints = + (_protectionPoints + progress.skillsLevel.skills[SkillType.ProtectionCount]) * + (1 + progress.skillsLevel.skills[SkillType.ProtectionPercent] / 100f); + } - public void SetUp(UnityAction playerDead, PlayerStaticDefaultData playerStaticDefaultData) + public void SetUp(float health, float protection) { - _playerDead = playerDead; - _defaultData = playerStaticDefaultData; + _healthPoints = health; + _protectionPoints = protection; var triggerGetHit = new GameObject { @@ -27,33 +40,27 @@ public void SetUp(UnityAction playerDead, PlayerStaticDefaultData playerStaticDe { parent = transform, localPosition = Vector3.zero - }, + } }; triggerGetHit.AddComponent().SetUp(TakeDamage); } - private void TakeDamage(float healthLoss) + public void RegisterOnPlayerDead(UnityAction playerDead) { - if (healthLoss - _protection < 0) return; + _playerDead += playerDead; + } + + private void TakeDamage(float damage) + { + if (_protectionPoints > damage) return; - _healthPoint -= (healthLoss - _protection); - if (_healthPoint <= 0 && !_isDead) + _healthPoints -= damage - _protectionPoints; + if (_healthPoints <= 0 && !_isDead) { _playerDead?.Invoke(); _isDead = true; } } - - public void LoadProgress(Progress progress) - { - _healthPoint = - (_defaultData.MaxHealthPoints + progress.skillsLevel.Skills[SkillType.HEALTH_Count]) * - (1 + progress.skillsLevel.Skills[SkillType.HEALTH_Percent] / 100f); - - _protection = - (_defaultData.ProtectionPoints + progress.skillsLevel.Skills[SkillType.PROTECTION_Count]) * - (1 + progress.skillsLevel.Skills[SkillType.PROTECTION_Percent] / 100f); - } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/Units/Player/PlayerGetHit.cs b/Assets/Internal assets/Scripts/Units/Player/PlayerGetHit.cs index 6734873..e0f09e5 100644 --- a/Assets/Internal assets/Scripts/Units/Player/PlayerGetHit.cs +++ b/Assets/Internal assets/Scripts/Units/Player/PlayerGetHit.cs @@ -1,13 +1,23 @@ -using Units.Enemy; +#region + +using Units.Enemy; using UnityEngine; using UnityEngine.Events; +#endregion + namespace Units.Player { public class PlayerGetHit : MonoBehaviour { private UnityAction _onGetHit; + private void OnTriggerEnter(Collider other) + { + if (other.TryGetComponent(out var enemyDamage) && enemyDamage.IsDamage) + _onGetHit?.Invoke(enemyDamage.Damage); + } + public void SetUp(UnityAction onGetHit) { _onGetHit = onGetHit; @@ -18,11 +28,5 @@ public void SetUp(UnityAction onGetHit) targetCollider.radius = 0.4f; targetCollider.height = 1.8f; } - - private void OnTriggerEnter(Collider other) - { - if (other.TryGetComponent(out var enemyDamage) && enemyDamage.IsDamage) - _onGetHit?.Invoke(enemyDamage.Damage); - } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/XR/GazeInteractorTrigger.cs b/Assets/Internal assets/Scripts/XR/GazeInteractTrigger.cs similarity index 71% rename from Assets/Internal assets/Scripts/XR/GazeInteractorTrigger.cs rename to Assets/Internal assets/Scripts/XR/GazeInteractTrigger.cs index 746ebbe..2b9b0f3 100644 --- a/Assets/Internal assets/Scripts/XR/GazeInteractorTrigger.cs +++ b/Assets/Internal assets/Scripts/XR/GazeInteractTrigger.cs @@ -1,21 +1,15 @@ -using System; +#region + using UnityEngine; using UnityEngine.Events; using UnityEngine.XR.Interaction.Toolkit; +#endregion + namespace XR { - public class GazeInteractorTrigger : MonoBehaviour + public class GazeInteractTrigger : MonoBehaviour { - // [SerializeField] private XRSimpleInteractable xrSimpleInteractable; - // [SerializeField] private GameObject menu; - // - // private void Awake() - // { - // xrSimpleInteractable.hoverEntered.AddListener(arg0 => menu.SetActive(true)); - // xrSimpleInteractable.hoverExited.AddListener(arg0 => menu.SetActive(false)); - // } - public void AddHoverEntered(UnityAction unityAction) { if (TryGetComponent(out var xrSimpleInteractable)) @@ -40,4 +34,4 @@ public void RemoveHoverExited(UnityAction unityAction) xrSimpleInteractable.hoverExited.RemoveListener(unityAction); } } -} \ No newline at end of file +} diff --git a/Assets/Internal assets/Scripts/XR/GazeInteractorTrigger.cs.meta b/Assets/Internal assets/Scripts/XR/GazeInteractTrigger.cs.meta similarity index 100% rename from Assets/Internal assets/Scripts/XR/GazeInteractorTrigger.cs.meta rename to Assets/Internal assets/Scripts/XR/GazeInteractTrigger.cs.meta diff --git a/Assets/Internal assets/Scripts/XR/Hand.meta b/Assets/Internal assets/Scripts/XR/Hand.meta deleted file mode 100644 index 6b59ad5..0000000 --- a/Assets/Internal assets/Scripts/XR/Hand.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: d9df8fa3ea744150b5f3242de9073a4a -timeCreated: 1681937738 \ No newline at end of file diff --git a/Assets/Internal assets/Scripts/XR/Hand/HandAnimatorController.cs b/Assets/Internal assets/Scripts/XR/Hand/HandAnimatorController.cs deleted file mode 100644 index 8722e18..0000000 --- a/Assets/Internal assets/Scripts/XR/Hand/HandAnimatorController.cs +++ /dev/null @@ -1,26 +0,0 @@ -using UnityEngine; -using UnityEngine.InputSystem; - -namespace XR.Hand -{ - public class HandAnimatorController : MonoBehaviour - { - [SerializeField] private InputActionProperty _grabAction; - [SerializeField] private InputActionProperty _activateAction; - private Animator _animator; - - private static readonly int GRIP = Animator.StringToHash("Grip"); - private static readonly int TRIGGER = Animator.StringToHash("Trigger"); - - private void Awake() - { - _animator = GetComponent(); - } - - private void Update() - { - _animator.SetFloat(GRIP, _grabAction.action.ReadValue()); - _animator.SetFloat(TRIGGER, _activateAction.action.ReadValue()); - } - } -} \ No newline at end of file diff --git a/Assets/Resources/ProjectContext.prefab b/Assets/Resources/ProjectContext.prefab index 25013ec..46334b3 100644 --- a/Assets/Resources/ProjectContext.prefab +++ b/Assets/Resources/ProjectContext.prefab @@ -141,6 +141,7 @@ MonoBehaviour: - {fileID: 8573405490719690380} - {fileID: 5814523664234508488} _installerPrefabs: [] + _findSiblingMonoInstallers: 0 _parentNewObjectsUnderContext: 0 _editorReflectionBakingCoverageMode: 0 _buildsReflectionBakingCoverageMode: 0 @@ -149,6 +150,7 @@ MonoBehaviour: _displayWarningWhenResolvingDuringInstall: 1 _validationRootResolveMethod: 0 _validationErrorResponse: 0 + _constructorChoiceStrategy: 0 _signalSettings: _defaultSyncMode: 0 _missingHandlerDefaultResponse: 2 @@ -198,10 +200,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: cd4fb24278df4da4e8502c359ddeccdf, type: 3} m_Name: m_EditorClassIdentifier: - _mainLocationSettings: {fileID: 11400000, guid: 6057a08ead4bb2a45bbac7768551c102, + playerStaticDefaultData: {fileID: 11400000, guid: 33f51b640f5e3444ca77e568a564fecc, type: 2} - _mainMenuSettings: {fileID: 11400000, guid: 2ab1f53f56cf0b14ba91c39059ee7658, type: 2} - _dungeonRoomSettings: {fileID: 11400000, guid: 9a93bb9829ae7a94ea351c65852147a5, + mainLocationSettings: {fileID: 11400000, guid: 6057a08ead4bb2a45bbac7768551c102, type: 2} - _playerStaticDefaultData: {fileID: 11400000, guid: 33f51b640f5e3444ca77e568a564fecc, + dungeonRoomSettings: {fileID: 11400000, guid: 9a93bb9829ae7a94ea351c65852147a5, type: 2} + mainMenuSettings: {fileID: 11400000, guid: 2ab1f53f56cf0b14ba91c39059ee7658, type: 2} diff --git a/Assets/Samples/XR Interaction Toolkit/2.3.2/Starter Assets/XRI Default Input Actions.cs b/Assets/Samples/XR Interaction Toolkit/2.3.2/Starter Assets/XRI Default Input Actions.cs new file mode 100644 index 0000000..f5fd34f --- /dev/null +++ b/Assets/Samples/XR Interaction Toolkit/2.3.2/Starter Assets/XRI Default Input Actions.cs @@ -0,0 +1,3310 @@ +//------------------------------------------------------------------------------ +// +// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator +// version 1.5.1 +// from Assets/Samples/XR Interaction Toolkit/2.3.2/Starter Assets/XRI Default Input Actions.inputactions +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine.InputSystem; +using UnityEngine.InputSystem.Utilities; + +public partial class @XRIDefaultInputActions: IInputActionCollection2, IDisposable +{ + public InputActionAsset asset { get; } + public @XRIDefaultInputActions() + { + asset = InputActionAsset.FromJson(@"{ + ""name"": ""XRI Default Input Actions"", + ""maps"": [ + { + ""name"": ""XRI Head"", + ""id"": ""09ff3ccc-21b4-4346-a3a2-7c978b5af892"", + ""actions"": [ + { + ""name"": ""Position"", + ""type"": ""Value"", + ""id"": ""1a9029f8-7a46-46b9-9eff-e9ae8365f611"", + ""expectedControlType"": ""Vector3"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Rotation"", + ""type"": ""Value"", + ""id"": ""aed87fe6-2b01-4dd2-a8fa-195578fd8158"", + ""expectedControlType"": ""Quaternion"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Is Tracked"", + ""type"": ""Button"", + ""id"": ""6bb4e248-e42b-47c3-b66c-79566508ca74"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Tracking State"", + ""type"": ""Value"", + ""id"": ""08654a17-c094-4bbd-8946-415ae4ce2406"", + ""expectedControlType"": ""Integer"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Eye Gaze Position"", + ""type"": ""Value"", + ""id"": ""dde820a2-0462-4756-be47-630b5b56c115"", + ""expectedControlType"": ""Vector3"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Eye Gaze Rotation"", + ""type"": ""Value"", + ""id"": ""8ac32629-4403-4068-aae5-2cd243e230c2"", + ""expectedControlType"": ""Quaternion"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Eye Gaze Tracking State"", + ""type"": ""Value"", + ""id"": ""73053154-2fbc-4d78-9cac-000282b64f79"", + ""expectedControlType"": ""Integer"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + } + ], + ""bindings"": [ + { + ""name"": """", + ""id"": ""cff1f981-6e1f-4e2c-a90c-715a0ea2e80e"", + ""path"": ""/centerEyePosition"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Position"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""e2017383-a3f6-4c46-acb1-012b8eece9cc"", + ""path"": ""/centerEyeRotation"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Rotation"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": ""Quaternion Fallback"", + ""id"": ""fd9bd2d1-a464-4069-bf55-7f7a3cdb5a96"", + ""path"": ""QuaternionFallback"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Eye Gaze Rotation"", + ""isComposite"": true, + ""isPartOfComposite"": false + }, + { + ""name"": ""first"", + ""id"": ""ef9a3bee-0af0-4688-81d3-49c2d9be0def"", + ""path"": ""/pose/rotation"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Eye Gaze Rotation"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""second"", + ""id"": ""aaf13e7c-a814-4c6e-9349-042da0cb27e9"", + ""path"": ""/centerEyeRotation"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Eye Gaze Rotation"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""third"", + ""id"": ""3e829ba4-2fad-45ea-8114-7670f0e484be"", + ""path"": """", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Eye Gaze Rotation"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""Vector 3 Fallback"", + ""id"": ""0cf0b092-6006-474b-9cf5-dc4039450f39"", + ""path"": ""Vector3Fallback"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Eye Gaze Position"", + ""isComposite"": true, + ""isPartOfComposite"": false + }, + { + ""name"": ""first"", + ""id"": ""872dc9a3-bab9-4b3f-9f84-8d12371f1f67"", + ""path"": ""/pose/position"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Eye Gaze Position"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""second"", + ""id"": ""2f870b88-8825-4a62-b02e-b5a523723446"", + ""path"": ""/centerEyePosition"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Eye Gaze Position"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""third"", + ""id"": ""eaececb1-b4a3-4b47-83c2-60562a364085"", + ""path"": """", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Eye Gaze Position"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""Integer Fallback"", + ""id"": ""1a6685cf-ae82-4f22-a967-75610a8e71ed"", + ""path"": ""IntegerFallback"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Eye Gaze Tracking State"", + ""isComposite"": true, + ""isPartOfComposite"": false + }, + { + ""name"": ""first"", + ""id"": ""0dc9d652-871d-4ba5-94a1-50cf8218009a"", + ""path"": ""/pose/trackingState"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Eye Gaze Tracking State"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""second"", + ""id"": ""9bbd034f-9254-4dd5-9df7-d84f53b0bc8d"", + ""path"": ""/trackingState"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Eye Gaze Tracking State"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""third"", + ""id"": ""d5e35a2f-03c4-432a-8e5e-d200278bf0a9"", + ""path"": """", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Eye Gaze Tracking State"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": """", + ""id"": ""43a7b1a1-e99a-4346-a058-5b68c535729d"", + ""path"": ""/trackingState"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Tracking State"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""15eff92f-dac7-4e6e-986c-08b3f1e73fac"", + ""path"": ""/isTracked"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Is Tracked"", + ""isComposite"": false, + ""isPartOfComposite"": false + } + ] + }, + { + ""name"": ""XRI LeftHand"", + ""id"": ""5fe596f9-1b7b-49b7-80a7-3b5195caf74d"", + ""actions"": [ + { + ""name"": ""Position"", + ""type"": ""Value"", + ""id"": ""83a7af0b-87e3-42c3-a909-95fbf8091e4f"", + ""expectedControlType"": ""Vector3"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Rotation"", + ""type"": ""Value"", + ""id"": ""cb6b7130-2bac-4ef7-abe4-6991ae7d419d"", + ""expectedControlType"": ""Quaternion"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Is Tracked"", + ""type"": ""Button"", + ""id"": ""82eb6741-beef-48d3-83ab-a957dc1caa1e"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Tracking State"", + ""type"": ""Value"", + ""id"": ""d20fc51c-7916-43a7-8b03-706049966aea"", + ""expectedControlType"": ""Integer"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Haptic Device"", + ""type"": ""PassThrough"", + ""id"": ""664a62b0-e178-421d-b3f8-014eec01591d"", + ""expectedControlType"": """", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Aim Position"", + ""type"": ""Value"", + ""id"": ""c73a0160-3d9b-4dde-96f9-6a390e68778c"", + ""expectedControlType"": ""Vector3"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Aim Rotation"", + ""type"": ""Value"", + ""id"": ""f208faac-e869-4280-ac9c-9b3d0ab819bb"", + ""expectedControlType"": ""Quaternion"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Aim Flags"", + ""type"": ""Value"", + ""id"": ""f98e71db-49b4-4882-8991-a0e386733e87"", + ""expectedControlType"": ""Integer"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Pinch Position"", + ""type"": ""Value"", + ""id"": ""cac52a91-5970-4ad2-8c86-a8c0e91a1837"", + ""expectedControlType"": ""Vector3"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Poke Position"", + ""type"": ""Value"", + ""id"": ""4c557d81-3795-4355-a83e-6f886221d011"", + ""expectedControlType"": ""Vector3"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Poke Rotation"", + ""type"": ""Value"", + ""id"": ""0565b7f7-f841-4395-98df-a77f4dd6d9c9"", + ""expectedControlType"": ""Quaternion"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + } + ], + ""bindings"": [ + { + ""name"": ""Quaternion Fallback"", + ""id"": ""61466a56-4ee4-47b1-aa6a-4806de1de5f2"", + ""path"": ""QuaternionFallback"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Rotation"", + ""isComposite"": true, + ""isPartOfComposite"": false + }, + { + ""name"": ""first"", + ""id"": ""afdcfbff-e241-4fdd-a6d1-23b0bf273360"", + ""path"": ""{LeftHand}/pointerRotation"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Rotation"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""second"", + ""id"": ""ed03d944-4c09-4c38-8b68-5c844e18ca7c"", + ""path"": ""{LeftHand}/deviceRotation"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Rotation"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""third"", + ""id"": ""c98fc8c8-7fc6-4909-89b6-c5b7568e7275"", + ""path"": ""{LeftHand}/deviceRotation"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Rotation"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""Vector 3 Fallback"", + ""id"": ""14aeff85-d719-43ff-a124-b1cd7ca8686d"", + ""path"": ""Vector3Fallback"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Position"", + ""isComposite"": true, + ""isPartOfComposite"": false + }, + { + ""name"": ""first"", + ""id"": ""abf752ec-feee-4d51-b530-f0870f48acc9"", + ""path"": ""{LeftHand}/pointerPosition"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Position"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""second"", + ""id"": ""6580b669-0651-401c-9779-85ef22689130"", + ""path"": ""{LeftHand}/devicePosition"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Position"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""third"", + ""id"": ""ae101942-9eaa-4c53-a388-cafc3fd89bdf"", + ""path"": ""{LeftHand}/devicePosition"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Position"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": """", + ""id"": ""acdf9550-5529-4ff7-8558-73ecdf0d75bd"", + ""path"": ""{LeftHand}/*"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Haptic Device"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""97a0351f-659b-482a-8fa0-19015ccd055e"", + ""path"": ""{LeftHand}/trackingState"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Tracking State"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""34454fec-7610-497a-b1a5-d3d5f01b312c"", + ""path"": ""{LeftHand}/trackingState"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Tracking State"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""28df8d2f-b563-4377-bd11-6c8932ee591c"", + ""path"": ""{LeftHand}/devicePosition"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Aim Position"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""2623b909-75bd-40da-97bd-ae1ecfb0a89b"", + ""path"": ""{LeftHand}/deviceRotation"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Aim Rotation"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""f7a37505-52bd-4a96-8f88-c761a62a71e7"", + ""path"": ""{LeftHand}/pinchPosition"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Pinch Position"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""017a01a2-6e1a-4b39-9b5e-e115d5d2dd6a"", + ""path"": ""{LeftHand}/pokePosition"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Poke Position"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""3ab4651e-837c-4352-9055-6671517f1917"", + ""path"": ""{LeftHand}/pokeRotation"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Poke Rotation"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""f1de7b81-80d1-4207-8f19-4fb96a537bb3"", + ""path"": ""{LeftHand}/isTracked"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Is Tracked"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""d9f33fe3-b3bf-48c1-a8bc-dd6a4ddfba94"", + ""path"": ""{LeftHand}/isTracked"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Is Tracked"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""286f44f6-74a5-4f92-8468-42445c7a3cb8"", + ""path"": ""{LeftHand}/aimFlags"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Aim Flags"", + ""isComposite"": false, + ""isPartOfComposite"": false + } + ] + }, + { + ""name"": ""XRI LeftHand Interaction"", + ""id"": ""7a5e7537-cc30-4eb1-a544-6946baa8f3eb"", + ""actions"": [ + { + ""name"": ""Select"", + ""type"": ""Button"", + ""id"": ""33754c03-48ec-46ef-9bc6-22ed6bfdd8e8"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Select Value"", + ""type"": ""Value"", + ""id"": ""e6005f29-e4c1-4f3b-8bf7-3a28bab5ca9c"", + ""expectedControlType"": ""Axis"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Activate"", + ""type"": ""Button"", + ""id"": ""0c0991c5-d329-4afc-8892-1076b440477c"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Activate Value"", + ""type"": ""Value"", + ""id"": ""0c3d0ec9-85a1-45b3-839b-1ca43f859ecd"", + ""expectedControlType"": ""Axis"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""UI Press"", + ""type"": ""Button"", + ""id"": ""7e1eced7-c774-4fe5-be8f-d8711f646d9e"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""UI Press Value"", + ""type"": ""Value"", + ""id"": ""f241c1aa-1050-4338-b2bf-a4a47776693d"", + ""expectedControlType"": ""Axis"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Rotate Anchor"", + ""type"": ""Value"", + ""id"": ""21b75b25-12ad-410f-b4f8-a7745b7aca27"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Translate Anchor"", + ""type"": ""Value"", + ""id"": ""bfa204c7-3c92-4193-bad1-39eb71920042"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + } + ], + ""bindings"": [ + { + ""name"": """", + ""id"": ""71a4d23f-3e9a-4513-923b-ba388c5e84bf"", + ""path"": ""{LeftHand}/gripPressed"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Select"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""73325635-d9e5-481a-9279-ae7be089422d"", + ""path"": ""{LeftHand}/indexPressed"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Select"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""49a23327-a116-48c0-8af9-0d2c50c15a88"", + ""path"": ""{LeftHand}/grip"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Select Value"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""304be843-4b23-45d9-89fa-005ac163d9b9"", + ""path"": ""{LeftHand}/pinchStrengthIndex"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Select Value"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""487f4f2e-9e9b-49aa-b0f2-4037a24624f5"", + ""path"": ""{LeftHand}/triggerPressed"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Activate"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""3b8b1b59-2fdc-4998-8259-50341075d9a2"", + ""path"": ""{LeftHand}/trigger"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Activate Value"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""b34c79c1-ab5e-4851-87ac-abc43705eae0"", + ""path"": ""{LeftHand}/triggerPressed"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""UI Press"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""a5bf6a12-a026-46d1-a793-7252c49aaf66"", + ""path"": ""{LeftHand}/indexPressed"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""UI Press"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""71d94579-1bf4-4034-ab9e-e7166842128f"", + ""path"": ""{LeftHand}/trigger"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""UI Press Value"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""d250c9be-4bf2-4b5c-8962-4fcf5d53bdb3"", + ""path"": ""{LeftHand}/pinchStrengthIndex"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""UI Press Value"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""8ed313a6-c966-4669-8a62-4bb2319d485b"", + ""path"": ""{LeftHand}/Primary2DAxis"", + ""interactions"": """", + ""processors"": ""ScaleVector2(y=0),StickDeadzone"", + ""groups"": ""Generic XR Controller"", + ""action"": ""Rotate Anchor"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""370f21e3-a80b-4b07-990b-299c2da0929a"", + ""path"": ""{LeftHand}/Primary2DAxis"", + ""interactions"": """", + ""processors"": ""ScaleVector2(x=0),StickDeadzone"", + ""groups"": ""Generic XR Controller"", + ""action"": ""Translate Anchor"", + ""isComposite"": false, + ""isPartOfComposite"": false + } + ] + }, + { + ""name"": ""XRI LeftHand Locomotion"", + ""id"": ""22336389-9fb1-4c2c-8635-0ed30db0d29e"", + ""actions"": [ + { + ""name"": ""Teleport Select"", + ""type"": ""Value"", + ""id"": ""cbeaf823-3b69-4004-8ec8-13ea2ca3fc31"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Teleport Mode Activate"", + ""type"": ""Value"", + ""id"": ""a21db72c-4843-4839-b4d0-3ce8d287cb86"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Teleport Mode Cancel"", + ""type"": ""Button"", + ""id"": ""89ce8348-6001-41a3-85b9-f8f2e2dcad7c"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Teleport Direction"", + ""type"": ""Value"", + ""id"": ""93bd97c5-fd23-4853-8045-1b12324aa24e"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Turn"", + ""type"": ""Value"", + ""id"": ""9164e093-ebd4-4923-af32-1b52f31c2d66"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Move"", + ""type"": ""Value"", + ""id"": ""9693e25f-8a4f-4aed-842f-3961243c69a1"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Grab Move"", + ""type"": ""Button"", + ""id"": ""c5a6d766-d487-42ae-b293-da4749469e18"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Snap Turn"", + ""type"": ""Value"", + ""id"": ""8c14e969-a054-4f12-840c-4e0bd85173d9"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + } + ], + ""bindings"": [ + { + ""name"": """", + ""id"": ""95fa1419-ca7b-4c8a-8d15-7d46e58d82e3"", + ""path"": ""{LeftHand}/Primary2DAxis"", + ""interactions"": ""Sector(directions=-1,sweepBehavior=3)"", + ""processors"": """", + ""groups"": ""Noncontinuous Move"", + ""action"": ""Teleport Select"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""8da6ed3a-f621-49fe-8c76-1f6b7d7754d6"", + ""path"": ""{LeftHand}/Primary2DAxis"", + ""interactions"": ""Sector(directions=1)"", + ""processors"": """", + ""groups"": ""Noncontinuous Move"", + ""action"": ""Teleport Mode Activate"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""b8aebee7-fa03-43d4-bfb7-77a3f87452cc"", + ""path"": ""{LeftHand}/gripPressed"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Teleport Mode Cancel"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""99cb7ad1-51ec-4611-af68-92a85f2c17d6"", + ""path"": ""{LeftHand}/Primary2DAxis"", + ""interactions"": ""Sector(directions=12,sweepBehavior=1),Sector(directions=2,sweepBehavior=2)"", + ""processors"": """", + ""groups"": ""Noncontinuous Move"", + ""action"": ""Turn"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""8e383b1a-270f-4c20-819b-89a59cffb498"", + ""path"": ""{LeftHand}/Primary2DAxis"", + ""interactions"": """", + ""processors"": ""StickDeadzone"", + ""groups"": ""Continuous Move"", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""5fe0ed53-b4d3-4cd8-b567-397a7d1e1c6a"", + ""path"": ""{LeftHand}/primary2DAxis"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Noncontinuous Move"", + ""action"": ""Teleport Direction"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""9e2fa814-8cbd-4c65-a60d-a1503f30ffd8"", + ""path"": ""{LeftHand}/gripPressed"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Grab Move"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""a46b49d0-0754-4dac-a9a5-a822e10751f2"", + ""path"": ""{LeftHand}/Primary2DAxis"", + ""interactions"": ""Sector(directions=12,sweepBehavior=1),Sector(directions=2,sweepBehavior=2)"", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Snap Turn"", + ""isComposite"": false, + ""isPartOfComposite"": false + } + ] + }, + { + ""name"": ""XRI RightHand"", + ""id"": ""7960f8ef-2bf3-4281-aecc-4c03809d6c8c"", + ""actions"": [ + { + ""name"": ""Position"", + ""type"": ""Value"", + ""id"": ""c4990d70-7b8a-4ce1-b03c-da86716b8352"", + ""expectedControlType"": ""Vector3"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Rotation"", + ""type"": ""Value"", + ""id"": ""ee6bf5bf-bb0a-4a50-8327-cb654b19e298"", + ""expectedControlType"": ""Quaternion"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Is Tracked"", + ""type"": ""Button"", + ""id"": ""a705ffe4-b2c8-4b78-847f-25257d4e30af"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Tracking State"", + ""type"": ""Value"", + ""id"": ""167ea203-5bfb-4d74-bde9-8026b7483102"", + ""expectedControlType"": ""Integer"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Haptic Device"", + ""type"": ""PassThrough"", + ""id"": ""57b2a1b4-3290-46d6-ac07-4854ee8f91b1"", + ""expectedControlType"": """", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Aim Position"", + ""type"": ""Value"", + ""id"": ""daf49d5d-4ba8-4bf7-9010-e7cae2096907"", + ""expectedControlType"": ""Vector3"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Aim Rotation"", + ""type"": ""Value"", + ""id"": ""148c182f-63ef-4709-8057-f6ea8070cb5c"", + ""expectedControlType"": ""Quaternion"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Aim Flags"", + ""type"": ""Value"", + ""id"": ""93a75a21-033e-440c-9954-ff264afb2db9"", + ""expectedControlType"": ""Integer"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Pinch Position"", + ""type"": ""Value"", + ""id"": ""7a2e5dcd-3e49-4622-90ea-6607994f2be0"", + ""expectedControlType"": ""Vector3"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Poke Position"", + ""type"": ""Value"", + ""id"": ""496d56bd-afd7-495b-a326-16e4ef742bc1"", + ""expectedControlType"": ""Vector3"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Poke Rotation"", + ""type"": ""Value"", + ""id"": ""3767652c-5427-421b-8f8d-660106453cb1"", + ""expectedControlType"": ""Quaternion"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + } + ], + ""bindings"": [ + { + ""name"": ""Quaternion Fallback"", + ""id"": ""84e51e1c-1b95-4f3e-a61f-29da6c1f0816"", + ""path"": ""QuaternionFallback"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Rotation"", + ""isComposite"": true, + ""isPartOfComposite"": false + }, + { + ""name"": ""first"", + ""id"": ""3722d501-eb80-4f61-9361-08a5ea7a1394"", + ""path"": ""{RightHand}/pointerRotation"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Rotation"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""second"", + ""id"": ""2e6ad191-d5aa-4919-aac6-295c83387a72"", + ""path"": ""{RightHand}/deviceRotation"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Rotation"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""third"", + ""id"": ""b9ecb60d-341e-47cf-b50a-41d5815af8b0"", + ""path"": ""{RightHand}/deviceRotation"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Rotation"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""Vector 3 Fallback"", + ""id"": ""74e968f1-ad08-4a82-a68d-764517faecef"", + ""path"": ""Vector3Fallback"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Position"", + ""isComposite"": true, + ""isPartOfComposite"": false + }, + { + ""name"": ""first"", + ""id"": ""9717e367-64a4-440a-9974-1e641d753eb2"", + ""path"": ""{RightHand}/pointerPosition"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Position"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""second"", + ""id"": ""0794a41d-29ef-48ec-a452-6b7de29b52fa"", + ""path"": ""{RightHand}/devicePosition"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Position"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""third"", + ""id"": ""3ef0a781-60c5-48bc-a584-f95553f8ae0a"", + ""path"": ""{RightHand}/devicePosition"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Position"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": """", + ""id"": ""6011e1e6-b2dd-4cb1-8da5-29b03868f2c5"", + ""path"": ""{RightHand}/*"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Haptic Device"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""03ccbaec-eeca-4fc4-8281-ee1758b4eb9b"", + ""path"": ""{RightHand}/trackingState"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Tracking State"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""714d1173-f908-4bca-951c-4adb4eb7b4c5"", + ""path"": ""{RightHand}/trackingState"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Tracking State"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""dd822fc8-c655-4a4d-87d0-9575760b6dca"", + ""path"": ""{RightHand}/devicePosition"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Aim Position"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""2bb1158a-2d78-446b-9351-6f9b3f1364cb"", + ""path"": ""{RightHand}/deviceRotation"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Aim Rotation"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""21413a94-0048-4112-b433-a770f183f592"", + ""path"": ""{RightHand}/pinchPosition"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Pinch Position"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""5e847fad-7431-4e48-883a-d489fca4ce0d"", + ""path"": ""{RightHand}/pokePosition"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Poke Position"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""99b19b88-e2ad-4670-91ee-1f55f6c34a69"", + ""path"": ""{RightHand}/pokeRotation"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Poke Rotation"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""1de48aee-890b-4dbb-a02d-51df9bd39db7"", + ""path"": ""{RightHand}/isTracked"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Is Tracked"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""5a0c4fe0-639a-44e0-beeb-4e11e0dea7ef"", + ""path"": ""{RightHand}/isTracked"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Is Tracked"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""5469d4d1-9645-4397-a596-d74f876eafc2"", + ""path"": ""{RightHand}/aimFlags"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Aim Flags"", + ""isComposite"": false, + ""isPartOfComposite"": false + } + ] + }, + { + ""name"": ""XRI RightHand Interaction"", + ""id"": ""461bce25-7762-40c5-b639-f190649be6d6"", + ""actions"": [ + { + ""name"": ""Select"", + ""type"": ""Button"", + ""id"": ""ac96c10b-c955-4a46-8e67-bf16bc069b53"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Select Value"", + ""type"": ""Value"", + ""id"": ""39bbf1ac-21a3-413d-90f6-6dbf6efeaabe"", + ""expectedControlType"": ""Axis"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Activate"", + ""type"": ""Button"", + ""id"": ""41976d89-60de-4deb-bff9-16b4af96b290"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Activate Value"", + ""type"": ""Value"", + ""id"": ""c3ca6ed7-3d25-44a2-b1d8-5be4eb699370"", + ""expectedControlType"": ""Axis"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""UI Press"", + ""type"": ""Button"", + ""id"": ""65174b45-c2ee-4f90-93bb-fb4084eaaab3"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""UI Press Value"", + ""type"": ""Value"", + ""id"": ""962ac033-ec42-4981-88a4-551ad9be6ecb"", + ""expectedControlType"": ""Axis"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Rotate Anchor"", + ""type"": ""Value"", + ""id"": ""9b5d8312-f609-4895-b70f-81a722b2ae11"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Translate Anchor"", + ""type"": ""Value"", + ""id"": ""6f7cf253-7062-443b-b10f-2be48a33f027"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + } + ], + ""bindings"": [ + { + ""name"": """", + ""id"": ""1ce80054-410d-4112-a332-50faa7fb4f23"", + ""path"": ""{RightHand}/gripPressed"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Select"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""1d5b47ea-64e3-4b99-b620-de6c360908be"", + ""path"": ""{RightHand}/indexPressed"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Select"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""dd433817-216c-46b9-8dd3-f3a4ea1767b9"", + ""path"": ""{RightHand}/grip"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Select Value"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""770a07b5-a199-4342-b4a5-b3baafbe2bcb"", + ""path"": ""{RightHand}/pinchStrengthIndex"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Select Value"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""fa59aed1-ae0b-4074-a58c-294b85f46228"", + ""path"": ""{RightHand}/triggerPressed"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Activate"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""150f414f-61bf-47b1-b4f8-f772a2a40565"", + ""path"": ""{RightHand}/trigger"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Activate Value"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""92bb5b8f-bf48-4dab-af05-50a865773895"", + ""path"": ""{RightHand}/triggerPressed"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""UI Press"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""1652c26e-d835-461f-b46b-55b146fd9bba"", + ""path"": ""{RightHand}/indexPressed"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""UI Press"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""5b4ef08d-9ddd-4f0a-8539-d1114d14d143"", + ""path"": ""{RightHand}/trigger"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""UI Press Value"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""620cd3c3-a8c2-4a24-825a-ef6eb1cb41ef"", + ""path"": ""{RightHand}/pinchStrengthIndex"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""UI Press Value"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""5c0fa06c-b670-477f-a95d-eb3b4880e439"", + ""path"": ""{RightHand}/Primary2DAxis"", + ""interactions"": """", + ""processors"": ""ScaleVector2(y=0),StickDeadzone"", + ""groups"": ""Generic XR Controller"", + ""action"": ""Rotate Anchor"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""4caf4e8d-13e5-4bd6-8f42-b6b99c315ad0"", + ""path"": ""{RightHand}/Primary2DAxis"", + ""interactions"": """", + ""processors"": ""ScaleVector2(x=0),StickDeadzone"", + ""groups"": ""Generic XR Controller"", + ""action"": ""Translate Anchor"", + ""isComposite"": false, + ""isPartOfComposite"": false + } + ] + }, + { + ""name"": ""XRI RightHand Locomotion"", + ""id"": ""99ce76d3-82c5-4289-9670-2ecffa6833fd"", + ""actions"": [ + { + ""name"": ""Teleport Select"", + ""type"": ""Value"", + ""id"": ""02e43582-8973-4940-af06-dff6158e3df2"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Teleport Mode Activate"", + ""type"": ""Value"", + ""id"": ""a6c7231d-c55d-4dd4-9e87-877bb5522ef5"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Teleport Mode Cancel"", + ""type"": ""Button"", + ""id"": ""d587b60c-39a0-4365-8075-477ce484ba0f"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Teleport Direction"", + ""type"": ""Value"", + ""id"": ""b950a329-6492-4e29-b563-afc726f81e95"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Turn"", + ""type"": ""Value"", + ""id"": ""9fb2eb2b-2fb6-4328-8167-10a1bf11b424"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Move"", + ""type"": ""Value"", + ""id"": ""00a4dc9f-1ee6-4349-b0e9-72d5dccaadd6"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Grab Move"", + ""type"": ""Button"", + ""id"": ""cfb29d37-3db0-4e5d-a73b-7d48a19e279e"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Snap Turn"", + ""type"": ""Value"", + ""id"": ""44441ad6-5762-466d-ad54-aa44fcd61a5c"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + } + ], + ""bindings"": [ + { + ""name"": """", + ""id"": ""919c4a6c-22ed-4083-8e14-f30e91ff59fe"", + ""path"": ""{RightHand}/Primary2DAxis"", + ""interactions"": ""Sector(directions=-1,sweepBehavior=3)"", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Teleport Select"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""62690862-4688-4010-975b-b3d9c6062157"", + ""path"": ""{RightHand}/Primary2DAxis"", + ""interactions"": ""Sector(directions=1)"", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Teleport Mode Activate"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""de466e6e-12bf-46a1-b0fd-ffbc343f3399"", + ""path"": ""{RightHand}/gripPressed"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Teleport Mode Cancel"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""d6c08c3d-3d41-4695-994d-1ac9016a5a9e"", + ""path"": ""{RightHand}/Primary2DAxis"", + ""interactions"": ""Sector(directions=12,sweepBehavior=1),Sector(directions=2,sweepBehavior=2)"", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Turn"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""022046aa-be71-4288-859d-6dd42844f6e6"", + ""path"": ""{RightHand}/Primary2DAxis"", + ""interactions"": """", + ""processors"": ""StickDeadzone"", + ""groups"": ""Continuous Move"", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""c4b46d7d-8231-4672-83f9-75af565faf57"", + ""path"": ""{RightHand}/primary2DAxis"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Noncontinuous Move"", + ""action"": ""Teleport Direction"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""7ecb549e-ab98-4a4b-b979-38068fe3b811"", + ""path"": ""{RightHand}/gripPressed"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Grab Move"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""31d838df-4d4e-4c16-a373-b9c07d9d2e2a"", + ""path"": ""{RightHand}/Primary2DAxis"", + ""interactions"": ""Sector(directions=12,sweepBehavior=1),Sector(directions=2,sweepBehavior=2)"", + ""processors"": """", + ""groups"": ""Generic XR Controller"", + ""action"": ""Snap Turn"", + ""isComposite"": false, + ""isPartOfComposite"": false + } + ] + }, + { + ""name"": ""XRI UI"", + ""id"": ""edd65a7c-601c-4915-8307-025a081d8790"", + ""actions"": [ + { + ""name"": ""Navigate"", + ""type"": ""PassThrough"", + ""id"": ""c9a92aca-49d5-4910-8ade-8e994f0a31f0"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Submit"", + ""type"": ""Button"", + ""id"": ""eba98c2e-6268-4233-bb88-946287bc753c"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Cancel"", + ""type"": ""Button"", + ""id"": ""448b396b-0885-4543-ac5a-8b3405da6791"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Point"", + ""type"": ""PassThrough"", + ""id"": ""682022c0-857a-4332-8753-7f8fcdf84d37"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Click"", + ""type"": ""PassThrough"", + ""id"": ""b194cd98-7e4f-457a-a60c-cebc25dc32a2"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""ScrollWheel"", + ""type"": ""PassThrough"", + ""id"": ""bd7fc534-75e3-489d-94fb-3d45cb78d8f3"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""MiddleClick"", + ""type"": ""PassThrough"", + ""id"": ""cc5f5666-a75c-4dfc-8566-ded8ec9b4ae3"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""RightClick"", + ""type"": ""PassThrough"", + ""id"": ""533aeb95-18b2-4a83-a69d-f6e0be72ff8a"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + } + ], + ""bindings"": [ + { + ""name"": """", + ""id"": ""e87fa299-8441-4620-89dd-0564c7d552e2"", + ""path"": ""/position"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Point"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""445a013e-9c17-48a2-9856-067e4826df03"", + ""path"": ""/position"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Point"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""05c1e38e-79dd-41cb-95d5-74f42e65d92f"", + ""path"": ""/touch*/position"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Point"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""57909bb4-1088-4975-9227-ecc87a305257"", + ""path"": ""/leftButton"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Click"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""2740386d-d4b6-4342-903c-d9390783f04a"", + ""path"": ""/tip"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Click"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""d6fd3bb5-c747-4eba-b599-1c6d7c738e2a"", + ""path"": ""/scroll"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""ScrollWheel"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""fb2286cc-fa20-4564-bff6-9f790f12cf6b"", + ""path"": ""/middleButton"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""MiddleClick"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""54eb7da2-546a-4d75-bfcc-ae38be303a59"", + ""path"": ""/rightButton"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""RightClick"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": ""Gamepad"", + ""id"": ""4c9a5170-d325-45ee-8ef9-fc12d1f5a97e"", + ""path"": ""2DVector"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": true, + ""isPartOfComposite"": false + }, + { + ""name"": ""up"", + ""id"": ""c846c708-b27e-4ac9-9a83-c80ac5c263d5"", + ""path"": ""/leftStick/up"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""up"", + ""id"": ""caf2fb01-3e95-47c1-8663-315057149d48"", + ""path"": ""/rightStick/up"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""down"", + ""id"": ""830d65e9-887d-45b4-8386-562deb29e465"", + ""path"": ""/leftStick/down"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""down"", + ""id"": ""e5c71442-9909-46d8-aa56-8fa3574a8227"", + ""path"": ""/rightStick/down"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""left"", + ""id"": ""210246e8-c3c4-4edc-be9c-1916858346df"", + ""path"": ""/leftStick/left"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""left"", + ""id"": ""fb701ef0-9910-4639-80d1-2c1c03f871ed"", + ""path"": ""/rightStick/left"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""right"", + ""id"": ""3de9f409-fb44-4311-8705-b4f4e7cd3029"", + ""path"": ""/leftStick/right"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""right"", + ""id"": ""bd001ba1-d6a2-4a97-9c87-36b5b92728af"", + ""path"": ""/rightStick/right"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": """", + ""id"": ""fcc0a2cd-a126-43ad-bb1e-ffc1ae7668c7"", + ""path"": ""/dpad"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": ""Joystick"", + ""id"": ""65cbb13a-6e00-4973-9887-e49e06575091"", + ""path"": ""2DVector"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": true, + ""isPartOfComposite"": false + }, + { + ""name"": ""up"", + ""id"": ""3c5803e2-42d0-4d48-bbd6-41ce4442df0b"", + ""path"": ""/stick/up"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""down"", + ""id"": ""d5b1219c-0df6-4bc5-ad11-205b748cade4"", + ""path"": ""/stick/down"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""left"", + ""id"": ""065d2394-f10a-46df-b6cb-2c56a6c842ea"", + ""path"": ""/stick/left"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""right"", + ""id"": ""29921809-7785-44a1-a316-e96307174552"", + ""path"": ""/stick/right"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""Keyboard"", + ""id"": ""49817cc8-fecc-406d-a187-6393de317e95"", + ""path"": ""2DVector"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": true, + ""isPartOfComposite"": false + }, + { + ""name"": ""up"", + ""id"": ""ef33431d-17d0-4e1c-90f2-bbaa2ef9a8b7"", + ""path"": ""/w"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""up"", + ""id"": ""5ddfdce2-0f11-4f4e-8931-0ae6fb289ac7"", + ""path"": ""/upArrow"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""down"", + ""id"": ""5ceab4e0-1600-4bfb-acf6-8d02c4e10aea"", + ""path"": ""/s"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""down"", + ""id"": ""94e10d8b-5bfa-439d-afae-b975efac2b7b"", + ""path"": ""/downArrow"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""left"", + ""id"": ""9fc7d14a-385d-4ca5-b185-906e049b7eed"", + ""path"": ""/a"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""left"", + ""id"": ""d7e5e0c4-05dc-4f2f-8649-a66fe843caed"", + ""path"": ""/leftArrow"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""right"", + ""id"": ""76ab9656-e168-4b2c-9a6b-d8d6da981e4f"", + ""path"": ""/d"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""right"", + ""id"": ""ad7bc5b3-6ada-42a2-9cba-5c7334cba7be"", + ""path"": ""/rightArrow"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": """", + ""id"": ""9f2a7c29-a588-4b6a-a966-955eb408c526"", + ""path"": ""*/{Submit}"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Submit"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""67f51768-1493-4444-b118-82d398a16fdd"", + ""path"": ""*/{Cancel}"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Cancel"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""198e6869-709e-448d-96d4-27186c9d56e6"", + ""path"": ""/touch*/click"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Click"", + ""isComposite"": false, + ""isPartOfComposite"": false + } + ] + } + ], + ""controlSchemes"": [ + { + ""name"": ""Generic XR Controller"", + ""bindingGroup"": ""Generic XR Controller"", + ""devices"": [ + { + ""devicePath"": ""{LeftHand}"", + ""isOptional"": true, + ""isOR"": false + }, + { + ""devicePath"": ""{RightHand}"", + ""isOptional"": true, + ""isOR"": false + }, + { + ""devicePath"": """", + ""isOptional"": true, + ""isOR"": false + }, + { + ""devicePath"": """", + ""isOptional"": true, + ""isOR"": false + } + ] + }, + { + ""name"": ""Continuous Move"", + ""bindingGroup"": ""Continuous Move"", + ""devices"": [ + { + ""devicePath"": ""{LeftHand}"", + ""isOptional"": false, + ""isOR"": false + }, + { + ""devicePath"": ""{RightHand}"", + ""isOptional"": false, + ""isOR"": false + } + ] + }, + { + ""name"": ""Noncontinuous Move"", + ""bindingGroup"": ""Noncontinuous Move"", + ""devices"": [ + { + ""devicePath"": ""{LeftHand}"", + ""isOptional"": false, + ""isOR"": false + }, + { + ""devicePath"": ""{RightHand}"", + ""isOptional"": false, + ""isOR"": false + } + ] + } + ] +}"); + // XRI Head + m_XRIHead = asset.FindActionMap("XRI Head", throwIfNotFound: true); + m_XRIHead_Position = m_XRIHead.FindAction("Position", throwIfNotFound: true); + m_XRIHead_Rotation = m_XRIHead.FindAction("Rotation", throwIfNotFound: true); + m_XRIHead_IsTracked = m_XRIHead.FindAction("Is Tracked", throwIfNotFound: true); + m_XRIHead_TrackingState = m_XRIHead.FindAction("Tracking State", throwIfNotFound: true); + m_XRIHead_EyeGazePosition = m_XRIHead.FindAction("Eye Gaze Position", throwIfNotFound: true); + m_XRIHead_EyeGazeRotation = m_XRIHead.FindAction("Eye Gaze Rotation", throwIfNotFound: true); + m_XRIHead_EyeGazeTrackingState = m_XRIHead.FindAction("Eye Gaze Tracking State", throwIfNotFound: true); + // XRI LeftHand + m_XRILeftHand = asset.FindActionMap("XRI LeftHand", throwIfNotFound: true); + m_XRILeftHand_Position = m_XRILeftHand.FindAction("Position", throwIfNotFound: true); + m_XRILeftHand_Rotation = m_XRILeftHand.FindAction("Rotation", throwIfNotFound: true); + m_XRILeftHand_IsTracked = m_XRILeftHand.FindAction("Is Tracked", throwIfNotFound: true); + m_XRILeftHand_TrackingState = m_XRILeftHand.FindAction("Tracking State", throwIfNotFound: true); + m_XRILeftHand_HapticDevice = m_XRILeftHand.FindAction("Haptic Device", throwIfNotFound: true); + m_XRILeftHand_AimPosition = m_XRILeftHand.FindAction("Aim Position", throwIfNotFound: true); + m_XRILeftHand_AimRotation = m_XRILeftHand.FindAction("Aim Rotation", throwIfNotFound: true); + m_XRILeftHand_AimFlags = m_XRILeftHand.FindAction("Aim Flags", throwIfNotFound: true); + m_XRILeftHand_PinchPosition = m_XRILeftHand.FindAction("Pinch Position", throwIfNotFound: true); + m_XRILeftHand_PokePosition = m_XRILeftHand.FindAction("Poke Position", throwIfNotFound: true); + m_XRILeftHand_PokeRotation = m_XRILeftHand.FindAction("Poke Rotation", throwIfNotFound: true); + // XRI LeftHand Interaction + m_XRILeftHandInteraction = asset.FindActionMap("XRI LeftHand Interaction", throwIfNotFound: true); + m_XRILeftHandInteraction_Select = m_XRILeftHandInteraction.FindAction("Select", throwIfNotFound: true); + m_XRILeftHandInteraction_SelectValue = m_XRILeftHandInteraction.FindAction("Select Value", throwIfNotFound: true); + m_XRILeftHandInteraction_Activate = m_XRILeftHandInteraction.FindAction("Activate", throwIfNotFound: true); + m_XRILeftHandInteraction_ActivateValue = m_XRILeftHandInteraction.FindAction("Activate Value", throwIfNotFound: true); + m_XRILeftHandInteraction_UIPress = m_XRILeftHandInteraction.FindAction("UI Press", throwIfNotFound: true); + m_XRILeftHandInteraction_UIPressValue = m_XRILeftHandInteraction.FindAction("UI Press Value", throwIfNotFound: true); + m_XRILeftHandInteraction_RotateAnchor = m_XRILeftHandInteraction.FindAction("Rotate Anchor", throwIfNotFound: true); + m_XRILeftHandInteraction_TranslateAnchor = m_XRILeftHandInteraction.FindAction("Translate Anchor", throwIfNotFound: true); + // XRI LeftHand Locomotion + m_XRILeftHandLocomotion = asset.FindActionMap("XRI LeftHand Locomotion", throwIfNotFound: true); + m_XRILeftHandLocomotion_TeleportSelect = m_XRILeftHandLocomotion.FindAction("Teleport Select", throwIfNotFound: true); + m_XRILeftHandLocomotion_TeleportModeActivate = m_XRILeftHandLocomotion.FindAction("Teleport Mode Activate", throwIfNotFound: true); + m_XRILeftHandLocomotion_TeleportModeCancel = m_XRILeftHandLocomotion.FindAction("Teleport Mode Cancel", throwIfNotFound: true); + m_XRILeftHandLocomotion_TeleportDirection = m_XRILeftHandLocomotion.FindAction("Teleport Direction", throwIfNotFound: true); + m_XRILeftHandLocomotion_Turn = m_XRILeftHandLocomotion.FindAction("Turn", throwIfNotFound: true); + m_XRILeftHandLocomotion_Move = m_XRILeftHandLocomotion.FindAction("Move", throwIfNotFound: true); + m_XRILeftHandLocomotion_GrabMove = m_XRILeftHandLocomotion.FindAction("Grab Move", throwIfNotFound: true); + m_XRILeftHandLocomotion_SnapTurn = m_XRILeftHandLocomotion.FindAction("Snap Turn", throwIfNotFound: true); + // XRI RightHand + m_XRIRightHand = asset.FindActionMap("XRI RightHand", throwIfNotFound: true); + m_XRIRightHand_Position = m_XRIRightHand.FindAction("Position", throwIfNotFound: true); + m_XRIRightHand_Rotation = m_XRIRightHand.FindAction("Rotation", throwIfNotFound: true); + m_XRIRightHand_IsTracked = m_XRIRightHand.FindAction("Is Tracked", throwIfNotFound: true); + m_XRIRightHand_TrackingState = m_XRIRightHand.FindAction("Tracking State", throwIfNotFound: true); + m_XRIRightHand_HapticDevice = m_XRIRightHand.FindAction("Haptic Device", throwIfNotFound: true); + m_XRIRightHand_AimPosition = m_XRIRightHand.FindAction("Aim Position", throwIfNotFound: true); + m_XRIRightHand_AimRotation = m_XRIRightHand.FindAction("Aim Rotation", throwIfNotFound: true); + m_XRIRightHand_AimFlags = m_XRIRightHand.FindAction("Aim Flags", throwIfNotFound: true); + m_XRIRightHand_PinchPosition = m_XRIRightHand.FindAction("Pinch Position", throwIfNotFound: true); + m_XRIRightHand_PokePosition = m_XRIRightHand.FindAction("Poke Position", throwIfNotFound: true); + m_XRIRightHand_PokeRotation = m_XRIRightHand.FindAction("Poke Rotation", throwIfNotFound: true); + // XRI RightHand Interaction + m_XRIRightHandInteraction = asset.FindActionMap("XRI RightHand Interaction", throwIfNotFound: true); + m_XRIRightHandInteraction_Select = m_XRIRightHandInteraction.FindAction("Select", throwIfNotFound: true); + m_XRIRightHandInteraction_SelectValue = m_XRIRightHandInteraction.FindAction("Select Value", throwIfNotFound: true); + m_XRIRightHandInteraction_Activate = m_XRIRightHandInteraction.FindAction("Activate", throwIfNotFound: true); + m_XRIRightHandInteraction_ActivateValue = m_XRIRightHandInteraction.FindAction("Activate Value", throwIfNotFound: true); + m_XRIRightHandInteraction_UIPress = m_XRIRightHandInteraction.FindAction("UI Press", throwIfNotFound: true); + m_XRIRightHandInteraction_UIPressValue = m_XRIRightHandInteraction.FindAction("UI Press Value", throwIfNotFound: true); + m_XRIRightHandInteraction_RotateAnchor = m_XRIRightHandInteraction.FindAction("Rotate Anchor", throwIfNotFound: true); + m_XRIRightHandInteraction_TranslateAnchor = m_XRIRightHandInteraction.FindAction("Translate Anchor", throwIfNotFound: true); + // XRI RightHand Locomotion + m_XRIRightHandLocomotion = asset.FindActionMap("XRI RightHand Locomotion", throwIfNotFound: true); + m_XRIRightHandLocomotion_TeleportSelect = m_XRIRightHandLocomotion.FindAction("Teleport Select", throwIfNotFound: true); + m_XRIRightHandLocomotion_TeleportModeActivate = m_XRIRightHandLocomotion.FindAction("Teleport Mode Activate", throwIfNotFound: true); + m_XRIRightHandLocomotion_TeleportModeCancel = m_XRIRightHandLocomotion.FindAction("Teleport Mode Cancel", throwIfNotFound: true); + m_XRIRightHandLocomotion_TeleportDirection = m_XRIRightHandLocomotion.FindAction("Teleport Direction", throwIfNotFound: true); + m_XRIRightHandLocomotion_Turn = m_XRIRightHandLocomotion.FindAction("Turn", throwIfNotFound: true); + m_XRIRightHandLocomotion_Move = m_XRIRightHandLocomotion.FindAction("Move", throwIfNotFound: true); + m_XRIRightHandLocomotion_GrabMove = m_XRIRightHandLocomotion.FindAction("Grab Move", throwIfNotFound: true); + m_XRIRightHandLocomotion_SnapTurn = m_XRIRightHandLocomotion.FindAction("Snap Turn", throwIfNotFound: true); + // XRI UI + m_XRIUI = asset.FindActionMap("XRI UI", throwIfNotFound: true); + m_XRIUI_Navigate = m_XRIUI.FindAction("Navigate", throwIfNotFound: true); + m_XRIUI_Submit = m_XRIUI.FindAction("Submit", throwIfNotFound: true); + m_XRIUI_Cancel = m_XRIUI.FindAction("Cancel", throwIfNotFound: true); + m_XRIUI_Point = m_XRIUI.FindAction("Point", throwIfNotFound: true); + m_XRIUI_Click = m_XRIUI.FindAction("Click", throwIfNotFound: true); + m_XRIUI_ScrollWheel = m_XRIUI.FindAction("ScrollWheel", throwIfNotFound: true); + m_XRIUI_MiddleClick = m_XRIUI.FindAction("MiddleClick", throwIfNotFound: true); + m_XRIUI_RightClick = m_XRIUI.FindAction("RightClick", throwIfNotFound: true); + } + + public void Dispose() + { + UnityEngine.Object.Destroy(asset); + } + + public InputBinding? bindingMask + { + get => asset.bindingMask; + set => asset.bindingMask = value; + } + + public ReadOnlyArray? devices + { + get => asset.devices; + set => asset.devices = value; + } + + public ReadOnlyArray controlSchemes => asset.controlSchemes; + + public bool Contains(InputAction action) + { + return asset.Contains(action); + } + + public IEnumerator GetEnumerator() + { + return asset.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Enable() + { + asset.Enable(); + } + + public void Disable() + { + asset.Disable(); + } + + public IEnumerable bindings => asset.bindings; + + public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false) + { + return asset.FindAction(actionNameOrId, throwIfNotFound); + } + + public int FindBinding(InputBinding bindingMask, out InputAction action) + { + return asset.FindBinding(bindingMask, out action); + } + + // XRI Head + private readonly InputActionMap m_XRIHead; + private List m_XRIHeadActionsCallbackInterfaces = new List(); + private readonly InputAction m_XRIHead_Position; + private readonly InputAction m_XRIHead_Rotation; + private readonly InputAction m_XRIHead_IsTracked; + private readonly InputAction m_XRIHead_TrackingState; + private readonly InputAction m_XRIHead_EyeGazePosition; + private readonly InputAction m_XRIHead_EyeGazeRotation; + private readonly InputAction m_XRIHead_EyeGazeTrackingState; + public struct XRIHeadActions + { + private @XRIDefaultInputActions m_Wrapper; + public XRIHeadActions(@XRIDefaultInputActions wrapper) { m_Wrapper = wrapper; } + public InputAction @Position => m_Wrapper.m_XRIHead_Position; + public InputAction @Rotation => m_Wrapper.m_XRIHead_Rotation; + public InputAction @IsTracked => m_Wrapper.m_XRIHead_IsTracked; + public InputAction @TrackingState => m_Wrapper.m_XRIHead_TrackingState; + public InputAction @EyeGazePosition => m_Wrapper.m_XRIHead_EyeGazePosition; + public InputAction @EyeGazeRotation => m_Wrapper.m_XRIHead_EyeGazeRotation; + public InputAction @EyeGazeTrackingState => m_Wrapper.m_XRIHead_EyeGazeTrackingState; + public InputActionMap Get() { return m_Wrapper.m_XRIHead; } + public void Enable() { Get().Enable(); } + public void Disable() { Get().Disable(); } + public bool enabled => Get().enabled; + public static implicit operator InputActionMap(XRIHeadActions set) { return set.Get(); } + public void AddCallbacks(IXRIHeadActions instance) + { + if (instance == null || m_Wrapper.m_XRIHeadActionsCallbackInterfaces.Contains(instance)) return; + m_Wrapper.m_XRIHeadActionsCallbackInterfaces.Add(instance); + @Position.started += instance.OnPosition; + @Position.performed += instance.OnPosition; + @Position.canceled += instance.OnPosition; + @Rotation.started += instance.OnRotation; + @Rotation.performed += instance.OnRotation; + @Rotation.canceled += instance.OnRotation; + @IsTracked.started += instance.OnIsTracked; + @IsTracked.performed += instance.OnIsTracked; + @IsTracked.canceled += instance.OnIsTracked; + @TrackingState.started += instance.OnTrackingState; + @TrackingState.performed += instance.OnTrackingState; + @TrackingState.canceled += instance.OnTrackingState; + @EyeGazePosition.started += instance.OnEyeGazePosition; + @EyeGazePosition.performed += instance.OnEyeGazePosition; + @EyeGazePosition.canceled += instance.OnEyeGazePosition; + @EyeGazeRotation.started += instance.OnEyeGazeRotation; + @EyeGazeRotation.performed += instance.OnEyeGazeRotation; + @EyeGazeRotation.canceled += instance.OnEyeGazeRotation; + @EyeGazeTrackingState.started += instance.OnEyeGazeTrackingState; + @EyeGazeTrackingState.performed += instance.OnEyeGazeTrackingState; + @EyeGazeTrackingState.canceled += instance.OnEyeGazeTrackingState; + } + + private void UnregisterCallbacks(IXRIHeadActions instance) + { + @Position.started -= instance.OnPosition; + @Position.performed -= instance.OnPosition; + @Position.canceled -= instance.OnPosition; + @Rotation.started -= instance.OnRotation; + @Rotation.performed -= instance.OnRotation; + @Rotation.canceled -= instance.OnRotation; + @IsTracked.started -= instance.OnIsTracked; + @IsTracked.performed -= instance.OnIsTracked; + @IsTracked.canceled -= instance.OnIsTracked; + @TrackingState.started -= instance.OnTrackingState; + @TrackingState.performed -= instance.OnTrackingState; + @TrackingState.canceled -= instance.OnTrackingState; + @EyeGazePosition.started -= instance.OnEyeGazePosition; + @EyeGazePosition.performed -= instance.OnEyeGazePosition; + @EyeGazePosition.canceled -= instance.OnEyeGazePosition; + @EyeGazeRotation.started -= instance.OnEyeGazeRotation; + @EyeGazeRotation.performed -= instance.OnEyeGazeRotation; + @EyeGazeRotation.canceled -= instance.OnEyeGazeRotation; + @EyeGazeTrackingState.started -= instance.OnEyeGazeTrackingState; + @EyeGazeTrackingState.performed -= instance.OnEyeGazeTrackingState; + @EyeGazeTrackingState.canceled -= instance.OnEyeGazeTrackingState; + } + + public void RemoveCallbacks(IXRIHeadActions instance) + { + if (m_Wrapper.m_XRIHeadActionsCallbackInterfaces.Remove(instance)) + UnregisterCallbacks(instance); + } + + public void SetCallbacks(IXRIHeadActions instance) + { + foreach (var item in m_Wrapper.m_XRIHeadActionsCallbackInterfaces) + UnregisterCallbacks(item); + m_Wrapper.m_XRIHeadActionsCallbackInterfaces.Clear(); + AddCallbacks(instance); + } + } + public XRIHeadActions @XRIHead => new XRIHeadActions(this); + + // XRI LeftHand + private readonly InputActionMap m_XRILeftHand; + private List m_XRILeftHandActionsCallbackInterfaces = new List(); + private readonly InputAction m_XRILeftHand_Position; + private readonly InputAction m_XRILeftHand_Rotation; + private readonly InputAction m_XRILeftHand_IsTracked; + private readonly InputAction m_XRILeftHand_TrackingState; + private readonly InputAction m_XRILeftHand_HapticDevice; + private readonly InputAction m_XRILeftHand_AimPosition; + private readonly InputAction m_XRILeftHand_AimRotation; + private readonly InputAction m_XRILeftHand_AimFlags; + private readonly InputAction m_XRILeftHand_PinchPosition; + private readonly InputAction m_XRILeftHand_PokePosition; + private readonly InputAction m_XRILeftHand_PokeRotation; + public struct XRILeftHandActions + { + private @XRIDefaultInputActions m_Wrapper; + public XRILeftHandActions(@XRIDefaultInputActions wrapper) { m_Wrapper = wrapper; } + public InputAction @Position => m_Wrapper.m_XRILeftHand_Position; + public InputAction @Rotation => m_Wrapper.m_XRILeftHand_Rotation; + public InputAction @IsTracked => m_Wrapper.m_XRILeftHand_IsTracked; + public InputAction @TrackingState => m_Wrapper.m_XRILeftHand_TrackingState; + public InputAction @HapticDevice => m_Wrapper.m_XRILeftHand_HapticDevice; + public InputAction @AimPosition => m_Wrapper.m_XRILeftHand_AimPosition; + public InputAction @AimRotation => m_Wrapper.m_XRILeftHand_AimRotation; + public InputAction @AimFlags => m_Wrapper.m_XRILeftHand_AimFlags; + public InputAction @PinchPosition => m_Wrapper.m_XRILeftHand_PinchPosition; + public InputAction @PokePosition => m_Wrapper.m_XRILeftHand_PokePosition; + public InputAction @PokeRotation => m_Wrapper.m_XRILeftHand_PokeRotation; + public InputActionMap Get() { return m_Wrapper.m_XRILeftHand; } + public void Enable() { Get().Enable(); } + public void Disable() { Get().Disable(); } + public bool enabled => Get().enabled; + public static implicit operator InputActionMap(XRILeftHandActions set) { return set.Get(); } + public void AddCallbacks(IXRILeftHandActions instance) + { + if (instance == null || m_Wrapper.m_XRILeftHandActionsCallbackInterfaces.Contains(instance)) return; + m_Wrapper.m_XRILeftHandActionsCallbackInterfaces.Add(instance); + @Position.started += instance.OnPosition; + @Position.performed += instance.OnPosition; + @Position.canceled += instance.OnPosition; + @Rotation.started += instance.OnRotation; + @Rotation.performed += instance.OnRotation; + @Rotation.canceled += instance.OnRotation; + @IsTracked.started += instance.OnIsTracked; + @IsTracked.performed += instance.OnIsTracked; + @IsTracked.canceled += instance.OnIsTracked; + @TrackingState.started += instance.OnTrackingState; + @TrackingState.performed += instance.OnTrackingState; + @TrackingState.canceled += instance.OnTrackingState; + @HapticDevice.started += instance.OnHapticDevice; + @HapticDevice.performed += instance.OnHapticDevice; + @HapticDevice.canceled += instance.OnHapticDevice; + @AimPosition.started += instance.OnAimPosition; + @AimPosition.performed += instance.OnAimPosition; + @AimPosition.canceled += instance.OnAimPosition; + @AimRotation.started += instance.OnAimRotation; + @AimRotation.performed += instance.OnAimRotation; + @AimRotation.canceled += instance.OnAimRotation; + @AimFlags.started += instance.OnAimFlags; + @AimFlags.performed += instance.OnAimFlags; + @AimFlags.canceled += instance.OnAimFlags; + @PinchPosition.started += instance.OnPinchPosition; + @PinchPosition.performed += instance.OnPinchPosition; + @PinchPosition.canceled += instance.OnPinchPosition; + @PokePosition.started += instance.OnPokePosition; + @PokePosition.performed += instance.OnPokePosition; + @PokePosition.canceled += instance.OnPokePosition; + @PokeRotation.started += instance.OnPokeRotation; + @PokeRotation.performed += instance.OnPokeRotation; + @PokeRotation.canceled += instance.OnPokeRotation; + } + + private void UnregisterCallbacks(IXRILeftHandActions instance) + { + @Position.started -= instance.OnPosition; + @Position.performed -= instance.OnPosition; + @Position.canceled -= instance.OnPosition; + @Rotation.started -= instance.OnRotation; + @Rotation.performed -= instance.OnRotation; + @Rotation.canceled -= instance.OnRotation; + @IsTracked.started -= instance.OnIsTracked; + @IsTracked.performed -= instance.OnIsTracked; + @IsTracked.canceled -= instance.OnIsTracked; + @TrackingState.started -= instance.OnTrackingState; + @TrackingState.performed -= instance.OnTrackingState; + @TrackingState.canceled -= instance.OnTrackingState; + @HapticDevice.started -= instance.OnHapticDevice; + @HapticDevice.performed -= instance.OnHapticDevice; + @HapticDevice.canceled -= instance.OnHapticDevice; + @AimPosition.started -= instance.OnAimPosition; + @AimPosition.performed -= instance.OnAimPosition; + @AimPosition.canceled -= instance.OnAimPosition; + @AimRotation.started -= instance.OnAimRotation; + @AimRotation.performed -= instance.OnAimRotation; + @AimRotation.canceled -= instance.OnAimRotation; + @AimFlags.started -= instance.OnAimFlags; + @AimFlags.performed -= instance.OnAimFlags; + @AimFlags.canceled -= instance.OnAimFlags; + @PinchPosition.started -= instance.OnPinchPosition; + @PinchPosition.performed -= instance.OnPinchPosition; + @PinchPosition.canceled -= instance.OnPinchPosition; + @PokePosition.started -= instance.OnPokePosition; + @PokePosition.performed -= instance.OnPokePosition; + @PokePosition.canceled -= instance.OnPokePosition; + @PokeRotation.started -= instance.OnPokeRotation; + @PokeRotation.performed -= instance.OnPokeRotation; + @PokeRotation.canceled -= instance.OnPokeRotation; + } + + public void RemoveCallbacks(IXRILeftHandActions instance) + { + if (m_Wrapper.m_XRILeftHandActionsCallbackInterfaces.Remove(instance)) + UnregisterCallbacks(instance); + } + + public void SetCallbacks(IXRILeftHandActions instance) + { + foreach (var item in m_Wrapper.m_XRILeftHandActionsCallbackInterfaces) + UnregisterCallbacks(item); + m_Wrapper.m_XRILeftHandActionsCallbackInterfaces.Clear(); + AddCallbacks(instance); + } + } + public XRILeftHandActions @XRILeftHand => new XRILeftHandActions(this); + + // XRI LeftHand Interaction + private readonly InputActionMap m_XRILeftHandInteraction; + private List m_XRILeftHandInteractionActionsCallbackInterfaces = new List(); + private readonly InputAction m_XRILeftHandInteraction_Select; + private readonly InputAction m_XRILeftHandInteraction_SelectValue; + private readonly InputAction m_XRILeftHandInteraction_Activate; + private readonly InputAction m_XRILeftHandInteraction_ActivateValue; + private readonly InputAction m_XRILeftHandInteraction_UIPress; + private readonly InputAction m_XRILeftHandInteraction_UIPressValue; + private readonly InputAction m_XRILeftHandInteraction_RotateAnchor; + private readonly InputAction m_XRILeftHandInteraction_TranslateAnchor; + public struct XRILeftHandInteractionActions + { + private @XRIDefaultInputActions m_Wrapper; + public XRILeftHandInteractionActions(@XRIDefaultInputActions wrapper) { m_Wrapper = wrapper; } + public InputAction @Select => m_Wrapper.m_XRILeftHandInteraction_Select; + public InputAction @SelectValue => m_Wrapper.m_XRILeftHandInteraction_SelectValue; + public InputAction @Activate => m_Wrapper.m_XRILeftHandInteraction_Activate; + public InputAction @ActivateValue => m_Wrapper.m_XRILeftHandInteraction_ActivateValue; + public InputAction @UIPress => m_Wrapper.m_XRILeftHandInteraction_UIPress; + public InputAction @UIPressValue => m_Wrapper.m_XRILeftHandInteraction_UIPressValue; + public InputAction @RotateAnchor => m_Wrapper.m_XRILeftHandInteraction_RotateAnchor; + public InputAction @TranslateAnchor => m_Wrapper.m_XRILeftHandInteraction_TranslateAnchor; + public InputActionMap Get() { return m_Wrapper.m_XRILeftHandInteraction; } + public void Enable() { Get().Enable(); } + public void Disable() { Get().Disable(); } + public bool enabled => Get().enabled; + public static implicit operator InputActionMap(XRILeftHandInteractionActions set) { return set.Get(); } + public void AddCallbacks(IXRILeftHandInteractionActions instance) + { + if (instance == null || m_Wrapper.m_XRILeftHandInteractionActionsCallbackInterfaces.Contains(instance)) return; + m_Wrapper.m_XRILeftHandInteractionActionsCallbackInterfaces.Add(instance); + @Select.started += instance.OnSelect; + @Select.performed += instance.OnSelect; + @Select.canceled += instance.OnSelect; + @SelectValue.started += instance.OnSelectValue; + @SelectValue.performed += instance.OnSelectValue; + @SelectValue.canceled += instance.OnSelectValue; + @Activate.started += instance.OnActivate; + @Activate.performed += instance.OnActivate; + @Activate.canceled += instance.OnActivate; + @ActivateValue.started += instance.OnActivateValue; + @ActivateValue.performed += instance.OnActivateValue; + @ActivateValue.canceled += instance.OnActivateValue; + @UIPress.started += instance.OnUIPress; + @UIPress.performed += instance.OnUIPress; + @UIPress.canceled += instance.OnUIPress; + @UIPressValue.started += instance.OnUIPressValue; + @UIPressValue.performed += instance.OnUIPressValue; + @UIPressValue.canceled += instance.OnUIPressValue; + @RotateAnchor.started += instance.OnRotateAnchor; + @RotateAnchor.performed += instance.OnRotateAnchor; + @RotateAnchor.canceled += instance.OnRotateAnchor; + @TranslateAnchor.started += instance.OnTranslateAnchor; + @TranslateAnchor.performed += instance.OnTranslateAnchor; + @TranslateAnchor.canceled += instance.OnTranslateAnchor; + } + + private void UnregisterCallbacks(IXRILeftHandInteractionActions instance) + { + @Select.started -= instance.OnSelect; + @Select.performed -= instance.OnSelect; + @Select.canceled -= instance.OnSelect; + @SelectValue.started -= instance.OnSelectValue; + @SelectValue.performed -= instance.OnSelectValue; + @SelectValue.canceled -= instance.OnSelectValue; + @Activate.started -= instance.OnActivate; + @Activate.performed -= instance.OnActivate; + @Activate.canceled -= instance.OnActivate; + @ActivateValue.started -= instance.OnActivateValue; + @ActivateValue.performed -= instance.OnActivateValue; + @ActivateValue.canceled -= instance.OnActivateValue; + @UIPress.started -= instance.OnUIPress; + @UIPress.performed -= instance.OnUIPress; + @UIPress.canceled -= instance.OnUIPress; + @UIPressValue.started -= instance.OnUIPressValue; + @UIPressValue.performed -= instance.OnUIPressValue; + @UIPressValue.canceled -= instance.OnUIPressValue; + @RotateAnchor.started -= instance.OnRotateAnchor; + @RotateAnchor.performed -= instance.OnRotateAnchor; + @RotateAnchor.canceled -= instance.OnRotateAnchor; + @TranslateAnchor.started -= instance.OnTranslateAnchor; + @TranslateAnchor.performed -= instance.OnTranslateAnchor; + @TranslateAnchor.canceled -= instance.OnTranslateAnchor; + } + + public void RemoveCallbacks(IXRILeftHandInteractionActions instance) + { + if (m_Wrapper.m_XRILeftHandInteractionActionsCallbackInterfaces.Remove(instance)) + UnregisterCallbacks(instance); + } + + public void SetCallbacks(IXRILeftHandInteractionActions instance) + { + foreach (var item in m_Wrapper.m_XRILeftHandInteractionActionsCallbackInterfaces) + UnregisterCallbacks(item); + m_Wrapper.m_XRILeftHandInteractionActionsCallbackInterfaces.Clear(); + AddCallbacks(instance); + } + } + public XRILeftHandInteractionActions @XRILeftHandInteraction => new XRILeftHandInteractionActions(this); + + // XRI LeftHand Locomotion + private readonly InputActionMap m_XRILeftHandLocomotion; + private List m_XRILeftHandLocomotionActionsCallbackInterfaces = new List(); + private readonly InputAction m_XRILeftHandLocomotion_TeleportSelect; + private readonly InputAction m_XRILeftHandLocomotion_TeleportModeActivate; + private readonly InputAction m_XRILeftHandLocomotion_TeleportModeCancel; + private readonly InputAction m_XRILeftHandLocomotion_TeleportDirection; + private readonly InputAction m_XRILeftHandLocomotion_Turn; + private readonly InputAction m_XRILeftHandLocomotion_Move; + private readonly InputAction m_XRILeftHandLocomotion_GrabMove; + private readonly InputAction m_XRILeftHandLocomotion_SnapTurn; + public struct XRILeftHandLocomotionActions + { + private @XRIDefaultInputActions m_Wrapper; + public XRILeftHandLocomotionActions(@XRIDefaultInputActions wrapper) { m_Wrapper = wrapper; } + public InputAction @TeleportSelect => m_Wrapper.m_XRILeftHandLocomotion_TeleportSelect; + public InputAction @TeleportModeActivate => m_Wrapper.m_XRILeftHandLocomotion_TeleportModeActivate; + public InputAction @TeleportModeCancel => m_Wrapper.m_XRILeftHandLocomotion_TeleportModeCancel; + public InputAction @TeleportDirection => m_Wrapper.m_XRILeftHandLocomotion_TeleportDirection; + public InputAction @Turn => m_Wrapper.m_XRILeftHandLocomotion_Turn; + public InputAction @Move => m_Wrapper.m_XRILeftHandLocomotion_Move; + public InputAction @GrabMove => m_Wrapper.m_XRILeftHandLocomotion_GrabMove; + public InputAction @SnapTurn => m_Wrapper.m_XRILeftHandLocomotion_SnapTurn; + public InputActionMap Get() { return m_Wrapper.m_XRILeftHandLocomotion; } + public void Enable() { Get().Enable(); } + public void Disable() { Get().Disable(); } + public bool enabled => Get().enabled; + public static implicit operator InputActionMap(XRILeftHandLocomotionActions set) { return set.Get(); } + public void AddCallbacks(IXRILeftHandLocomotionActions instance) + { + if (instance == null || m_Wrapper.m_XRILeftHandLocomotionActionsCallbackInterfaces.Contains(instance)) return; + m_Wrapper.m_XRILeftHandLocomotionActionsCallbackInterfaces.Add(instance); + @TeleportSelect.started += instance.OnTeleportSelect; + @TeleportSelect.performed += instance.OnTeleportSelect; + @TeleportSelect.canceled += instance.OnTeleportSelect; + @TeleportModeActivate.started += instance.OnTeleportModeActivate; + @TeleportModeActivate.performed += instance.OnTeleportModeActivate; + @TeleportModeActivate.canceled += instance.OnTeleportModeActivate; + @TeleportModeCancel.started += instance.OnTeleportModeCancel; + @TeleportModeCancel.performed += instance.OnTeleportModeCancel; + @TeleportModeCancel.canceled += instance.OnTeleportModeCancel; + @TeleportDirection.started += instance.OnTeleportDirection; + @TeleportDirection.performed += instance.OnTeleportDirection; + @TeleportDirection.canceled += instance.OnTeleportDirection; + @Turn.started += instance.OnTurn; + @Turn.performed += instance.OnTurn; + @Turn.canceled += instance.OnTurn; + @Move.started += instance.OnMove; + @Move.performed += instance.OnMove; + @Move.canceled += instance.OnMove; + @GrabMove.started += instance.OnGrabMove; + @GrabMove.performed += instance.OnGrabMove; + @GrabMove.canceled += instance.OnGrabMove; + @SnapTurn.started += instance.OnSnapTurn; + @SnapTurn.performed += instance.OnSnapTurn; + @SnapTurn.canceled += instance.OnSnapTurn; + } + + private void UnregisterCallbacks(IXRILeftHandLocomotionActions instance) + { + @TeleportSelect.started -= instance.OnTeleportSelect; + @TeleportSelect.performed -= instance.OnTeleportSelect; + @TeleportSelect.canceled -= instance.OnTeleportSelect; + @TeleportModeActivate.started -= instance.OnTeleportModeActivate; + @TeleportModeActivate.performed -= instance.OnTeleportModeActivate; + @TeleportModeActivate.canceled -= instance.OnTeleportModeActivate; + @TeleportModeCancel.started -= instance.OnTeleportModeCancel; + @TeleportModeCancel.performed -= instance.OnTeleportModeCancel; + @TeleportModeCancel.canceled -= instance.OnTeleportModeCancel; + @TeleportDirection.started -= instance.OnTeleportDirection; + @TeleportDirection.performed -= instance.OnTeleportDirection; + @TeleportDirection.canceled -= instance.OnTeleportDirection; + @Turn.started -= instance.OnTurn; + @Turn.performed -= instance.OnTurn; + @Turn.canceled -= instance.OnTurn; + @Move.started -= instance.OnMove; + @Move.performed -= instance.OnMove; + @Move.canceled -= instance.OnMove; + @GrabMove.started -= instance.OnGrabMove; + @GrabMove.performed -= instance.OnGrabMove; + @GrabMove.canceled -= instance.OnGrabMove; + @SnapTurn.started -= instance.OnSnapTurn; + @SnapTurn.performed -= instance.OnSnapTurn; + @SnapTurn.canceled -= instance.OnSnapTurn; + } + + public void RemoveCallbacks(IXRILeftHandLocomotionActions instance) + { + if (m_Wrapper.m_XRILeftHandLocomotionActionsCallbackInterfaces.Remove(instance)) + UnregisterCallbacks(instance); + } + + public void SetCallbacks(IXRILeftHandLocomotionActions instance) + { + foreach (var item in m_Wrapper.m_XRILeftHandLocomotionActionsCallbackInterfaces) + UnregisterCallbacks(item); + m_Wrapper.m_XRILeftHandLocomotionActionsCallbackInterfaces.Clear(); + AddCallbacks(instance); + } + } + public XRILeftHandLocomotionActions @XRILeftHandLocomotion => new XRILeftHandLocomotionActions(this); + + // XRI RightHand + private readonly InputActionMap m_XRIRightHand; + private List m_XRIRightHandActionsCallbackInterfaces = new List(); + private readonly InputAction m_XRIRightHand_Position; + private readonly InputAction m_XRIRightHand_Rotation; + private readonly InputAction m_XRIRightHand_IsTracked; + private readonly InputAction m_XRIRightHand_TrackingState; + private readonly InputAction m_XRIRightHand_HapticDevice; + private readonly InputAction m_XRIRightHand_AimPosition; + private readonly InputAction m_XRIRightHand_AimRotation; + private readonly InputAction m_XRIRightHand_AimFlags; + private readonly InputAction m_XRIRightHand_PinchPosition; + private readonly InputAction m_XRIRightHand_PokePosition; + private readonly InputAction m_XRIRightHand_PokeRotation; + public struct XRIRightHandActions + { + private @XRIDefaultInputActions m_Wrapper; + public XRIRightHandActions(@XRIDefaultInputActions wrapper) { m_Wrapper = wrapper; } + public InputAction @Position => m_Wrapper.m_XRIRightHand_Position; + public InputAction @Rotation => m_Wrapper.m_XRIRightHand_Rotation; + public InputAction @IsTracked => m_Wrapper.m_XRIRightHand_IsTracked; + public InputAction @TrackingState => m_Wrapper.m_XRIRightHand_TrackingState; + public InputAction @HapticDevice => m_Wrapper.m_XRIRightHand_HapticDevice; + public InputAction @AimPosition => m_Wrapper.m_XRIRightHand_AimPosition; + public InputAction @AimRotation => m_Wrapper.m_XRIRightHand_AimRotation; + public InputAction @AimFlags => m_Wrapper.m_XRIRightHand_AimFlags; + public InputAction @PinchPosition => m_Wrapper.m_XRIRightHand_PinchPosition; + public InputAction @PokePosition => m_Wrapper.m_XRIRightHand_PokePosition; + public InputAction @PokeRotation => m_Wrapper.m_XRIRightHand_PokeRotation; + public InputActionMap Get() { return m_Wrapper.m_XRIRightHand; } + public void Enable() { Get().Enable(); } + public void Disable() { Get().Disable(); } + public bool enabled => Get().enabled; + public static implicit operator InputActionMap(XRIRightHandActions set) { return set.Get(); } + public void AddCallbacks(IXRIRightHandActions instance) + { + if (instance == null || m_Wrapper.m_XRIRightHandActionsCallbackInterfaces.Contains(instance)) return; + m_Wrapper.m_XRIRightHandActionsCallbackInterfaces.Add(instance); + @Position.started += instance.OnPosition; + @Position.performed += instance.OnPosition; + @Position.canceled += instance.OnPosition; + @Rotation.started += instance.OnRotation; + @Rotation.performed += instance.OnRotation; + @Rotation.canceled += instance.OnRotation; + @IsTracked.started += instance.OnIsTracked; + @IsTracked.performed += instance.OnIsTracked; + @IsTracked.canceled += instance.OnIsTracked; + @TrackingState.started += instance.OnTrackingState; + @TrackingState.performed += instance.OnTrackingState; + @TrackingState.canceled += instance.OnTrackingState; + @HapticDevice.started += instance.OnHapticDevice; + @HapticDevice.performed += instance.OnHapticDevice; + @HapticDevice.canceled += instance.OnHapticDevice; + @AimPosition.started += instance.OnAimPosition; + @AimPosition.performed += instance.OnAimPosition; + @AimPosition.canceled += instance.OnAimPosition; + @AimRotation.started += instance.OnAimRotation; + @AimRotation.performed += instance.OnAimRotation; + @AimRotation.canceled += instance.OnAimRotation; + @AimFlags.started += instance.OnAimFlags; + @AimFlags.performed += instance.OnAimFlags; + @AimFlags.canceled += instance.OnAimFlags; + @PinchPosition.started += instance.OnPinchPosition; + @PinchPosition.performed += instance.OnPinchPosition; + @PinchPosition.canceled += instance.OnPinchPosition; + @PokePosition.started += instance.OnPokePosition; + @PokePosition.performed += instance.OnPokePosition; + @PokePosition.canceled += instance.OnPokePosition; + @PokeRotation.started += instance.OnPokeRotation; + @PokeRotation.performed += instance.OnPokeRotation; + @PokeRotation.canceled += instance.OnPokeRotation; + } + + private void UnregisterCallbacks(IXRIRightHandActions instance) + { + @Position.started -= instance.OnPosition; + @Position.performed -= instance.OnPosition; + @Position.canceled -= instance.OnPosition; + @Rotation.started -= instance.OnRotation; + @Rotation.performed -= instance.OnRotation; + @Rotation.canceled -= instance.OnRotation; + @IsTracked.started -= instance.OnIsTracked; + @IsTracked.performed -= instance.OnIsTracked; + @IsTracked.canceled -= instance.OnIsTracked; + @TrackingState.started -= instance.OnTrackingState; + @TrackingState.performed -= instance.OnTrackingState; + @TrackingState.canceled -= instance.OnTrackingState; + @HapticDevice.started -= instance.OnHapticDevice; + @HapticDevice.performed -= instance.OnHapticDevice; + @HapticDevice.canceled -= instance.OnHapticDevice; + @AimPosition.started -= instance.OnAimPosition; + @AimPosition.performed -= instance.OnAimPosition; + @AimPosition.canceled -= instance.OnAimPosition; + @AimRotation.started -= instance.OnAimRotation; + @AimRotation.performed -= instance.OnAimRotation; + @AimRotation.canceled -= instance.OnAimRotation; + @AimFlags.started -= instance.OnAimFlags; + @AimFlags.performed -= instance.OnAimFlags; + @AimFlags.canceled -= instance.OnAimFlags; + @PinchPosition.started -= instance.OnPinchPosition; + @PinchPosition.performed -= instance.OnPinchPosition; + @PinchPosition.canceled -= instance.OnPinchPosition; + @PokePosition.started -= instance.OnPokePosition; + @PokePosition.performed -= instance.OnPokePosition; + @PokePosition.canceled -= instance.OnPokePosition; + @PokeRotation.started -= instance.OnPokeRotation; + @PokeRotation.performed -= instance.OnPokeRotation; + @PokeRotation.canceled -= instance.OnPokeRotation; + } + + public void RemoveCallbacks(IXRIRightHandActions instance) + { + if (m_Wrapper.m_XRIRightHandActionsCallbackInterfaces.Remove(instance)) + UnregisterCallbacks(instance); + } + + public void SetCallbacks(IXRIRightHandActions instance) + { + foreach (var item in m_Wrapper.m_XRIRightHandActionsCallbackInterfaces) + UnregisterCallbacks(item); + m_Wrapper.m_XRIRightHandActionsCallbackInterfaces.Clear(); + AddCallbacks(instance); + } + } + public XRIRightHandActions @XRIRightHand => new XRIRightHandActions(this); + + // XRI RightHand Interaction + private readonly InputActionMap m_XRIRightHandInteraction; + private List m_XRIRightHandInteractionActionsCallbackInterfaces = new List(); + private readonly InputAction m_XRIRightHandInteraction_Select; + private readonly InputAction m_XRIRightHandInteraction_SelectValue; + private readonly InputAction m_XRIRightHandInteraction_Activate; + private readonly InputAction m_XRIRightHandInteraction_ActivateValue; + private readonly InputAction m_XRIRightHandInteraction_UIPress; + private readonly InputAction m_XRIRightHandInteraction_UIPressValue; + private readonly InputAction m_XRIRightHandInteraction_RotateAnchor; + private readonly InputAction m_XRIRightHandInteraction_TranslateAnchor; + public struct XRIRightHandInteractionActions + { + private @XRIDefaultInputActions m_Wrapper; + public XRIRightHandInteractionActions(@XRIDefaultInputActions wrapper) { m_Wrapper = wrapper; } + public InputAction @Select => m_Wrapper.m_XRIRightHandInteraction_Select; + public InputAction @SelectValue => m_Wrapper.m_XRIRightHandInteraction_SelectValue; + public InputAction @Activate => m_Wrapper.m_XRIRightHandInteraction_Activate; + public InputAction @ActivateValue => m_Wrapper.m_XRIRightHandInteraction_ActivateValue; + public InputAction @UIPress => m_Wrapper.m_XRIRightHandInteraction_UIPress; + public InputAction @UIPressValue => m_Wrapper.m_XRIRightHandInteraction_UIPressValue; + public InputAction @RotateAnchor => m_Wrapper.m_XRIRightHandInteraction_RotateAnchor; + public InputAction @TranslateAnchor => m_Wrapper.m_XRIRightHandInteraction_TranslateAnchor; + public InputActionMap Get() { return m_Wrapper.m_XRIRightHandInteraction; } + public void Enable() { Get().Enable(); } + public void Disable() { Get().Disable(); } + public bool enabled => Get().enabled; + public static implicit operator InputActionMap(XRIRightHandInteractionActions set) { return set.Get(); } + public void AddCallbacks(IXRIRightHandInteractionActions instance) + { + if (instance == null || m_Wrapper.m_XRIRightHandInteractionActionsCallbackInterfaces.Contains(instance)) return; + m_Wrapper.m_XRIRightHandInteractionActionsCallbackInterfaces.Add(instance); + @Select.started += instance.OnSelect; + @Select.performed += instance.OnSelect; + @Select.canceled += instance.OnSelect; + @SelectValue.started += instance.OnSelectValue; + @SelectValue.performed += instance.OnSelectValue; + @SelectValue.canceled += instance.OnSelectValue; + @Activate.started += instance.OnActivate; + @Activate.performed += instance.OnActivate; + @Activate.canceled += instance.OnActivate; + @ActivateValue.started += instance.OnActivateValue; + @ActivateValue.performed += instance.OnActivateValue; + @ActivateValue.canceled += instance.OnActivateValue; + @UIPress.started += instance.OnUIPress; + @UIPress.performed += instance.OnUIPress; + @UIPress.canceled += instance.OnUIPress; + @UIPressValue.started += instance.OnUIPressValue; + @UIPressValue.performed += instance.OnUIPressValue; + @UIPressValue.canceled += instance.OnUIPressValue; + @RotateAnchor.started += instance.OnRotateAnchor; + @RotateAnchor.performed += instance.OnRotateAnchor; + @RotateAnchor.canceled += instance.OnRotateAnchor; + @TranslateAnchor.started += instance.OnTranslateAnchor; + @TranslateAnchor.performed += instance.OnTranslateAnchor; + @TranslateAnchor.canceled += instance.OnTranslateAnchor; + } + + private void UnregisterCallbacks(IXRIRightHandInteractionActions instance) + { + @Select.started -= instance.OnSelect; + @Select.performed -= instance.OnSelect; + @Select.canceled -= instance.OnSelect; + @SelectValue.started -= instance.OnSelectValue; + @SelectValue.performed -= instance.OnSelectValue; + @SelectValue.canceled -= instance.OnSelectValue; + @Activate.started -= instance.OnActivate; + @Activate.performed -= instance.OnActivate; + @Activate.canceled -= instance.OnActivate; + @ActivateValue.started -= instance.OnActivateValue; + @ActivateValue.performed -= instance.OnActivateValue; + @ActivateValue.canceled -= instance.OnActivateValue; + @UIPress.started -= instance.OnUIPress; + @UIPress.performed -= instance.OnUIPress; + @UIPress.canceled -= instance.OnUIPress; + @UIPressValue.started -= instance.OnUIPressValue; + @UIPressValue.performed -= instance.OnUIPressValue; + @UIPressValue.canceled -= instance.OnUIPressValue; + @RotateAnchor.started -= instance.OnRotateAnchor; + @RotateAnchor.performed -= instance.OnRotateAnchor; + @RotateAnchor.canceled -= instance.OnRotateAnchor; + @TranslateAnchor.started -= instance.OnTranslateAnchor; + @TranslateAnchor.performed -= instance.OnTranslateAnchor; + @TranslateAnchor.canceled -= instance.OnTranslateAnchor; + } + + public void RemoveCallbacks(IXRIRightHandInteractionActions instance) + { + if (m_Wrapper.m_XRIRightHandInteractionActionsCallbackInterfaces.Remove(instance)) + UnregisterCallbacks(instance); + } + + public void SetCallbacks(IXRIRightHandInteractionActions instance) + { + foreach (var item in m_Wrapper.m_XRIRightHandInteractionActionsCallbackInterfaces) + UnregisterCallbacks(item); + m_Wrapper.m_XRIRightHandInteractionActionsCallbackInterfaces.Clear(); + AddCallbacks(instance); + } + } + public XRIRightHandInteractionActions @XRIRightHandInteraction => new XRIRightHandInteractionActions(this); + + // XRI RightHand Locomotion + private readonly InputActionMap m_XRIRightHandLocomotion; + private List m_XRIRightHandLocomotionActionsCallbackInterfaces = new List(); + private readonly InputAction m_XRIRightHandLocomotion_TeleportSelect; + private readonly InputAction m_XRIRightHandLocomotion_TeleportModeActivate; + private readonly InputAction m_XRIRightHandLocomotion_TeleportModeCancel; + private readonly InputAction m_XRIRightHandLocomotion_TeleportDirection; + private readonly InputAction m_XRIRightHandLocomotion_Turn; + private readonly InputAction m_XRIRightHandLocomotion_Move; + private readonly InputAction m_XRIRightHandLocomotion_GrabMove; + private readonly InputAction m_XRIRightHandLocomotion_SnapTurn; + public struct XRIRightHandLocomotionActions + { + private @XRIDefaultInputActions m_Wrapper; + public XRIRightHandLocomotionActions(@XRIDefaultInputActions wrapper) { m_Wrapper = wrapper; } + public InputAction @TeleportSelect => m_Wrapper.m_XRIRightHandLocomotion_TeleportSelect; + public InputAction @TeleportModeActivate => m_Wrapper.m_XRIRightHandLocomotion_TeleportModeActivate; + public InputAction @TeleportModeCancel => m_Wrapper.m_XRIRightHandLocomotion_TeleportModeCancel; + public InputAction @TeleportDirection => m_Wrapper.m_XRIRightHandLocomotion_TeleportDirection; + public InputAction @Turn => m_Wrapper.m_XRIRightHandLocomotion_Turn; + public InputAction @Move => m_Wrapper.m_XRIRightHandLocomotion_Move; + public InputAction @GrabMove => m_Wrapper.m_XRIRightHandLocomotion_GrabMove; + public InputAction @SnapTurn => m_Wrapper.m_XRIRightHandLocomotion_SnapTurn; + public InputActionMap Get() { return m_Wrapper.m_XRIRightHandLocomotion; } + public void Enable() { Get().Enable(); } + public void Disable() { Get().Disable(); } + public bool enabled => Get().enabled; + public static implicit operator InputActionMap(XRIRightHandLocomotionActions set) { return set.Get(); } + public void AddCallbacks(IXRIRightHandLocomotionActions instance) + { + if (instance == null || m_Wrapper.m_XRIRightHandLocomotionActionsCallbackInterfaces.Contains(instance)) return; + m_Wrapper.m_XRIRightHandLocomotionActionsCallbackInterfaces.Add(instance); + @TeleportSelect.started += instance.OnTeleportSelect; + @TeleportSelect.performed += instance.OnTeleportSelect; + @TeleportSelect.canceled += instance.OnTeleportSelect; + @TeleportModeActivate.started += instance.OnTeleportModeActivate; + @TeleportModeActivate.performed += instance.OnTeleportModeActivate; + @TeleportModeActivate.canceled += instance.OnTeleportModeActivate; + @TeleportModeCancel.started += instance.OnTeleportModeCancel; + @TeleportModeCancel.performed += instance.OnTeleportModeCancel; + @TeleportModeCancel.canceled += instance.OnTeleportModeCancel; + @TeleportDirection.started += instance.OnTeleportDirection; + @TeleportDirection.performed += instance.OnTeleportDirection; + @TeleportDirection.canceled += instance.OnTeleportDirection; + @Turn.started += instance.OnTurn; + @Turn.performed += instance.OnTurn; + @Turn.canceled += instance.OnTurn; + @Move.started += instance.OnMove; + @Move.performed += instance.OnMove; + @Move.canceled += instance.OnMove; + @GrabMove.started += instance.OnGrabMove; + @GrabMove.performed += instance.OnGrabMove; + @GrabMove.canceled += instance.OnGrabMove; + @SnapTurn.started += instance.OnSnapTurn; + @SnapTurn.performed += instance.OnSnapTurn; + @SnapTurn.canceled += instance.OnSnapTurn; + } + + private void UnregisterCallbacks(IXRIRightHandLocomotionActions instance) + { + @TeleportSelect.started -= instance.OnTeleportSelect; + @TeleportSelect.performed -= instance.OnTeleportSelect; + @TeleportSelect.canceled -= instance.OnTeleportSelect; + @TeleportModeActivate.started -= instance.OnTeleportModeActivate; + @TeleportModeActivate.performed -= instance.OnTeleportModeActivate; + @TeleportModeActivate.canceled -= instance.OnTeleportModeActivate; + @TeleportModeCancel.started -= instance.OnTeleportModeCancel; + @TeleportModeCancel.performed -= instance.OnTeleportModeCancel; + @TeleportModeCancel.canceled -= instance.OnTeleportModeCancel; + @TeleportDirection.started -= instance.OnTeleportDirection; + @TeleportDirection.performed -= instance.OnTeleportDirection; + @TeleportDirection.canceled -= instance.OnTeleportDirection; + @Turn.started -= instance.OnTurn; + @Turn.performed -= instance.OnTurn; + @Turn.canceled -= instance.OnTurn; + @Move.started -= instance.OnMove; + @Move.performed -= instance.OnMove; + @Move.canceled -= instance.OnMove; + @GrabMove.started -= instance.OnGrabMove; + @GrabMove.performed -= instance.OnGrabMove; + @GrabMove.canceled -= instance.OnGrabMove; + @SnapTurn.started -= instance.OnSnapTurn; + @SnapTurn.performed -= instance.OnSnapTurn; + @SnapTurn.canceled -= instance.OnSnapTurn; + } + + public void RemoveCallbacks(IXRIRightHandLocomotionActions instance) + { + if (m_Wrapper.m_XRIRightHandLocomotionActionsCallbackInterfaces.Remove(instance)) + UnregisterCallbacks(instance); + } + + public void SetCallbacks(IXRIRightHandLocomotionActions instance) + { + foreach (var item in m_Wrapper.m_XRIRightHandLocomotionActionsCallbackInterfaces) + UnregisterCallbacks(item); + m_Wrapper.m_XRIRightHandLocomotionActionsCallbackInterfaces.Clear(); + AddCallbacks(instance); + } + } + public XRIRightHandLocomotionActions @XRIRightHandLocomotion => new XRIRightHandLocomotionActions(this); + + // XRI UI + private readonly InputActionMap m_XRIUI; + private List m_XRIUIActionsCallbackInterfaces = new List(); + private readonly InputAction m_XRIUI_Navigate; + private readonly InputAction m_XRIUI_Submit; + private readonly InputAction m_XRIUI_Cancel; + private readonly InputAction m_XRIUI_Point; + private readonly InputAction m_XRIUI_Click; + private readonly InputAction m_XRIUI_ScrollWheel; + private readonly InputAction m_XRIUI_MiddleClick; + private readonly InputAction m_XRIUI_RightClick; + public struct XRIUIActions + { + private @XRIDefaultInputActions m_Wrapper; + public XRIUIActions(@XRIDefaultInputActions wrapper) { m_Wrapper = wrapper; } + public InputAction @Navigate => m_Wrapper.m_XRIUI_Navigate; + public InputAction @Submit => m_Wrapper.m_XRIUI_Submit; + public InputAction @Cancel => m_Wrapper.m_XRIUI_Cancel; + public InputAction @Point => m_Wrapper.m_XRIUI_Point; + public InputAction @Click => m_Wrapper.m_XRIUI_Click; + public InputAction @ScrollWheel => m_Wrapper.m_XRIUI_ScrollWheel; + public InputAction @MiddleClick => m_Wrapper.m_XRIUI_MiddleClick; + public InputAction @RightClick => m_Wrapper.m_XRIUI_RightClick; + public InputActionMap Get() { return m_Wrapper.m_XRIUI; } + public void Enable() { Get().Enable(); } + public void Disable() { Get().Disable(); } + public bool enabled => Get().enabled; + public static implicit operator InputActionMap(XRIUIActions set) { return set.Get(); } + public void AddCallbacks(IXRIUIActions instance) + { + if (instance == null || m_Wrapper.m_XRIUIActionsCallbackInterfaces.Contains(instance)) return; + m_Wrapper.m_XRIUIActionsCallbackInterfaces.Add(instance); + @Navigate.started += instance.OnNavigate; + @Navigate.performed += instance.OnNavigate; + @Navigate.canceled += instance.OnNavigate; + @Submit.started += instance.OnSubmit; + @Submit.performed += instance.OnSubmit; + @Submit.canceled += instance.OnSubmit; + @Cancel.started += instance.OnCancel; + @Cancel.performed += instance.OnCancel; + @Cancel.canceled += instance.OnCancel; + @Point.started += instance.OnPoint; + @Point.performed += instance.OnPoint; + @Point.canceled += instance.OnPoint; + @Click.started += instance.OnClick; + @Click.performed += instance.OnClick; + @Click.canceled += instance.OnClick; + @ScrollWheel.started += instance.OnScrollWheel; + @ScrollWheel.performed += instance.OnScrollWheel; + @ScrollWheel.canceled += instance.OnScrollWheel; + @MiddleClick.started += instance.OnMiddleClick; + @MiddleClick.performed += instance.OnMiddleClick; + @MiddleClick.canceled += instance.OnMiddleClick; + @RightClick.started += instance.OnRightClick; + @RightClick.performed += instance.OnRightClick; + @RightClick.canceled += instance.OnRightClick; + } + + private void UnregisterCallbacks(IXRIUIActions instance) + { + @Navigate.started -= instance.OnNavigate; + @Navigate.performed -= instance.OnNavigate; + @Navigate.canceled -= instance.OnNavigate; + @Submit.started -= instance.OnSubmit; + @Submit.performed -= instance.OnSubmit; + @Submit.canceled -= instance.OnSubmit; + @Cancel.started -= instance.OnCancel; + @Cancel.performed -= instance.OnCancel; + @Cancel.canceled -= instance.OnCancel; + @Point.started -= instance.OnPoint; + @Point.performed -= instance.OnPoint; + @Point.canceled -= instance.OnPoint; + @Click.started -= instance.OnClick; + @Click.performed -= instance.OnClick; + @Click.canceled -= instance.OnClick; + @ScrollWheel.started -= instance.OnScrollWheel; + @ScrollWheel.performed -= instance.OnScrollWheel; + @ScrollWheel.canceled -= instance.OnScrollWheel; + @MiddleClick.started -= instance.OnMiddleClick; + @MiddleClick.performed -= instance.OnMiddleClick; + @MiddleClick.canceled -= instance.OnMiddleClick; + @RightClick.started -= instance.OnRightClick; + @RightClick.performed -= instance.OnRightClick; + @RightClick.canceled -= instance.OnRightClick; + } + + public void RemoveCallbacks(IXRIUIActions instance) + { + if (m_Wrapper.m_XRIUIActionsCallbackInterfaces.Remove(instance)) + UnregisterCallbacks(instance); + } + + public void SetCallbacks(IXRIUIActions instance) + { + foreach (var item in m_Wrapper.m_XRIUIActionsCallbackInterfaces) + UnregisterCallbacks(item); + m_Wrapper.m_XRIUIActionsCallbackInterfaces.Clear(); + AddCallbacks(instance); + } + } + public XRIUIActions @XRIUI => new XRIUIActions(this); + private int m_GenericXRControllerSchemeIndex = -1; + public InputControlScheme GenericXRControllerScheme + { + get + { + if (m_GenericXRControllerSchemeIndex == -1) m_GenericXRControllerSchemeIndex = asset.FindControlSchemeIndex("Generic XR Controller"); + return asset.controlSchemes[m_GenericXRControllerSchemeIndex]; + } + } + private int m_ContinuousMoveSchemeIndex = -1; + public InputControlScheme ContinuousMoveScheme + { + get + { + if (m_ContinuousMoveSchemeIndex == -1) m_ContinuousMoveSchemeIndex = asset.FindControlSchemeIndex("Continuous Move"); + return asset.controlSchemes[m_ContinuousMoveSchemeIndex]; + } + } + private int m_NoncontinuousMoveSchemeIndex = -1; + public InputControlScheme NoncontinuousMoveScheme + { + get + { + if (m_NoncontinuousMoveSchemeIndex == -1) m_NoncontinuousMoveSchemeIndex = asset.FindControlSchemeIndex("Noncontinuous Move"); + return asset.controlSchemes[m_NoncontinuousMoveSchemeIndex]; + } + } + public interface IXRIHeadActions + { + void OnPosition(InputAction.CallbackContext context); + void OnRotation(InputAction.CallbackContext context); + void OnIsTracked(InputAction.CallbackContext context); + void OnTrackingState(InputAction.CallbackContext context); + void OnEyeGazePosition(InputAction.CallbackContext context); + void OnEyeGazeRotation(InputAction.CallbackContext context); + void OnEyeGazeTrackingState(InputAction.CallbackContext context); + } + public interface IXRILeftHandActions + { + void OnPosition(InputAction.CallbackContext context); + void OnRotation(InputAction.CallbackContext context); + void OnIsTracked(InputAction.CallbackContext context); + void OnTrackingState(InputAction.CallbackContext context); + void OnHapticDevice(InputAction.CallbackContext context); + void OnAimPosition(InputAction.CallbackContext context); + void OnAimRotation(InputAction.CallbackContext context); + void OnAimFlags(InputAction.CallbackContext context); + void OnPinchPosition(InputAction.CallbackContext context); + void OnPokePosition(InputAction.CallbackContext context); + void OnPokeRotation(InputAction.CallbackContext context); + } + public interface IXRILeftHandInteractionActions + { + void OnSelect(InputAction.CallbackContext context); + void OnSelectValue(InputAction.CallbackContext context); + void OnActivate(InputAction.CallbackContext context); + void OnActivateValue(InputAction.CallbackContext context); + void OnUIPress(InputAction.CallbackContext context); + void OnUIPressValue(InputAction.CallbackContext context); + void OnRotateAnchor(InputAction.CallbackContext context); + void OnTranslateAnchor(InputAction.CallbackContext context); + } + public interface IXRILeftHandLocomotionActions + { + void OnTeleportSelect(InputAction.CallbackContext context); + void OnTeleportModeActivate(InputAction.CallbackContext context); + void OnTeleportModeCancel(InputAction.CallbackContext context); + void OnTeleportDirection(InputAction.CallbackContext context); + void OnTurn(InputAction.CallbackContext context); + void OnMove(InputAction.CallbackContext context); + void OnGrabMove(InputAction.CallbackContext context); + void OnSnapTurn(InputAction.CallbackContext context); + } + public interface IXRIRightHandActions + { + void OnPosition(InputAction.CallbackContext context); + void OnRotation(InputAction.CallbackContext context); + void OnIsTracked(InputAction.CallbackContext context); + void OnTrackingState(InputAction.CallbackContext context); + void OnHapticDevice(InputAction.CallbackContext context); + void OnAimPosition(InputAction.CallbackContext context); + void OnAimRotation(InputAction.CallbackContext context); + void OnAimFlags(InputAction.CallbackContext context); + void OnPinchPosition(InputAction.CallbackContext context); + void OnPokePosition(InputAction.CallbackContext context); + void OnPokeRotation(InputAction.CallbackContext context); + } + public interface IXRIRightHandInteractionActions + { + void OnSelect(InputAction.CallbackContext context); + void OnSelectValue(InputAction.CallbackContext context); + void OnActivate(InputAction.CallbackContext context); + void OnActivateValue(InputAction.CallbackContext context); + void OnUIPress(InputAction.CallbackContext context); + void OnUIPressValue(InputAction.CallbackContext context); + void OnRotateAnchor(InputAction.CallbackContext context); + void OnTranslateAnchor(InputAction.CallbackContext context); + } + public interface IXRIRightHandLocomotionActions + { + void OnTeleportSelect(InputAction.CallbackContext context); + void OnTeleportModeActivate(InputAction.CallbackContext context); + void OnTeleportModeCancel(InputAction.CallbackContext context); + void OnTeleportDirection(InputAction.CallbackContext context); + void OnTurn(InputAction.CallbackContext context); + void OnMove(InputAction.CallbackContext context); + void OnGrabMove(InputAction.CallbackContext context); + void OnSnapTurn(InputAction.CallbackContext context); + } + public interface IXRIUIActions + { + void OnNavigate(InputAction.CallbackContext context); + void OnSubmit(InputAction.CallbackContext context); + void OnCancel(InputAction.CallbackContext context); + void OnPoint(InputAction.CallbackContext context); + void OnClick(InputAction.CallbackContext context); + void OnScrollWheel(InputAction.CallbackContext context); + void OnMiddleClick(InputAction.CallbackContext context); + void OnRightClick(InputAction.CallbackContext context); + } +} diff --git a/Assets/Samples/XR Interaction Toolkit/2.3.2/Starter Assets/XRI Default Input Actions.cs.meta b/Assets/Samples/XR Interaction Toolkit/2.3.2/Starter Assets/XRI Default Input Actions.cs.meta new file mode 100644 index 0000000..9a0f814 --- /dev/null +++ b/Assets/Samples/XR Interaction Toolkit/2.3.2/Starter Assets/XRI Default Input Actions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 57981e5b8f05aad40908f67ad9f2edae +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Samples/XR Interaction Toolkit/2.3.2/Starter Assets/XRI Default Input Actions.inputactions.meta b/Assets/Samples/XR Interaction Toolkit/2.3.2/Starter Assets/XRI Default Input Actions.inputactions.meta index ade0a19..d1179a1 100644 --- a/Assets/Samples/XR Interaction Toolkit/2.3.2/Starter Assets/XRI Default Input Actions.inputactions.meta +++ b/Assets/Samples/XR Interaction Toolkit/2.3.2/Starter Assets/XRI Default Input Actions.inputactions.meta @@ -8,7 +8,7 @@ ScriptedImporter: assetBundleName: assetBundleVariant: script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3} - generateWrapperCode: 0 + generateWrapperCode: 1 wrapperCodePath: wrapperClassName: wrapperCodeNamespace: diff --git a/qodana.yaml b/qodana.yaml new file mode 100644 index 0000000..8bddd26 --- /dev/null +++ b/qodana.yaml @@ -0,0 +1,26 @@ +#-------------------------------------------------------------------------------# +# Qodana analysis is configured by qodana.yaml file # +# https://www.jetbrains.com/help/qodana/qodana-yaml.html # +#-------------------------------------------------------------------------------# +version: "1.0" + +#Specify inspection profile for code analysis +profile: + name: qodana.starter + +#Enable inspections +#include: +# - name: + +#Disable inspections +#exclude: +# - name: +# paths: +# - + +#Execute shell command before Qodana execution (not applied in IDE run) +#bootstrap: sh ./prepare-qodana.sh + +#Install IDE plugins before Qodana execution (not applied in IDE run) +#plugins: +# - id: #(plugin id can be found at https://plugins.jetbrains.com)