Compare commits
39
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7bc15cc03d | ||
|
|
d861e06caf | ||
|
|
f940cbffe0 | ||
|
|
6b1f24b72e | ||
|
|
1ad87e7432 | ||
|
|
09219d9091 | ||
|
|
37f5d15410 | ||
|
|
019da8cfd3 | ||
|
|
edf3821c0d | ||
|
|
45fe19be24 | ||
|
|
bea109175b | ||
|
|
b214bb0f63 | ||
|
|
0ac5ba1e1c | ||
|
|
ab9d444072 | ||
|
|
2335908a90 | ||
|
|
ae76edb0d0 | ||
|
|
6f2b063700 | ||
|
|
c6d1c3bffd | ||
|
|
07ce27618c | ||
|
|
fb85b22e96 | ||
|
|
665114b7dc | ||
|
|
4549617275 | ||
|
|
db541fed8a | ||
|
|
085429d5ca | ||
|
|
981d081bed | ||
|
|
6148889fc1 | ||
|
|
7538ce81af | ||
|
|
a198d7fc00 | ||
|
|
7114f1136c | ||
|
|
5bf468673f | ||
|
|
9a3743988d | ||
|
|
e6879076a3 | ||
|
|
487331dc10 | ||
|
|
bada54c828 | ||
|
|
ff095526bd | ||
|
|
ee7771acd9 | ||
|
|
bd0cee77a6 | ||
|
|
8981457f2d | ||
|
|
86c9c126a6 |
No files matched your search
Generated
+13
@@ -0,0 +1,13 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Rider ignored files
|
||||||
|
/contentModel.xml
|
||||||
|
/projectSettingsUpdater.xml
|
||||||
|
/modules.xml
|
||||||
|
/.idea.CourierOldRe.iml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
Generated
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="UserContentModel">
|
||||||
|
<attachedFolders />
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 65cf716f111fb36a19123f807ecdce25
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: dea69d41f90c6ea4fa55c27c1d60c145, type: 3}
|
||||||
|
m_Name: AddressableAssetGroupSortSettings
|
||||||
|
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.GroupSchemas.AddressableAssetGroupSortSettings
|
||||||
|
sortOrder:
|
||||||
|
- d447fc60305c17a17bf20948ab295a45
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 88c15d5f41d582974a9b7218c493e4a7
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 468a46d0ae32c3544b7d98094e6448a9, type: 3}
|
||||||
|
m_Name: AddressableAssetSettings
|
||||||
|
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.AddressableAssetSettings
|
||||||
|
m_DefaultGroup: d447fc60305c17a17bf20948ab295a45
|
||||||
|
m_currentHash:
|
||||||
|
serializedVersion: 2
|
||||||
|
Hash: 90c715b85c1e0904b3dc61a9ed460206
|
||||||
|
m_OptimizeCatalogSize: 0
|
||||||
|
m_BuildRemoteCatalog: 0
|
||||||
|
m_CatalogRequestsTimeout: 0
|
||||||
|
m_DisableCatalogUpdateOnStart: 0
|
||||||
|
m_InternalIdNamingMode: 0
|
||||||
|
m_InternalBundleIdMode: 1
|
||||||
|
m_AssetLoadMode: 0
|
||||||
|
m_BundledAssetProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider
|
||||||
|
m_AssetBundleProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider
|
||||||
|
m_IgnoreUnsupportedFilesInBuild: 0
|
||||||
|
m_UniqueBundleIds: 0
|
||||||
|
m_EnableJsonCatalog: 0
|
||||||
|
m_NonRecursiveBuilding: 1
|
||||||
|
m_AllowNestedBundleFolders: 0
|
||||||
|
m_CCDEnabled: 0
|
||||||
|
m_maxConcurrentWebRequests: 3
|
||||||
|
m_UseUWRForLocalBundles: 0
|
||||||
|
m_BundleTimeout: 0
|
||||||
|
m_BundleRetryCount: 0
|
||||||
|
m_BundleRedirectLimit: -1
|
||||||
|
m_SharedBundleSettings: 0
|
||||||
|
m_SharedBundleSettingsCustomGroupIndex: 0
|
||||||
|
m_ContiguousBundles: 1
|
||||||
|
m_StripUnityVersionFromBundleBuild: 0
|
||||||
|
m_DisableVisibleSubAssetRepresentations: 0
|
||||||
|
m_BuiltInBundleNaming: 0
|
||||||
|
mBuiltInBundleCustomNaming:
|
||||||
|
m_MonoScriptBundleNaming: 0
|
||||||
|
m_CheckForContentUpdateRestrictionsOption: 0
|
||||||
|
m_MonoScriptBundleCustomNaming:
|
||||||
|
m_RemoteCatalogBuildPath:
|
||||||
|
m_Id:
|
||||||
|
m_RemoteCatalogLoadPath:
|
||||||
|
m_Id:
|
||||||
|
m_ContentStateBuildPathProfileVariableName: <default settings path>
|
||||||
|
m_CustomContentStateBuildPath:
|
||||||
|
m_ContentStateBuildPath:
|
||||||
|
m_BuildAddressablesWithPlayerBuild: 0
|
||||||
|
m_overridePlayerVersion: '[UnityEditor.PlayerSettings.bundleVersion]'
|
||||||
|
m_GroupAssets:
|
||||||
|
- {fileID: 11400000, guid: 7c592a6445170e8379910601b962cb30, type: 2}
|
||||||
|
m_BuildSettings:
|
||||||
|
m_LogResourceManagerExceptions: 1
|
||||||
|
m_BundleBuildPath: Temp/com.unity.addressables/AssetBundles
|
||||||
|
m_ProfileSettings:
|
||||||
|
m_Profiles:
|
||||||
|
- m_InheritedParent:
|
||||||
|
m_Id: 27da1d7d9f959ba49a362cf69a3fd39a
|
||||||
|
m_ProfileName: Default
|
||||||
|
m_Values:
|
||||||
|
- m_Id: 1c16dd3f2d89b2375b66c8f065c7a694
|
||||||
|
m_Value: '[UnityEditor.EditorUserBuildSettings.activeBuildTarget]'
|
||||||
|
- m_Id: 3dfc1a15d30236e7a8856b2164e14280
|
||||||
|
m_Value: '[UnityEngine.AddressableAssets.Addressables.BuildPath]/[BuildTarget]'
|
||||||
|
- m_Id: 6c794a757c731a0319b43709731ad88b
|
||||||
|
m_Value: '{UnityEngine.AddressableAssets.Addressables.RuntimePath}/[BuildTarget]'
|
||||||
|
- m_Id: 74b04ebc3f202c2f9b6f1e8fb0470bd2
|
||||||
|
m_Value: 'ServerData/[BuildTarget]'
|
||||||
|
- m_Id: 9ccf5e6cc7ba2d421a1c573d8a7ebcd7
|
||||||
|
m_Value: <undefined>
|
||||||
|
m_ProfileEntryNames:
|
||||||
|
- m_Id: 1c16dd3f2d89b2375b66c8f065c7a694
|
||||||
|
m_Name: BuildTarget
|
||||||
|
m_InlineUsage: 0
|
||||||
|
- m_Id: 3dfc1a15d30236e7a8856b2164e14280
|
||||||
|
m_Name: Local.BuildPath
|
||||||
|
m_InlineUsage: 0
|
||||||
|
- m_Id: 6c794a757c731a0319b43709731ad88b
|
||||||
|
m_Name: Local.LoadPath
|
||||||
|
m_InlineUsage: 0
|
||||||
|
- m_Id: 74b04ebc3f202c2f9b6f1e8fb0470bd2
|
||||||
|
m_Name: Remote.BuildPath
|
||||||
|
m_InlineUsage: 0
|
||||||
|
- m_Id: 9ccf5e6cc7ba2d421a1c573d8a7ebcd7
|
||||||
|
m_Name: Remote.LoadPath
|
||||||
|
m_InlineUsage: 0
|
||||||
|
m_ProfileVersion: 1
|
||||||
|
m_LabelTable:
|
||||||
|
m_LabelNames:
|
||||||
|
- default
|
||||||
|
m_SchemaTemplates: []
|
||||||
|
m_GroupTemplateObjects:
|
||||||
|
- {fileID: 11400000, guid: 14909e654d6c7bd958ff44091773bd40, type: 2}
|
||||||
|
m_InitializationObjects: []
|
||||||
|
m_CertificateHandlerType:
|
||||||
|
m_AssemblyName:
|
||||||
|
m_ClassName:
|
||||||
|
m_ActivePlayerDataBuilderIndex: 2
|
||||||
|
m_DataBuilders:
|
||||||
|
- {fileID: 11400000, guid: 1ac723026a19cb90d8d5dd77ce8c384b, type: 2}
|
||||||
|
- {fileID: 11400000, guid: e628a9e942e45e1ca94ad90d02e9acdf, type: 2}
|
||||||
|
- {fileID: 11400000, guid: 1d3143f4a67a990fc9532b22a020137d, type: 2}
|
||||||
|
m_ActiveProfileId: 27da1d7d9f959ba49a362cf69a3fd39a
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2588e84eb64800d0781c574a37fa48d8
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1ac379942ee61a312a9830cb792d2871
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 1a3c5d64ac83548c09dd1678b9f6f1cd, type: 3}
|
||||||
|
m_Name: Packed Assets
|
||||||
|
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.AddressableAssetGroupTemplate
|
||||||
|
m_SchemaObjects:
|
||||||
|
- {fileID: 8850813396489121111}
|
||||||
|
- {fileID: 3451013361182384685}
|
||||||
|
m_Description: Pack assets into asset bundles.
|
||||||
|
m_Settings: {fileID: 11400000, guid: 2588e84eb64800d0781c574a37fa48d8, type: 2}
|
||||||
|
--- !u!114 &3451013361182384685
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 5834b5087d578d24c926ce20cd31e6d6, type: 3}
|
||||||
|
m_Name: ContentUpdateGroupSchema
|
||||||
|
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.GroupSchemas.ContentUpdateGroupSchema
|
||||||
|
m_Group: {fileID: 0}
|
||||||
|
m_StaticContent: 0
|
||||||
|
--- !u!114 &8850813396489121111
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: e5d17a21594effb4e9591490b009e7aa, type: 3}
|
||||||
|
m_Name: BundledAssetGroupSchema
|
||||||
|
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.GroupSchemas.BundledAssetGroupSchema
|
||||||
|
m_Group: {fileID: 0}
|
||||||
|
m_InternalBundleIdMode: 1
|
||||||
|
m_Compression: 1
|
||||||
|
m_IncludeAddressInCatalog: 1
|
||||||
|
m_IncludeGUIDInCatalog: 1
|
||||||
|
m_IncludeLabelsInCatalog: 1
|
||||||
|
m_InternalIdNamingMode: 0
|
||||||
|
m_CacheClearBehavior: 0
|
||||||
|
m_IncludeInBuild: 1
|
||||||
|
m_BundledAssetProviderType:
|
||||||
|
m_AssemblyName:
|
||||||
|
m_ClassName:
|
||||||
|
m_StripDownloadOptions: 0
|
||||||
|
m_ForceUniqueProvider: 0
|
||||||
|
m_UseAssetBundleCache: 1
|
||||||
|
m_UseAssetBundleCrc: 1
|
||||||
|
m_UseAssetBundleCrcForCachedBundles: 1
|
||||||
|
m_UseUWRForLocalBundles: 0
|
||||||
|
m_Timeout: 0
|
||||||
|
m_ChunkedTransfer: 0
|
||||||
|
m_RedirectLimit: -1
|
||||||
|
m_RetryCount: 0
|
||||||
|
m_BuildPath:
|
||||||
|
m_Id:
|
||||||
|
m_LoadPath:
|
||||||
|
m_Id:
|
||||||
|
m_BundleMode: 0
|
||||||
|
m_AssetBundleProviderType:
|
||||||
|
m_AssemblyName:
|
||||||
|
m_ClassName:
|
||||||
|
m_UseDefaultSchemaSettings: 0
|
||||||
|
m_SelectedPathPairIndex: 0
|
||||||
|
m_BundleNaming: 0
|
||||||
|
m_AssetLoadMode: 0
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 14909e654d6c7bd958ff44091773bd40
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a39981dbe6de5001397f5ca9a8a37e1a
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: bbb281ee3bf0b054c82ac2347e9e782c, type: 3}
|
||||||
|
m_Name: Default Local Group
|
||||||
|
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.AddressableAssetGroup
|
||||||
|
m_GroupName: Default Local Group
|
||||||
|
m_GUID: d447fc60305c17a17bf20948ab295a45
|
||||||
|
m_SerializeEntries:
|
||||||
|
- m_GUID: 23e11d2c8a4f12f4ea9a7a43d1118464
|
||||||
|
m_Address: Gameplay
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 48aebfe8826dc0df79d047b5afbf8f5b
|
||||||
|
m_Address: Canvas
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: b2e8dc2aeb0311cd8a826b51cf8e94dc
|
||||||
|
m_Address: GameOver
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: c566fc932edefbbee9e53271eac3c560
|
||||||
|
m_Address: MainMenu
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: f23b9fce9594618e5b75845f1cae50de
|
||||||
|
m_Address: LoadingScreen
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels: []
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_Settings: {fileID: 11400000, guid: 2588e84eb64800d0781c574a37fa48d8, type: 2}
|
||||||
|
m_SchemaSet:
|
||||||
|
m_Schemas:
|
||||||
|
- {fileID: 11400000, guid: 75ffac7db08d9615c994048949431551, type: 2}
|
||||||
|
- {fileID: 11400000, guid: 6d6fed27b8c8a3eebb9bc5289b7a6956, type: 2}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7c592a6445170e8379910601b962cb30
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 25c8e3b4ddb778a6d84ae525564a7ee1
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
+48
@@ -0,0 +1,48 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: e5d17a21594effb4e9591490b009e7aa, type: 3}
|
||||||
|
m_Name: Default Local Group_BundledAssetGroupSchema
|
||||||
|
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.GroupSchemas.BundledAssetGroupSchema
|
||||||
|
m_Group: {fileID: 11400000, guid: 7c592a6445170e8379910601b962cb30, type: 2}
|
||||||
|
m_InternalBundleIdMode: 1
|
||||||
|
m_Compression: 1
|
||||||
|
m_IncludeAddressInCatalog: 1
|
||||||
|
m_IncludeGUIDInCatalog: 1
|
||||||
|
m_IncludeLabelsInCatalog: 1
|
||||||
|
m_InternalIdNamingMode: 0
|
||||||
|
m_CacheClearBehavior: 0
|
||||||
|
m_IncludeInBuild: 1
|
||||||
|
m_BundledAssetProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider
|
||||||
|
m_StripDownloadOptions: 0
|
||||||
|
m_ForceUniqueProvider: 0
|
||||||
|
m_UseAssetBundleCache: 1
|
||||||
|
m_UseAssetBundleCrc: 1
|
||||||
|
m_UseAssetBundleCrcForCachedBundles: 1
|
||||||
|
m_UseUWRForLocalBundles: 0
|
||||||
|
m_Timeout: 0
|
||||||
|
m_ChunkedTransfer: 0
|
||||||
|
m_RedirectLimit: -1
|
||||||
|
m_RetryCount: 0
|
||||||
|
m_BuildPath:
|
||||||
|
m_Id: 3dfc1a15d30236e7a8856b2164e14280
|
||||||
|
m_LoadPath:
|
||||||
|
m_Id: 6c794a757c731a0319b43709731ad88b
|
||||||
|
m_BundleMode: 0
|
||||||
|
m_AssetBundleProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider
|
||||||
|
m_UseDefaultSchemaSettings: 0
|
||||||
|
m_SelectedPathPairIndex: 0
|
||||||
|
m_BundleNaming: 0
|
||||||
|
m_AssetLoadMode: 0
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 75ffac7db08d9615c994048949431551
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 5834b5087d578d24c926ce20cd31e6d6, type: 3}
|
||||||
|
m_Name: Default Local Group_ContentUpdateGroupSchema
|
||||||
|
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.GroupSchemas.ContentUpdateGroupSchema
|
||||||
|
m_Group: {fileID: 11400000, guid: 7c592a6445170e8379910601b962cb30, type: 2}
|
||||||
|
m_StaticContent: 0
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6d6fed27b8c8a3eebb9bc5289b7a6956
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d870ba11c395ba2d6b17a441e8e68cef
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 88d21199f5d473f4db36845f2318f180, type: 3}
|
||||||
|
m_Name: BuildScriptFastMode
|
||||||
|
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptFastMode
|
||||||
|
instanceProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.InstanceProvider
|
||||||
|
sceneProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1ac723026a19cb90d8d5dd77ce8c384b
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 3e2e0ffa088c91d41a086d0b8cb16bdc, type: 3}
|
||||||
|
m_Name: BuildScriptPackedMode
|
||||||
|
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptPackedMode
|
||||||
|
instanceProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.InstanceProvider
|
||||||
|
sceneProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1d3143f4a67a990fc9532b22a020137d
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: ad8c280d42ee0ed41a27db23b43dd2bf, type: 3}
|
||||||
|
m_Name: BuildScriptPackedPlayMode
|
||||||
|
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptPackedPlayMode
|
||||||
|
instanceProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.InstanceProvider
|
||||||
|
sceneProviderType:
|
||||||
|
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e628a9e942e45e1ca94ad90d02e9acdf
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 3a189bb168d8d90478a09ea08c2f3d72, type: 3}
|
||||||
|
m_Name: DefaultObject
|
||||||
|
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.AddressableAssetSettingsDefaultObject
|
||||||
|
m_AddressableAssetSettingsGuid: 2588e84eb64800d0781c574a37fa48d8
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9338e51d1f2239ddbb8f2c6232a2b678
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Code.App.StateMachine;
|
||||||
|
using Code.StateMachine;
|
||||||
|
|
||||||
|
namespace Code.App.AppStates
|
||||||
|
{
|
||||||
|
public class BootstrapState : BaseState<AppStateMachineContext>
|
||||||
|
{
|
||||||
|
public BootstrapState(AppStateMachineContext context) : base(context)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0183e73a08c64332babded3df3d06b95
|
||||||
|
timeCreated: 1762122962
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
using Code.App.StateMachine;
|
using Code.App.StateMachine;
|
||||||
|
using Code.Scenes;
|
||||||
using Code.StateMachine;
|
using Code.StateMachine;
|
||||||
|
using Code.UI;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Code.App.AppStates
|
namespace Code.App.AppStates
|
||||||
{
|
{
|
||||||
@@ -7,17 +10,32 @@ namespace Code.App.AppStates
|
|||||||
{
|
{
|
||||||
public GameOverState(AppStateMachineContext context) : base(context)
|
public GameOverState(AppStateMachineContext context) : base(context)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
private float damnTimer = 3f; // TODO Удалить при первой возможности
|
||||||
|
|
||||||
public override void EnterState()
|
public override void EnterState()
|
||||||
{
|
{
|
||||||
|
Context.UIService.SwitchPanelTo(UIPanel.GameOver);
|
||||||
|
|
||||||
base.EnterState();
|
base.EnterState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ToMainMenu()
|
||||||
|
{
|
||||||
|
Context.StateMachine.SwitchState(AppState.MainMenu)
|
||||||
|
.AllowStateTransition(AppState.Gameplay);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Tick()
|
public override void Tick()
|
||||||
{ }
|
{
|
||||||
|
damnTimer -= Time.deltaTime;
|
||||||
|
if (damnTimer <= float.Epsilon) ToMainMenu();
|
||||||
|
}
|
||||||
public override void ExitState()
|
public override void ExitState()
|
||||||
{
|
{
|
||||||
|
damnTimer = 5f;
|
||||||
|
|
||||||
|
Context.UIService.LoadingScreen.Show();
|
||||||
base.ExitState();
|
base.ExitState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +1,115 @@
|
|||||||
using Code.App.StateMachine;
|
using Code.App.StateMachine;
|
||||||
|
using Code.Gameplay.Camera;
|
||||||
|
using Code.Gameplay.Player;
|
||||||
using Code.Input;
|
using Code.Input;
|
||||||
using Code.Scenes;
|
using Code.Scenes;
|
||||||
using Code.StateMachine;
|
using Code.StateMachine;
|
||||||
using UnityEngine;
|
using Code.UI;
|
||||||
|
using UnityEngine.InputSystem;
|
||||||
|
|
||||||
namespace Code.App.AppStates
|
namespace Code.App.AppStates
|
||||||
{
|
{
|
||||||
public class GameplayState : BaseState<AppStateMachineContext>
|
public class GameplayState : BaseState<AppStateMachineContext>
|
||||||
{
|
{
|
||||||
|
private PlayerHealth _playerHealth;
|
||||||
|
private PlayerMoney _playerMoney;
|
||||||
|
|
||||||
|
private bool _uiLoaded, _sceneLoaded;
|
||||||
|
|
||||||
public GameplayState(AppStateMachineContext context) : base(context)
|
public GameplayState(AppStateMachineContext context) : base(context)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void EnterState()
|
public override void EnterState()
|
||||||
{
|
{
|
||||||
Context.SceneLoaderService.LoadScene((int)SceneIds.Gameplay, SceneLoaded);
|
_uiLoaded = _sceneLoaded = false;
|
||||||
|
|
||||||
|
Context.UIService.LoadingScreen.Show();
|
||||||
|
|
||||||
|
_playerMoney = Context.PlayerFactory.CreatePlayerMoney();
|
||||||
|
_playerHealth = Context.PlayerFactory.CreatePlayerHealth();
|
||||||
|
|
||||||
|
_playerHealth.OnDeath += EndGame;
|
||||||
|
|
||||||
|
Context.SceneLoaderService.LoadSceneAsync((int)SceneIds.MovementDev, callBack: OnSceneLoaded); // TODO Фабрика игрока Nada
|
||||||
|
|
||||||
|
Context.UIService.SwitchPanelTo(UIPanel.Gameplay, callback: PostUILoaded);
|
||||||
|
|
||||||
|
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.GiveHealth, GiveHealth);
|
||||||
|
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.GiveMoney, GiveMoney);
|
||||||
|
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.LooseHealth, LooseHealth);
|
||||||
|
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.LooseMoney, LooseMoney);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnSceneLoaded()
|
||||||
|
{
|
||||||
|
_sceneLoaded = true;
|
||||||
|
CheckIfLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PostUILoaded()
|
||||||
|
{
|
||||||
|
((GameplayPanel)Context.UIService.CurrentPanel).Initialize(_playerMoney, _playerHealth);
|
||||||
|
_uiLoaded = true;
|
||||||
|
CheckIfLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckIfLoaded()
|
||||||
|
{
|
||||||
|
if(!_uiLoaded || !_sceneLoaded) return;
|
||||||
|
|
||||||
|
Context.UIService.LoadingScreen.Hide();
|
||||||
|
|
||||||
|
Context.CameraStateMachine.SwitchState(CameraMode.FirstPerson);
|
||||||
Context.InputService.EnableMap(ActionMappings.Gameplay);
|
Context.InputService.EnableMap(ActionMappings.Gameplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SceneLoaded()
|
|
||||||
|
// Debug
|
||||||
|
private void GiveHealth(InputAction.CallbackContext context)
|
||||||
{
|
{
|
||||||
|
_playerHealth.GetDamage(-1);
|
||||||
base.EnterState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LooseHealth(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
_playerHealth.GetDamage(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GiveMoney(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
_playerMoney.GiveMoney(100);
|
||||||
|
((GameplayPanel)(Context.UIService.CurrentPanel)).SummonDispatcher();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LooseMoney(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
_playerMoney.LooseMoney(100);
|
||||||
|
((GameplayPanel)(Context.UIService.CurrentPanel)).CloseDispatcher();
|
||||||
|
}
|
||||||
|
|
||||||
public override void Tick()
|
public override void Tick()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void EndGame()
|
||||||
|
{
|
||||||
|
Context.StateMachine.SwitchState(AppState.GameOver)
|
||||||
|
.AllowStateTransition(AppState.MainMenu);
|
||||||
|
}
|
||||||
|
|
||||||
public override void ExitState()
|
public override void ExitState()
|
||||||
{
|
{
|
||||||
|
_playerHealth = null;
|
||||||
|
_playerMoney = null;
|
||||||
|
|
||||||
Context.InputService.DisableMap(ActionMappings.Gameplay);
|
Context.InputService.DisableMap(ActionMappings.Gameplay);
|
||||||
|
|
||||||
|
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.GiveHealth, GiveHealth);
|
||||||
|
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.GiveMoney, GiveHealth);
|
||||||
|
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.LooseHealth, LooseHealth);
|
||||||
|
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.LooseMoney, LooseMoney);
|
||||||
|
|
||||||
base.ExitState();
|
base.ExitState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,34 +1,93 @@
|
|||||||
using Code.App.StateMachine;
|
using Code.App.StateMachine;
|
||||||
|
using Code.Gameplay.Camera;
|
||||||
|
using Code.Gameplay.Camera.CameraStates;
|
||||||
using Code.Input;
|
using Code.Input;
|
||||||
using Code.Scenes;
|
using Code.Scenes;
|
||||||
|
using Code.Scenes.SceneEnvironments;
|
||||||
using Code.StateMachine;
|
using Code.StateMachine;
|
||||||
|
using Code.UI;
|
||||||
|
using Reflex.Extensions;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
namespace Code.App.AppStates
|
namespace Code.App.AppStates
|
||||||
{
|
{
|
||||||
public class MainMenuState : BaseState<AppStateMachineContext>
|
public class MainMenuState : BaseState<AppStateMachineContext>
|
||||||
{
|
{
|
||||||
|
private bool _uiLoaded, _sceneLoaded;
|
||||||
public MainMenuState(AppStateMachineContext context) : base(context)
|
public MainMenuState(AppStateMachineContext context) : base(context)
|
||||||
{ }
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public override void EnterState()
|
public override void EnterState()
|
||||||
{
|
{
|
||||||
Context.SceneLoaderService.LoadScene((int)SceneIds.MainMenu, SceneLoaded);
|
_uiLoaded = _sceneLoaded = false;
|
||||||
Context.InputService.EnableMap(ActionMappings.MainMenu);
|
|
||||||
|
Context.UIService.LoadingScreen.Show();
|
||||||
|
|
||||||
|
Context.SceneLoaderService.LoadSceneAsync((int)SceneIds.MainMenu, callBack: SceneLoaded);
|
||||||
|
|
||||||
|
Context.UIService.SwitchPanelTo(UIPanel.MainMenu, PostUILoaded);
|
||||||
|
|
||||||
|
Context.CameraStateMachine.SwitchState(CameraMode.Static);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PostUILoaded()
|
||||||
|
{
|
||||||
|
((MainMenuPanel)Context.UIService.CurrentPanel).startButton.onClick.AddListener(StartGame);
|
||||||
|
((MainMenuPanel)Context.UIService.CurrentPanel).exitButton.onClick.AddListener(ExitGame);
|
||||||
|
|
||||||
|
_uiLoaded = true;
|
||||||
|
|
||||||
|
CheckIfLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
private void SceneLoaded()
|
private void SceneLoaded()
|
||||||
{
|
{
|
||||||
|
var hui = ((MainMenuEnvironment)SceneManager.GetActiveScene()
|
||||||
|
.GetSceneContainer().Resolve<CurrentSceneEnvironment>());
|
||||||
|
|
||||||
|
((StaticState)Context.CameraStateMachine.CurrentBaseState).LookTarget =
|
||||||
|
hui.cameraTarget;
|
||||||
|
|
||||||
|
((BaseCameraState)Context.CameraStateMachine.CurrentBaseState).SetFollowTransform(hui.cameraPosition);
|
||||||
|
|
||||||
|
|
||||||
|
_sceneLoaded = true;
|
||||||
|
|
||||||
|
CheckIfLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckIfLoaded()
|
||||||
|
{
|
||||||
|
if(!_uiLoaded || !_sceneLoaded) return;
|
||||||
|
|
||||||
|
Context.UIService.LoadingScreen.Hide();
|
||||||
|
|
||||||
|
Context.InputService.EnableMap(ActionMappings.MainMenu);
|
||||||
|
|
||||||
base.EnterState();
|
base.EnterState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Tick()
|
public override void Tick()
|
||||||
{ }
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StartGame()
|
||||||
|
{
|
||||||
|
Context.StateMachine.SwitchState(AppState.Gameplay)
|
||||||
|
.AllowStateTransition(AppState.GameOver);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ExitGame()
|
||||||
|
{
|
||||||
|
Application.Quit();
|
||||||
|
}
|
||||||
|
|
||||||
public override void ExitState()
|
public override void ExitState()
|
||||||
{
|
{
|
||||||
Context.InputService.DisableMap(ActionMappings.MainMenu);
|
Context.InputService.DisableMap(ActionMappings.MainMenu);
|
||||||
|
|
||||||
base.ExitState();
|
base.ExitState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
using Code.App.StateMachine;
|
||||||
|
using Code.Gameplay.Camera;
|
||||||
|
using Code.Input;
|
||||||
|
using Code.Scenes;
|
||||||
|
using Code.StateMachine;
|
||||||
|
|
||||||
|
namespace Code.App.AppStates
|
||||||
|
{
|
||||||
|
//TODO: поменяно для теста
|
||||||
|
public class MovementDevState: BaseState<AppStateMachineContext>
|
||||||
|
{
|
||||||
|
public MovementDevState(AppStateMachineContext context) : base(context)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void EnterState()
|
||||||
|
{
|
||||||
|
// Context.SceneLoaderService.LoadScene((int)SceneIds.MovementDev, SceneLoaded);
|
||||||
|
Context.InputService.EnableMap(ActionMappings.Gameplay);
|
||||||
|
|
||||||
|
Context.CameraStateMachine.SwitchState(CameraMode.FirstPerson);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SceneLoaded()
|
||||||
|
{
|
||||||
|
|
||||||
|
base.EnterState();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Tick()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ExitState()
|
||||||
|
{
|
||||||
|
Context.InputService.DisableMap(ActionMappings.Gameplay);
|
||||||
|
|
||||||
|
base.ExitState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 395d8d3979124f10897c28bae62b288a
|
||||||
|
timeCreated: 1760638654
|
||||||
@@ -1,18 +1,25 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
using Code.App.StateMachine;
|
using Code.App.StateMachine;
|
||||||
using Code.Configs;
|
using Code.Configs;
|
||||||
|
using Code.Constants;
|
||||||
|
using Code.Gameplay.Camera;
|
||||||
|
using Code.Gameplay.Player;
|
||||||
using Code.Input;
|
using Code.Input;
|
||||||
using Code.Scenes;
|
using Code.Scenes;
|
||||||
using Code.StaticData;
|
using Code.StaticData;
|
||||||
|
using Code.UI;
|
||||||
|
using Code.UI.Panels;
|
||||||
|
using Cysharp.Threading.Tasks;
|
||||||
using Reflex.Core;
|
using Reflex.Core;
|
||||||
using Reflex.Injectors;
|
using Reflex.Injectors;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
using UnityEngine.InputSystem;
|
using UnityEngine.InputSystem;
|
||||||
|
|
||||||
namespace Code.App
|
namespace Code.App
|
||||||
{
|
{
|
||||||
public class BootstrapInstaller : MonoBehaviour, IInstaller
|
public class BootstrapInstaller : MonoBehaviour, IInstaller
|
||||||
{
|
{
|
||||||
|
|
||||||
public void InstallBindings(ContainerBuilder containerBuilder)
|
public void InstallBindings(ContainerBuilder containerBuilder)
|
||||||
{
|
{
|
||||||
InstallStaticData(containerBuilder, out IStaticDataService staticDataService);
|
InstallStaticData(containerBuilder, out IStaticDataService staticDataService);
|
||||||
@@ -20,20 +27,34 @@ namespace Code.App
|
|||||||
InstallInfrastructureUnit(containerBuilder, staticDataService);
|
InstallInfrastructureUnit(containerBuilder, staticDataService);
|
||||||
|
|
||||||
containerBuilder.AddSingleton(typeof(InputService), typeof(IInputService));
|
containerBuilder.AddSingleton(typeof(InputService), typeof(IInputService));
|
||||||
|
containerBuilder.AddSingleton(typeof(PlayerFactory), typeof(IPlayerFactory));
|
||||||
|
|
||||||
|
InitializeCamera(containerBuilder, staticDataService);
|
||||||
|
containerBuilder.AddSingleton(typeof(UIFactory), typeof(IUIFactory));
|
||||||
|
containerBuilder.AddSingleton(typeof(UIService), typeof(IUIService));
|
||||||
containerBuilder.AddSingleton(typeof(SceneLoaderService), typeof(ISceneLoaderService));
|
containerBuilder.AddSingleton(typeof(SceneLoaderService), typeof(ISceneLoaderService));
|
||||||
|
|
||||||
containerBuilder.OnContainerBuilt += Bootstrap;
|
containerBuilder.OnContainerBuilt += Bootstrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void InitializeCamera(ContainerBuilder containerBuilder, IStaticDataService staticDataService)
|
||||||
|
{
|
||||||
|
Camera camera = Instantiate(staticDataService.CameraConfig.cameraPrefab);
|
||||||
|
|
||||||
|
DontDestroyOnLoad(camera);
|
||||||
|
containerBuilder.AddSingleton(camera);
|
||||||
|
}
|
||||||
|
|
||||||
private void InstallInfrastructureUnit(ContainerBuilder containerBuilder, IStaticDataService staticDataService)
|
private void InstallInfrastructureUnit(ContainerBuilder containerBuilder, IStaticDataService staticDataService)
|
||||||
{
|
{
|
||||||
GameObject infrastructureUnit = Instantiate(staticDataService.AppConfig.infrastructureUnitPrefab);
|
GameObject infrastructureUnit = Instantiate(staticDataService.AppConfig.infrastructureUnitPrefab);
|
||||||
DontDestroyOnLoad(infrastructureUnit);
|
DontDestroyOnLoad(infrastructureUnit);
|
||||||
|
|
||||||
containerBuilder.AddSingleton(infrastructureUnit);
|
containerBuilder.AddSingleton(infrastructureUnit);
|
||||||
containerBuilder.AddSingleton(infrastructureUnit.GetComponent<ICoroutineRunner>(),
|
containerBuilder.AddSingleton(infrastructureUnit.AddComponent<CoroutineRunner>(),
|
||||||
typeof(ICoroutineRunner));
|
typeof(ICoroutineRunner));
|
||||||
containerBuilder.AddSingleton(infrastructureUnit.AddComponent<AppStateMachine>());
|
containerBuilder.AddSingleton(infrastructureUnit.AddComponent<AppStateMachine>());
|
||||||
|
containerBuilder.AddSingleton(infrastructureUnit.AddComponent<CameraStateMachine>());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InstallStaticData(ContainerBuilder containerBuilder, out IStaticDataService staticDataService)
|
private void InstallStaticData(ContainerBuilder containerBuilder, out IStaticDataService staticDataService)
|
||||||
@@ -43,16 +64,41 @@ namespace Code.App
|
|||||||
|
|
||||||
containerBuilder.AddSingleton(staticDataService, typeof(IStaticDataService));
|
containerBuilder.AddSingleton(staticDataService, typeof(IStaticDataService));
|
||||||
containerBuilder.AddSingleton(staticDataService.InputConfig.inputActionAsset, typeof(InputActionAsset));
|
containerBuilder.AddSingleton(staticDataService.InputConfig.inputActionAsset, typeof(InputActionAsset));
|
||||||
|
containerBuilder.AddSingleton(staticDataService.InputConfig, typeof(InputConfig));
|
||||||
|
containerBuilder.AddSingleton(staticDataService.CameraConfig, typeof(CameraConfig));
|
||||||
|
containerBuilder.AddSingleton(staticDataService.PlayerConfig, typeof(PlayerConfig));
|
||||||
|
containerBuilder.AddSingleton(staticDataService.CharacterConfig, typeof(CharacterConfig));
|
||||||
|
containerBuilder.AddSingleton(staticDataService.UIConfig, typeof(UIConfig));
|
||||||
|
// containerBuilder.AddSingleton(staticDataService.UIConfig.canvasPrefab, typeof(Canvas));
|
||||||
|
// containerBuilder.AddSingleton(staticDataService.UIConfig.uiElementsPrefabs, typeof(UIElement[]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool _onUiLoaded;
|
||||||
|
private AppStateMachine _appStateMachine;
|
||||||
private void Bootstrap(Container container)
|
private void Bootstrap(Container container)
|
||||||
{
|
{
|
||||||
AppStateMachine appStateMachine = container.Resolve<AppStateMachine>();
|
_appStateMachine = container.Resolve<AppStateMachine>();
|
||||||
appStateMachine.Initialize();
|
_appStateMachine.Initialize();
|
||||||
|
AttributeInjector.Inject(_appStateMachine.StateMachineContext, container);
|
||||||
|
|
||||||
|
CameraStateMachine cameraStateMachine = container.Resolve<CameraStateMachine>();
|
||||||
|
AttributeInjector.Inject(cameraStateMachine.StateMachineContext, container);
|
||||||
|
cameraStateMachine.Initialize();
|
||||||
|
|
||||||
|
var loadingScreen = GameObject.FindWithTag(Tags.LoadingScreen);
|
||||||
|
DontDestroyOnLoad(loadingScreen);
|
||||||
|
|
||||||
|
IUIService uiService = container.Resolve<IUIService>();
|
||||||
|
uiService.Initialize(loadingScreen.GetComponent<LoadingScreen>());
|
||||||
|
|
||||||
|
TryStartGame();
|
||||||
|
}
|
||||||
|
|
||||||
AttributeInjector.Inject(appStateMachine.StateMachineContext, container);
|
private void TryStartGame()
|
||||||
|
{
|
||||||
appStateMachine
|
|
||||||
|
// TODO: поменяно для теста
|
||||||
|
_appStateMachine
|
||||||
.SwitchState(AppState.MainMenu)
|
.SwitchState(AppState.MainMenu)
|
||||||
.AllowStateTransition(AppState.Gameplay);
|
.AllowStateTransition(AppState.Gameplay);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c7a271c6319540abb78d561f392e1396
|
||||||
|
timeCreated: 1761743570
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
using Code.Scenes;
|
||||||
|
using Code.Scenes.SceneEnvironments;
|
||||||
|
using Reflex.Core;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.App.SceneInstallers
|
||||||
|
{
|
||||||
|
public class MainMenuSceneInstaller : MonoBehaviour, IInstaller
|
||||||
|
{
|
||||||
|
[SerializeField] private MainMenuEnvironment _mainMenuEnvironment;
|
||||||
|
|
||||||
|
public void InstallBindings(ContainerBuilder containerBuilder)
|
||||||
|
{
|
||||||
|
containerBuilder.AddScoped(typeof(MainMenuEnvironment), typeof(CurrentSceneEnvironment));
|
||||||
|
|
||||||
|
containerBuilder.OnContainerBuilt += Initialize;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Initialize(Container container)
|
||||||
|
{
|
||||||
|
MainMenuEnvironment env = (MainMenuEnvironment)container.Resolve<CurrentSceneEnvironment>();
|
||||||
|
|
||||||
|
env.TransitVariables(_mainMenuEnvironment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 04145a046c584b66818ca25745652e66
|
||||||
|
timeCreated: 1761743587
|
||||||
@@ -8,6 +8,8 @@ namespace Code.App.StateMachine
|
|||||||
Bootstrap = 1,
|
Bootstrap = 1,
|
||||||
MainMenu = 2,
|
MainMenu = 2,
|
||||||
Gameplay = 4,
|
Gameplay = 4,
|
||||||
GameOver = 8
|
GameOver = 8,
|
||||||
|
// TODO: поменяно для теста
|
||||||
|
MovementDev = 52
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,12 +7,18 @@ namespace Code.App.StateMachine
|
|||||||
{
|
{
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
States.Add(AppState.Bootstrap, new BootstrapState(StateMachineContext));
|
||||||
States.Add(AppState.MainMenu, new MainMenuState(StateMachineContext));
|
States.Add(AppState.MainMenu, new MainMenuState(StateMachineContext));
|
||||||
States.Add(AppState.Gameplay, new GameplayState(StateMachineContext));
|
States.Add(AppState.Gameplay, new GameplayState(StateMachineContext));
|
||||||
States.Add(AppState.GameOver, new GameOverState(StateMachineContext));
|
States.Add(AppState.GameOver, new GameOverState(StateMachineContext));
|
||||||
|
//TODO: Для теста
|
||||||
|
States.Add(AppState.MovementDev, new MovementDevState(StateMachineContext));
|
||||||
|
|
||||||
AllowedStates |= AppState.MainMenu;
|
AllowedStates |= AppState.MainMenu;
|
||||||
AllowedStates |= AppState.Gameplay;
|
AllowedStates |= AppState.Gameplay;
|
||||||
|
AllowedStates |= AppState.MovementDev;
|
||||||
|
|
||||||
|
CurrentBaseState = States[AppState.Bootstrap];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool CheckTransitionAllowed(AppState nextState) => AllowedStates.HasFlag(nextState);
|
protected override bool CheckTransitionAllowed(AppState nextState) => AllowedStates.HasFlag(nextState);
|
||||||
|
|||||||
@@ -1,12 +1,19 @@
|
|||||||
|
using Code.Gameplay.Camera;
|
||||||
|
using Code.Gameplay.Player;
|
||||||
using Code.Input;
|
using Code.Input;
|
||||||
using Code.Scenes;
|
using Code.Scenes;
|
||||||
|
using Code.UI;
|
||||||
using Reflex.Attributes;
|
using Reflex.Attributes;
|
||||||
|
|
||||||
namespace Code.App.StateMachine
|
namespace Code.App.StateMachine
|
||||||
{
|
{
|
||||||
public class AppStateMachineContext
|
public class AppStateMachineContext
|
||||||
{
|
{
|
||||||
[Inject] public ISceneLoaderService SceneLoaderService;
|
[Inject] public ISceneLoaderService SceneLoaderService { get; private set; }
|
||||||
[Inject] public IInputService InputService;
|
[Inject] public IInputService InputService { get; private set; }
|
||||||
|
[Inject] public AppStateMachine StateMachine { get; private set; }
|
||||||
|
[Inject] public CameraStateMachine CameraStateMachine { get; private set; }
|
||||||
|
[Inject] public IUIService UIService { get; private set; }
|
||||||
|
[Inject] public IPlayerFactory PlayerFactory { get; private set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Code.Configs
|
namespace Code.Configs
|
||||||
{
|
{
|
||||||
[CreateAssetMenu(menuName = "Config/AppConfig", fileName = "AppConfig")]
|
[CreateAssetMenu(menuName = "Config/App", fileName = "AppConfig")]
|
||||||
public class AppConfig : ScriptableObject
|
public class AppConfig : ScriptableObject
|
||||||
{
|
{
|
||||||
public GameObject infrastructureUnitPrefab;
|
public GameObject infrastructureUnitPrefab;
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(fileName = "CameraConfig", menuName = "Config/CameraConfig")]
|
||||||
|
public class CameraConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
public float
|
||||||
|
// Расстояния от персонажа до камеры
|
||||||
|
defaultDistance = 6f, // Стандартное расстояние камеры от цели
|
||||||
|
minDistance = 3f, // Минимальное расстояние при зуме
|
||||||
|
maxDistance = 10f, // Максимальное расстояние при зуме
|
||||||
|
|
||||||
|
// Скорость зума камеры
|
||||||
|
distanceMovementSpeed = 5f, // Множитель скорости изменения дистанции при зуме
|
||||||
|
|
||||||
|
// Скорость поворота камеры
|
||||||
|
rotationSpeed = 0.3f, // Множитель скорости вращения камеры
|
||||||
|
|
||||||
|
// Скорость интерполяции текущее -> целевое вращение
|
||||||
|
rotationSharpness = 100f, // Коэффициент плавности вращения камеры (чем выше - тем резче)
|
||||||
|
|
||||||
|
// Резкость следования камеры за целью
|
||||||
|
followSharpness = 100f, // Коэффициент плавности следования за движущейся целью (чем выше - тем резче)
|
||||||
|
|
||||||
|
// Углы наклона камеры
|
||||||
|
minVerticalAngle = -70f, // Минимальный угол наклона камеры (вниз)
|
||||||
|
maxVerticalAngle = 70f, // Максимальный угол наклона камеры (вверх)
|
||||||
|
defaultVerticalAngle = 10f; // Стандартный угол наклона камеры
|
||||||
|
|
||||||
|
// Позиция следования по умолчанию
|
||||||
|
public Vector3 defaultFollowPosition = Vector3.zero;
|
||||||
|
|
||||||
|
// Префаб камеры
|
||||||
|
public Camera cameraPrefab;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 72fbf590e5fd4747acfdd32eb26bba3a
|
||||||
|
timeCreated: 1761637489
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(fileName = "CharacterConfig", menuName = "Config/CharacterConfig")]
|
||||||
|
public class CharacterConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
// Основное движение по земле
|
||||||
|
public float
|
||||||
|
maxStableMoveSpeed = 8f, // Максимальная скорость движения по устойчивой поверхности
|
||||||
|
stableMovementSharpness = 15f, // Резкость изменения скорости движения (чем выше - тем резче)
|
||||||
|
orientationSharpness = 10f, // Резкость изменения вращения персонажа (чем выше - тем резче)
|
||||||
|
jumpSpeed = 10f; // Скорость прыжка
|
||||||
|
|
||||||
|
// Спринт
|
||||||
|
public float
|
||||||
|
sprintMoveSpeed = 12f, // Максимальная скорость спринта
|
||||||
|
sprintAngleThreshold = 90f; // Максимальный угол (в градусах) от направления вперёд, при котором разрешён спринт
|
||||||
|
|
||||||
|
// Слайд
|
||||||
|
public float
|
||||||
|
slideSpeed = 20f, // Скорость слайда
|
||||||
|
slideDuration = 0.8f, // Длительность слайда в секундах
|
||||||
|
slideCooldown = 1.5f; // Время перезарядки слайда в секундах
|
||||||
|
|
||||||
|
// Залазание на стены
|
||||||
|
public float
|
||||||
|
wallClimbSpeedFactor = 0.8f, // Коэффициент преобразования горизонтальной скорости в вертикальную при залазании на стену
|
||||||
|
minWallClimbSpeed = 9f, // Минимальная горизонтальная скорость для начала залазания на стену
|
||||||
|
wallDetectionAngleThreshold = 80f; // Максимальный угол (в градусах) от вертикали, при котором поверхность считается "стеной"
|
||||||
|
|
||||||
|
// Наклон при залазании на стены
|
||||||
|
public float
|
||||||
|
maxWallLeanAngle = 45f, // Максимальный угол наклона от стены (в градусах)
|
||||||
|
wallLeanSharpness = 50f, // Скорость наклона/выпрямления (чем выше — тем резче)
|
||||||
|
wallLeanHeightScale = 0.1f; // Множитель: на сколько метров подъёма = 1 единица "наклона"
|
||||||
|
|
||||||
|
// Гравитация
|
||||||
|
public Vector3 gravity = new(0f, -30f, 0f); // Вектор, отвечающий за применение гравитации
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 10cfaf8e57f64eddb8c2eda147e4739a
|
||||||
|
timeCreated: 1761723608
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(menuName = "Config/Player", fileName = "PlayerConfig")]
|
||||||
|
public class PlayerConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
public int maxHealth;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 425c2ad28dbe4552acd1564f64372558
|
||||||
|
timeCreated: 1761591274
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
|
||||||
|
namespace Code.Configs
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(menuName = "Config/UI", fileName = "UIConfig")]
|
||||||
|
public class UIConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
public AssetReference[] uiPanelsAssetReferences;
|
||||||
|
public AssetReference canvasAssetReference;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: feaa36c74e094e0aa24b3983957a6e4e
|
||||||
|
timeCreated: 1761591380
|
||||||
@@ -6,4 +6,8 @@ namespace Code.Constants
|
|||||||
public const string ConfigMultiple = "Configs/{0}";
|
public const string ConfigMultiple = "Configs/{0}";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public static class Tags
|
||||||
|
{
|
||||||
|
public const string LoadingScreen = "LoadingScreen";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: a8d4b5b0fbd947b093f98937d7b80f8e
|
guid: e4901b413afd4d7da914edf2a1e51f8f
|
||||||
timeCreated: 1760423477
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0fae52abe6b44ad5bdd6e67876fe940a
|
||||||
|
timeCreated: 1761671702
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
namespace Code.Gameplay.Camera
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Перечисление режимов работы камеры
|
||||||
|
* MainMenu - статичная камера, смотрит на заданную позицию (то что надо в главном меню)
|
||||||
|
* Static - статичная камера без следования за целью
|
||||||
|
* FirstPerson - камера от первого лица (встроена в модель персонажа)
|
||||||
|
* ThirdPerson - камера от третьего лица (следует за персонажем на расстоянии)
|
||||||
|
* Cinematic - кинематографическая камера для скриптовых сцен
|
||||||
|
*/
|
||||||
|
public enum CameraMode
|
||||||
|
{
|
||||||
|
Bogdan,
|
||||||
|
Static,
|
||||||
|
FirstPerson,
|
||||||
|
ThirdPerson,
|
||||||
|
Cinematic
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5a49105845a7435b9179e402fa7b8e30
|
||||||
|
timeCreated: 1761570884
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using Code.Configs;
|
||||||
|
using Code.Gameplay.Camera.CameraStates;
|
||||||
|
using Code.StateMachine;
|
||||||
|
|
||||||
|
namespace Code.Gameplay.Camera
|
||||||
|
{
|
||||||
|
public class CameraStateMachine : AbstractStateMachine<CameraMode, CameraStateMachineContext>
|
||||||
|
{
|
||||||
|
// Текущий режим работы камеры
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
States.Add(CameraMode.Static, new StaticState(StateMachineContext));
|
||||||
|
States.Add(CameraMode.FirstPerson, new FirstPersonState(StateMachineContext));
|
||||||
|
States.Add(CameraMode.ThirdPerson, new ThirdPersonState(StateMachineContext));
|
||||||
|
|
||||||
|
CurrentBaseState = States[CameraMode.Static];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override bool CheckTransitionAllowed(CameraMode nextState) => true;
|
||||||
|
|
||||||
|
protected override void ResetAllowedTransitions()
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b220b02510c34ea08257cc951d949fd7
|
||||||
|
timeCreated: 1761671720
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using Code.Configs;
|
||||||
|
using Code.Input;
|
||||||
|
using Reflex.Attributes;
|
||||||
|
|
||||||
|
namespace Code.Gameplay.Camera
|
||||||
|
{
|
||||||
|
public class CameraStateMachineContext
|
||||||
|
{
|
||||||
|
[Inject] public UnityEngine.Camera Camera;
|
||||||
|
[Inject] public CameraConfig Config;
|
||||||
|
[Inject] public IInputService InputService;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4f18a74bdb8947bebec56115659e5af3
|
||||||
|
timeCreated: 1761671752
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d7399e433dff42a185f62d79b546b059
|
||||||
|
timeCreated: 1761671908
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
using Code.Configs;
|
||||||
|
using Code.Input;
|
||||||
|
using Code.StateMachine;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Gameplay.Camera.CameraStates
|
||||||
|
{
|
||||||
|
public abstract class BaseCameraState : BaseState<CameraStateMachineContext>
|
||||||
|
{
|
||||||
|
// DI сервиса ввода
|
||||||
|
private readonly IInputService _inputService;
|
||||||
|
|
||||||
|
// Конфиг камеры
|
||||||
|
private readonly CameraConfig _config;
|
||||||
|
|
||||||
|
// Используемая камера
|
||||||
|
protected UnityEngine.Camera Camera { get; private set; }
|
||||||
|
|
||||||
|
// Трансформ объекта, за которым следует камера
|
||||||
|
protected Transform FollowTransform;
|
||||||
|
|
||||||
|
// Позиция следования: текущая сглаженная позиция и горизонтальное направление камеры
|
||||||
|
protected Vector3 CurrentFollowPosition;
|
||||||
|
|
||||||
|
// Fallback-позиция для режимов без цели
|
||||||
|
private Vector3 _defaultFollowPosition;
|
||||||
|
|
||||||
|
// Целевой вертикальный угол камеры (наклон вверх/вниз)
|
||||||
|
private float _targetVerticalAngle;
|
||||||
|
|
||||||
|
// Текущая и целевая дистанция камеры от цели
|
||||||
|
protected float CurrentDistance, TargetDistance;
|
||||||
|
|
||||||
|
// Исходные значения дистанции для восстановления
|
||||||
|
protected float OriginalDefaultDistance, OriginalMinDistance, OriginalMaxDistance;
|
||||||
|
|
||||||
|
// Горизонтальное направление камеры (проекция forward на плоскость)
|
||||||
|
private Vector3 PlanarDirection { get; set; }
|
||||||
|
|
||||||
|
// Параметры загружаются из CameraConfig
|
||||||
|
protected float
|
||||||
|
DefaultDistance,
|
||||||
|
MinDistance,
|
||||||
|
MaxDistance,
|
||||||
|
DistanceMovementSpeed,
|
||||||
|
RotationSpeed,
|
||||||
|
RotationSharpness,
|
||||||
|
FollowSharpness,
|
||||||
|
MinVerticalAngle,
|
||||||
|
MaxVerticalAngle,
|
||||||
|
DefaultVerticalAngle;
|
||||||
|
|
||||||
|
// Свойства для доступа к важным данным камеры извне
|
||||||
|
public Vector3 GetPlanarDirection() => PlanarDirection; // Горизонтальное направление камеры
|
||||||
|
public Quaternion GetCameraRotation() => Camera.transform.rotation; // Текущее вращение камеры
|
||||||
|
|
||||||
|
// Конструктор базового состояния
|
||||||
|
protected BaseCameraState(CameraStateMachineContext context) : base(context)
|
||||||
|
{
|
||||||
|
_inputService = context.InputService;
|
||||||
|
_config = context.Config;
|
||||||
|
LoadConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Загрузка конфига для камеры
|
||||||
|
private void LoadConfig()
|
||||||
|
{
|
||||||
|
// Загрузка значений из конфигов
|
||||||
|
DefaultDistance = _config.defaultDistance;
|
||||||
|
MinDistance = _config.minDistance;
|
||||||
|
MaxDistance = _config.maxDistance;
|
||||||
|
DistanceMovementSpeed = _config.distanceMovementSpeed;
|
||||||
|
RotationSpeed = _config.rotationSpeed;
|
||||||
|
RotationSharpness = _config.rotationSharpness;
|
||||||
|
FollowSharpness = _config.followSharpness;
|
||||||
|
MinVerticalAngle = _config.minVerticalAngle;
|
||||||
|
MaxVerticalAngle = _config.maxVerticalAngle;
|
||||||
|
DefaultVerticalAngle = _config.defaultVerticalAngle;
|
||||||
|
_defaultFollowPosition = _config.defaultFollowPosition;
|
||||||
|
|
||||||
|
// Обеспечиваем корректные значения дистанции и угла
|
||||||
|
DefaultDistance = Mathf.Clamp(DefaultDistance, MinDistance, MaxDistance);
|
||||||
|
DefaultVerticalAngle = Mathf.Clamp(DefaultVerticalAngle, MinVerticalAngle, MaxVerticalAngle);
|
||||||
|
|
||||||
|
// Сохраняем оригинальные значения для восстановления
|
||||||
|
OriginalDefaultDistance = DefaultDistance;
|
||||||
|
OriginalMinDistance = MinDistance;
|
||||||
|
OriginalMaxDistance = MaxDistance;
|
||||||
|
|
||||||
|
CurrentDistance = DefaultDistance;
|
||||||
|
TargetDistance = CurrentDistance;
|
||||||
|
_targetVerticalAngle = DefaultVerticalAngle;
|
||||||
|
PlanarDirection = Vector3.forward; // Начальное направление - вперед по оси Z
|
||||||
|
CurrentFollowPosition = _defaultFollowPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Переход в состояние
|
||||||
|
public override void EnterState()
|
||||||
|
{
|
||||||
|
Camera = Context.Camera;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void LateTick()
|
||||||
|
{
|
||||||
|
// Обновляем камеру только если есть цель для следования
|
||||||
|
if (FollowTransform)
|
||||||
|
{
|
||||||
|
UpdateWithInput(Time.deltaTime, _inputService.ZoomInput, _inputService.LookInput);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Абстрактные методы для специфики режима
|
||||||
|
protected abstract void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation);
|
||||||
|
|
||||||
|
// Обработка вращения камеры на основе пользовательского ввода
|
||||||
|
// Теперь виртуальный, чтобы статический режим мог работать как хочет
|
||||||
|
protected virtual void HandleRotationInput(float deltaTime, Vector3 rotationInput, out Quaternion targetRotation)
|
||||||
|
{
|
||||||
|
// Вращение вокруг вертикальной оси (горизонтальный поворот)
|
||||||
|
var rotationFromInput = Quaternion.Euler(FollowTransform.up * (rotationInput.x * RotationSpeed));
|
||||||
|
PlanarDirection = rotationFromInput * PlanarDirection;
|
||||||
|
var planarRotation = Quaternion.LookRotation(PlanarDirection, FollowTransform.up);
|
||||||
|
|
||||||
|
// Вращение вокруг горизонтальной оси (вертикальный наклон)
|
||||||
|
_targetVerticalAngle -= rotationInput.y * RotationSpeed;
|
||||||
|
_targetVerticalAngle = Mathf.Clamp(_targetVerticalAngle, MinVerticalAngle, MaxVerticalAngle);
|
||||||
|
var verticalRotation = Quaternion.Euler(_targetVerticalAngle, 0, 0);
|
||||||
|
|
||||||
|
// Интерполяция к целевому вращению для плавности
|
||||||
|
targetRotation = Quaternion.Slerp(Camera.transform.rotation, planarRotation * verticalRotation, deltaTime * RotationSharpness);
|
||||||
|
|
||||||
|
// Применение финального вращения
|
||||||
|
Camera.transform.rotation = targetRotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Основной метод обновления камеры, вызываемый извне каждый кадр
|
||||||
|
private void UpdateWithInput(float deltaTime, float zoomInput, Vector3 rotationInput)
|
||||||
|
{
|
||||||
|
// Обработка ввода и позиционирования
|
||||||
|
HandleRotationInput(deltaTime, rotationInput, out var targetRotation);
|
||||||
|
HandlePosition(deltaTime, zoomInput, targetRotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Установка цели для следования камеры
|
||||||
|
public void SetFollowTransform(Transform t)
|
||||||
|
{
|
||||||
|
FollowTransform = t;
|
||||||
|
CurrentFollowPosition = t ? t.position : _defaultFollowPosition;
|
||||||
|
if (t) PlanarDirection = t.forward; // Начальное направление совпадает с направлением цели
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 92ff312b40a647b392af24877e699bd5
|
||||||
|
timeCreated: 1761685916
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Gameplay.Camera.CameraStates
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Состояние камеры от первого лица
|
||||||
|
* Камера размещается непосредственно на позиции цели (например, на уровне глаз персонажа)
|
||||||
|
* Дистанция до цели принудительно устанавливается в 0
|
||||||
|
* Вращение управляется мышью, позиция следует за целью без отступа
|
||||||
|
*/
|
||||||
|
public class FirstPersonState : BaseCameraState, ICameraState
|
||||||
|
{
|
||||||
|
public FirstPersonState(CameraStateMachineContext context) : base(context) { }
|
||||||
|
|
||||||
|
public override void EnterState()
|
||||||
|
{
|
||||||
|
// В FirstPerson режиме дистанция всегда равна 0
|
||||||
|
MinDistance = 0f;
|
||||||
|
MaxDistance = 0f;
|
||||||
|
DefaultDistance = 0f;
|
||||||
|
TargetDistance = 0f;
|
||||||
|
CurrentDistance = 0f;
|
||||||
|
|
||||||
|
base.EnterState();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation)
|
||||||
|
{
|
||||||
|
// Плавное следование за целью с использованием экспоненциального сглаживания
|
||||||
|
CurrentFollowPosition = Vector3.Lerp(CurrentFollowPosition, FollowTransform.position, 1f - Mathf.Exp(-FollowSharpness * deltaTime));
|
||||||
|
|
||||||
|
// В FirstPerson режиме камера находится прямо на позиции цели
|
||||||
|
var targetPosition = CurrentFollowPosition;
|
||||||
|
|
||||||
|
// Установка финальной позиции камеры
|
||||||
|
Camera.transform.position = targetPosition;
|
||||||
|
}
|
||||||
|
public CameraMode GetCameraMode()
|
||||||
|
{
|
||||||
|
return CameraMode.FirstPerson;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8bd4b9c56b1e435d8699160bc950994c
|
||||||
|
timeCreated: 1761672032
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Code.Gameplay.Camera.CameraStates
|
||||||
|
{
|
||||||
|
public interface ICameraState
|
||||||
|
{
|
||||||
|
CameraMode GetCameraMode();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4f25670e547242e8a91e19894cf6889c
|
||||||
|
timeCreated: 1761687204
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Gameplay.Camera.CameraStates
|
||||||
|
{
|
||||||
|
public class StaticState : BaseCameraState, ICameraState
|
||||||
|
{
|
||||||
|
public Transform LookTarget;
|
||||||
|
public StaticState(CameraStateMachineContext context) : base(context) { }
|
||||||
|
|
||||||
|
public override void EnterState()
|
||||||
|
{
|
||||||
|
Debug.Log("Static State Enter");
|
||||||
|
base.EnterState();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation)
|
||||||
|
{
|
||||||
|
Camera.transform.position = FollowTransform.position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CameraMode GetCameraMode() => CameraMode.Static;
|
||||||
|
|
||||||
|
protected override void HandleRotationInput(float deltaTime, Vector3 rotationInput,
|
||||||
|
out Quaternion targetRotation)
|
||||||
|
{
|
||||||
|
if(LookTarget) Camera.transform.LookAt(LookTarget);
|
||||||
|
targetRotation = Camera.transform.rotation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ddbcc6a073b744a08ce31c0607c1e9e9
|
||||||
|
timeCreated: 1761671944
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Gameplay.Camera.CameraStates
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Состояние камеры от третьего лица
|
||||||
|
* Камера следует за персонажем на заданном расстоянии
|
||||||
|
* Поддерживает зум, плавное следование и вращение с учётом угла наклона
|
||||||
|
* Дистанция и углы настраиваются через конфигурацию
|
||||||
|
*/
|
||||||
|
public class ThirdPersonState : BaseCameraState, ICameraState
|
||||||
|
{
|
||||||
|
public ThirdPersonState(CameraStateMachineContext context) : base(context) { }
|
||||||
|
|
||||||
|
public override void EnterState()
|
||||||
|
{
|
||||||
|
// Восстанавливаем исходные значения дистанции
|
||||||
|
MinDistance = OriginalMinDistance;
|
||||||
|
MaxDistance = OriginalMaxDistance;
|
||||||
|
DefaultDistance = OriginalDefaultDistance;
|
||||||
|
TargetDistance = DefaultDistance;
|
||||||
|
|
||||||
|
base.EnterState();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation)
|
||||||
|
{
|
||||||
|
// Обновление целевой дистанции на основе ввода зума
|
||||||
|
TargetDistance += zoomInput * DistanceMovementSpeed;
|
||||||
|
TargetDistance = Mathf.Clamp(TargetDistance, MinDistance, MaxDistance);
|
||||||
|
|
||||||
|
// Плавное следование за целью с использованием экспоненциального сглаживания
|
||||||
|
CurrentFollowPosition = Vector3.Lerp(
|
||||||
|
CurrentFollowPosition,
|
||||||
|
FollowTransform.position,
|
||||||
|
1f - Mathf.Exp(-FollowSharpness * deltaTime)
|
||||||
|
);
|
||||||
|
|
||||||
|
// В ThirdPerson режиме камера отодвинута на расстояние от цели
|
||||||
|
var targetPosition = CurrentFollowPosition - targetRotation * Vector3.forward * CurrentDistance;
|
||||||
|
|
||||||
|
// Плавное изменение текущей дистанции к целевой
|
||||||
|
CurrentDistance = Mathf.Lerp(
|
||||||
|
CurrentDistance,
|
||||||
|
TargetDistance,
|
||||||
|
1f - Mathf.Exp(-DistanceMovementSpeed * deltaTime)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Установка финальной позиции камеры
|
||||||
|
Camera.transform.position = targetPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CameraMode GetCameraMode()
|
||||||
|
{
|
||||||
|
return CameraMode.ThirdPerson;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ec6778ceb9854ff8af7cba4f6285c370
|
||||||
|
timeCreated: 1761672071
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f8a8f6d0b8744b4c981d87722e6bb7e8
|
||||||
|
timeCreated: 1760627963
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fb497e2e267044a7a35f80b47c88c2c9
|
||||||
|
timeCreated: 1761570825
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d3be946108b44b33b99d2e3e4a75d47f
|
||||||
|
timeCreated: 1761571338
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
using Code.Gameplay.Camera;
|
||||||
|
using KinematicCharacterController;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Gameplay.Character.Controller.Abilities
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Механика слайда для персонажа
|
||||||
|
* Отвечает за управление состоянием, таймерами и скоростью слайда
|
||||||
|
*/
|
||||||
|
public class SlideMechanic
|
||||||
|
{
|
||||||
|
// Скорость слайда
|
||||||
|
private readonly float _slideSpeed;
|
||||||
|
// Длительность слайда в секундах
|
||||||
|
private readonly float _slideDuration;
|
||||||
|
// Время перезарядки слайда
|
||||||
|
private readonly float _slideCooldown;
|
||||||
|
|
||||||
|
// Таймер слайда
|
||||||
|
private float _slideTimer;
|
||||||
|
// Таймер перезарядки слайда
|
||||||
|
private float _slideCooldownTimer;
|
||||||
|
// Направление слайда
|
||||||
|
private Vector3 _slideDirection;
|
||||||
|
// Флаг запроса слайда
|
||||||
|
private bool _slideRequested;
|
||||||
|
|
||||||
|
// Свойство-флаг, активен ли слайд
|
||||||
|
public bool IsSliding { get; private set; }
|
||||||
|
|
||||||
|
// Конструктор механики слайда
|
||||||
|
public SlideMechanic(float slideSpeed, float slideDuration, float slideCooldown)
|
||||||
|
{
|
||||||
|
_slideSpeed = slideSpeed;
|
||||||
|
_slideDuration = slideDuration;
|
||||||
|
_slideCooldown = slideCooldown;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обновляем таймер перезарядки слайда
|
||||||
|
public void TickCooldown(float deltaTime)
|
||||||
|
{
|
||||||
|
if (_slideCooldownTimer > 0f)
|
||||||
|
{
|
||||||
|
_slideCooldownTimer -= deltaTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обработка слайда
|
||||||
|
public void RequestSlide(bool slidePressed)
|
||||||
|
{
|
||||||
|
if (slidePressed && !_slideRequested && _slideCooldownTimer <= 0f)
|
||||||
|
{
|
||||||
|
_slideRequested = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Начало слайда
|
||||||
|
public void TryStartSlide(KinematicCharacterMotor motor,
|
||||||
|
CameraMode currentCameraMode,
|
||||||
|
Quaternion firstPersonCameraRotation,
|
||||||
|
Vector3 lookInputVector)
|
||||||
|
{
|
||||||
|
// Проверяем условия для старта слайда
|
||||||
|
if (!_slideRequested || !motor.GroundingStatus.IsStableOnGround || _slideCooldownTimer > 0f)
|
||||||
|
{
|
||||||
|
_slideRequested = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IsSliding = true;
|
||||||
|
_slideTimer = _slideDuration;
|
||||||
|
|
||||||
|
// НАПРАВЛЕНИЕ СЛАЙДА - ВСЕГДА ВПЕРЕД ПО КАМЕРЕ
|
||||||
|
// Используем направление камеры, но проецируем на горизонтальную плоскость
|
||||||
|
var slideDir = currentCameraMode == CameraMode.FirstPerson ?
|
||||||
|
firstPersonCameraRotation * Vector3.forward :
|
||||||
|
lookInputVector;
|
||||||
|
|
||||||
|
// Проецируем на горизонтальную плоскость и нормализуем
|
||||||
|
_slideDirection = Vector3.ProjectOnPlane(slideDir, motor.CharacterUp).normalized;
|
||||||
|
|
||||||
|
// Если направление нулевое (персонаж стоит на месте), используем направление вперед
|
||||||
|
if (_slideDirection.sqrMagnitude < 0.01f)
|
||||||
|
{
|
||||||
|
_slideDirection = motor.CharacterForward;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Устанавливаем перезарядку
|
||||||
|
_slideCooldownTimer = _slideCooldown;
|
||||||
|
_slideRequested = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обработка слайда
|
||||||
|
public void HandleSlide(ref Vector3 currentVelocity, float deltaTime, KinematicCharacterMotor motor)
|
||||||
|
{
|
||||||
|
// Уменьшаем таймер слайда
|
||||||
|
_slideTimer -= deltaTime;
|
||||||
|
|
||||||
|
// Если время слайда вышло, персонаж в воздухе - заканчиваем слайд
|
||||||
|
if (_slideTimer <= 0f || !motor.GroundingStatus.IsStableOnGround)
|
||||||
|
{
|
||||||
|
EndSlide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Устанавливаем скорость слайда вперед
|
||||||
|
// Используем прямую установку скорости вместо сложных вычислений
|
||||||
|
currentVelocity = _slideDirection * _slideSpeed;
|
||||||
|
|
||||||
|
// Добавляем небольшую вертикальную компоненту для лучшего скольжения по неровностям
|
||||||
|
currentVelocity += motor.CharacterUp * 2f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Завершение слайда
|
||||||
|
public void EndSlide()
|
||||||
|
{
|
||||||
|
IsSliding = false;
|
||||||
|
_slideTimer = 0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5904fa03346e4751967d57500ab3d1cf
|
||||||
|
timeCreated: 1761571347
|
||||||
+55
@@ -0,0 +1,55 @@
|
|||||||
|
using KinematicCharacterController;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Gameplay.Character.Controller.Abilities
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Механика залазания на стены
|
||||||
|
* Обрабатывает столкновения и применяет вертикальный импульс при ударе о стену с достаточной скоростью
|
||||||
|
*/
|
||||||
|
public class WallClimbMechanic
|
||||||
|
{
|
||||||
|
// Коэффициент преобразования горизонтальной скорости в вертикальную при залазании на стену
|
||||||
|
private readonly float _wallClimbSpeedFactor;
|
||||||
|
// Минимальная горизонтальная скорость для начала залазания на стену
|
||||||
|
private readonly float _minWallClimbSpeed;
|
||||||
|
// Пороговый косинус стены
|
||||||
|
public float WallNormalThreshold { get; }
|
||||||
|
|
||||||
|
// Конструктор механики залазания на стену
|
||||||
|
public WallClimbMechanic(float wallClimbSpeedFactor, float minWallClimbSpeed, float wallDetectionAngleThreshold)
|
||||||
|
{
|
||||||
|
_wallClimbSpeedFactor = wallClimbSpeedFactor;
|
||||||
|
_minWallClimbSpeed = minWallClimbSpeed;
|
||||||
|
// Преобразуем угол в косинус порога: если |dot| > cos(threshold), то это НЕ стена
|
||||||
|
WallNormalThreshold = Mathf.Cos(Mathf.Deg2Rad * wallDetectionAngleThreshold);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обработка столкновения при движении (вызывается при ударе о препятствие)
|
||||||
|
public void OnMovementHit(KinematicCharacterMotor motor, Vector3 hitNormal)
|
||||||
|
{
|
||||||
|
// Проверяем, что это вертикальная или почти вертикальная поверхность (стена)
|
||||||
|
var dotWithUp = Vector3.Dot(hitNormal, motor.CharacterUp);
|
||||||
|
if (Mathf.Abs(dotWithUp) > WallNormalThreshold) return; // Не стена — это пол или потолок
|
||||||
|
|
||||||
|
// Получаем текущую скорость персонажа
|
||||||
|
var currentVelocity = motor.Velocity;
|
||||||
|
|
||||||
|
// Проекция скорости на направление к стене (отрицательная, если летим в стену)
|
||||||
|
var velocityIntoWall = Vector3.Dot(currentVelocity, -hitNormal);
|
||||||
|
|
||||||
|
// Если движемся в стену с достаточной скоростью
|
||||||
|
if (velocityIntoWall > _minWallClimbSpeed)
|
||||||
|
{
|
||||||
|
// Преобразуем часть горизонтальной скорости в вертикальную
|
||||||
|
var verticalBoost = velocityIntoWall * _wallClimbSpeedFactor;
|
||||||
|
|
||||||
|
// Добавляем вертикальный импульс через BaseVelocity
|
||||||
|
motor.BaseVelocity += motor.CharacterUp * verticalBoost;
|
||||||
|
|
||||||
|
// Предотвращаем заземление и повторное применение в этом кадре
|
||||||
|
motor.ForceUnground();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: cfce19738ff34be286c953e33e515c46
|
||||||
|
timeCreated: 1761571364
|
||||||
+79
@@ -0,0 +1,79 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using KinematicCharacterController;
|
||||||
|
|
||||||
|
namespace Code.Gameplay.Character.Controller.Abilities
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Механика наклона персонажа при контакте со стеной
|
||||||
|
* Управляет визуальным наклоном модели в зависимости от высоты подъёма по стене
|
||||||
|
*/
|
||||||
|
public class WallLeanMechanic
|
||||||
|
{
|
||||||
|
private readonly float _maxLeanAngle;
|
||||||
|
private readonly float _leanSharpness;
|
||||||
|
private readonly float _heightScale;
|
||||||
|
|
||||||
|
private Transform _characterTransform;
|
||||||
|
private Vector3 _lastWallNormal;
|
||||||
|
private float _lastWallContactHeight;
|
||||||
|
private float _leanFactor;
|
||||||
|
|
||||||
|
public WallLeanMechanic(float maxLeanAngle, float leanSharpness, float heightScale)
|
||||||
|
{
|
||||||
|
_maxLeanAngle = maxLeanAngle;
|
||||||
|
_leanSharpness = leanSharpness;
|
||||||
|
_heightScale = heightScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Назначаем трансформ визуальной модели один раз
|
||||||
|
public void SetCharacterTransform(Transform transform)
|
||||||
|
{
|
||||||
|
_characterTransform = transform;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Вызывается из OnMovementHit
|
||||||
|
public void OnWallContact(Vector3 wallNormal, float contactHeight)
|
||||||
|
{
|
||||||
|
_lastWallNormal = wallNormal;
|
||||||
|
_lastWallContactHeight = contactHeight; }
|
||||||
|
|
||||||
|
// Обновление каждый кадр
|
||||||
|
public void UpdateLean(KinematicCharacterMotor motor, float deltaTime)
|
||||||
|
{
|
||||||
|
if (!_characterTransform) return;
|
||||||
|
|
||||||
|
var isGrounded = motor.GroundingStatus.IsStableOnGround;
|
||||||
|
|
||||||
|
if (!isGrounded)
|
||||||
|
{
|
||||||
|
var heightDelta = motor.TransientPosition.y - _lastWallContactHeight;
|
||||||
|
var targetLeanFactor = Mathf.Clamp01(heightDelta * _heightScale);
|
||||||
|
_leanFactor = Mathf.Lerp(_leanFactor, targetLeanFactor, 1f - Mathf.Exp(-_leanSharpness * deltaTime));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_leanFactor = Mathf.Lerp(_leanFactor, 0f, 1f - Mathf.Exp(-_leanSharpness * deltaTime));
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplyLeanRotation(motor);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplyLeanRotation(KinematicCharacterMotor motor)
|
||||||
|
{
|
||||||
|
if (_leanFactor <= 0.01f)
|
||||||
|
{
|
||||||
|
_characterTransform.localRotation = Quaternion.identity;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var leanDirection = -_lastWallNormal;
|
||||||
|
leanDirection = Vector3.ProjectOnPlane(leanDirection, motor.CharacterUp).normalized;
|
||||||
|
|
||||||
|
if (leanDirection.sqrMagnitude < 0.01f) return;
|
||||||
|
|
||||||
|
var leanAngle = _leanFactor * _maxLeanAngle;
|
||||||
|
var leanRotation = Quaternion.AngleAxis(leanAngle, Vector3.Cross(motor.CharacterUp, leanDirection));
|
||||||
|
_characterTransform.localRotation = leanRotation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dfaefcb035124edb84b7874c5938defc
|
||||||
|
timeCreated: 1761738483
|
||||||
+244
@@ -0,0 +1,244 @@
|
|||||||
|
using Code.Configs;
|
||||||
|
using Code.Gameplay.Camera;
|
||||||
|
using Code.Gameplay.Character.Controller.Abilities;
|
||||||
|
using Code.Gameplay.Character.Controller.Input;
|
||||||
|
using Code.Gameplay.Character.Controller.Movement;
|
||||||
|
using Code.Gameplay.Character.Core;
|
||||||
|
using KinematicCharacterController;
|
||||||
|
using Reflex.Attributes;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Gameplay.Character.Controller
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Скрипт, отвечающий за передвижение персонажа
|
||||||
|
* Реализует физическое движение персонажа с использованием Kinematic Character Controller
|
||||||
|
* Обрабатывает ввод пользователя, применяет движение и вращение с учетом поверхности
|
||||||
|
*
|
||||||
|
* Источник: Tvtig, https://www.youtube.com/watch?v=9ibpY64wBYM
|
||||||
|
*/
|
||||||
|
public class CustomCharacterController : MonoBehaviour, ICharacterController
|
||||||
|
{
|
||||||
|
[Inject] private CharacterConfig _characterConfig; // Конфиг персонажа через DI
|
||||||
|
|
||||||
|
[SerializeField] private KinematicCharacterMotor motor; // Движок физического перемещения персонажа
|
||||||
|
|
||||||
|
[SerializeField] private Transform characterTransform; // Трансформ персонажа (с точкой отслеживания камеры)
|
||||||
|
|
||||||
|
// Подсистемы
|
||||||
|
private CharacterInputHandler _inputHandler;
|
||||||
|
private SlideMechanic _slideMechanic;
|
||||||
|
private WallClimbMechanic _wallClimbMechanic;
|
||||||
|
private WallLeanMechanic _wallLeanMechanic;
|
||||||
|
private GroundMovementSystem _groundMovement;
|
||||||
|
private AirMovementSystem _airMovement;
|
||||||
|
|
||||||
|
// Инициализация контроллера
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
// Инициализация подсистем с параметрами из конфига
|
||||||
|
_inputHandler = new CharacterInputHandler(
|
||||||
|
_characterConfig.sprintAngleThreshold
|
||||||
|
);
|
||||||
|
_slideMechanic = new SlideMechanic(
|
||||||
|
_characterConfig.slideSpeed,
|
||||||
|
_characterConfig.slideDuration,
|
||||||
|
_characterConfig.slideCooldown
|
||||||
|
);
|
||||||
|
_wallClimbMechanic = new WallClimbMechanic(
|
||||||
|
_characterConfig.wallClimbSpeedFactor,
|
||||||
|
_characterConfig.minWallClimbSpeed,
|
||||||
|
_characterConfig.wallDetectionAngleThreshold
|
||||||
|
);
|
||||||
|
_wallLeanMechanic = new WallLeanMechanic(
|
||||||
|
_characterConfig.maxWallLeanAngle,
|
||||||
|
_characterConfig.wallLeanSharpness,
|
||||||
|
_characterConfig.wallLeanHeightScale
|
||||||
|
);
|
||||||
|
_groundMovement = new GroundMovementSystem(
|
||||||
|
_characterConfig.maxStableMoveSpeed,
|
||||||
|
_characterConfig.sprintMoveSpeed,
|
||||||
|
_characterConfig.stableMovementSharpness,
|
||||||
|
_characterConfig.jumpSpeed
|
||||||
|
);
|
||||||
|
_airMovement = new AirMovementSystem(_characterConfig.gravity);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Текущий режим камеры для адаптации поведения
|
||||||
|
private CameraMode _currentCameraMode = CameraMode.FirstPerson;
|
||||||
|
|
||||||
|
// Инициализация контроллера
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
motor.CharacterController = this; // Регистрация этого контроллера в движке
|
||||||
|
_inputHandler.FirstPersonCameraRotation =
|
||||||
|
motor.Transform.rotation; // Начальное вращение совпадает с персонажемс
|
||||||
|
_wallLeanMechanic.SetCharacterTransform(characterTransform);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обработка и преобразование входных данных от персонажа
|
||||||
|
public void SetInputs(ref CharacterInputs inputs)
|
||||||
|
{
|
||||||
|
// Обновляем таймер перезарядки слайда
|
||||||
|
_slideMechanic.TickCooldown(Time.deltaTime);
|
||||||
|
|
||||||
|
// Если активен слайд - игнорируем весь остальной ввод
|
||||||
|
if (_slideMechanic.IsSliding)
|
||||||
|
{
|
||||||
|
// Во время слайда не обрабатываем движение, прыжки и спринт
|
||||||
|
_inputHandler.MoveInputVector = Vector3.zero;
|
||||||
|
_inputHandler.LookInputVector = Vector3.one;
|
||||||
|
_inputHandler.IsSprinting = false;
|
||||||
|
_groundMovement.RequestJump(inputs.JumpPressed);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Сохраняем текущий режим камеры
|
||||||
|
_currentCameraMode = inputs.CameraMode;
|
||||||
|
|
||||||
|
// Обработка слайда
|
||||||
|
_slideMechanic.RequestSlide(inputs.SlidePressed);
|
||||||
|
|
||||||
|
// Обработка остального ввода
|
||||||
|
_inputHandler.ProcessInputs(ref inputs, motor);
|
||||||
|
|
||||||
|
// Передаём запрос прыжка напрямую в систему движения по земле
|
||||||
|
_groundMovement.RequestJump(inputs.JumpPressed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обновление вращения персонажа на основе входных данных
|
||||||
|
public void UpdateRotation(ref Quaternion currentRotation, float deltaTime)
|
||||||
|
{
|
||||||
|
// ВО ВРЕМЯ СЛАЙДА НЕ ОБНОВЛЯЕМ ВРАЩЕНИЕ - ПЕРСОНАЖ СМОТРИТ ПРЯМО
|
||||||
|
if (_slideMechanic.IsSliding) return;
|
||||||
|
|
||||||
|
switch (_currentCameraMode)
|
||||||
|
{
|
||||||
|
// В FirstPerson режиме применяем вращение камеры напрямую к персонажу (только горизонталь)
|
||||||
|
case CameraMode.FirstPerson when _inputHandler.ShouldApplyCameraRotation:
|
||||||
|
// Немедленно применяем горизонтальное вращение камеры к персонажу
|
||||||
|
currentRotation = _inputHandler.FirstPersonCameraRotation;
|
||||||
|
break;
|
||||||
|
// В ThirdPerson режиме плавно поворачиваем персонаж в направлении движения
|
||||||
|
case CameraMode.ThirdPerson:
|
||||||
|
{
|
||||||
|
// Вращение применяется только если есть направление движения и разрешена резкость вращения
|
||||||
|
if (_inputHandler.LookInputVector.sqrMagnitude > 0 && _characterConfig.orientationSharpness > 0)
|
||||||
|
{
|
||||||
|
// Плавная интерполяция текущего направления к целевому с экспоненциальным сглаживанием
|
||||||
|
var smoothedLookInputDirection = Vector3.Slerp(
|
||||||
|
motor.CharacterForward,
|
||||||
|
_inputHandler.LookInputVector,
|
||||||
|
1f - Mathf.Exp(-_characterConfig.orientationSharpness * deltaTime)
|
||||||
|
).normalized;
|
||||||
|
|
||||||
|
// Установка нового вращения смотря в сглаженном направлении
|
||||||
|
currentRotation = Quaternion.LookRotation(smoothedLookInputDirection, motor.CharacterUp);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Заготовка на будущее (если понадобится)
|
||||||
|
case CameraMode.Static:
|
||||||
|
case CameraMode.Cinematic:
|
||||||
|
case CameraMode.Bogdan: // Скорее всего юзлес, но пускай будет
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обновление скорости движения персонажа
|
||||||
|
public void UpdateVelocity(ref Vector3 currentVelocity, float deltaTime)
|
||||||
|
{
|
||||||
|
// Если во время слайда запрошен прыжок — прерываем слайд
|
||||||
|
if (_slideMechanic.IsSliding && _groundMovement.JumpRequested)
|
||||||
|
{
|
||||||
|
_slideMechanic.EndSlide();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Проверяем запрос слайда и запускаем его если можно
|
||||||
|
if (!_slideMechanic.IsSliding)
|
||||||
|
{
|
||||||
|
_slideMechanic.TryStartSlide(motor, _currentCameraMode, _inputHandler.FirstPersonCameraRotation,
|
||||||
|
_inputHandler.LookInputVector);
|
||||||
|
}
|
||||||
|
// Если активен слайд - обрабатываем отдельно
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_slideMechanic.HandleSlide(ref currentVelocity, deltaTime, motor);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Если персонаж находится на земле
|
||||||
|
if (motor.GroundingStatus.IsStableOnGround)
|
||||||
|
{
|
||||||
|
_groundMovement.UpdateVelocity(ref currentVelocity, _inputHandler, motor, deltaTime);
|
||||||
|
}
|
||||||
|
// Если персонаж не находится на земле
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_airMovement.UpdateVelocity(ref currentVelocity, deltaTime);
|
||||||
|
// Отменяем прыжок (фикс проблемы с двойным прыжком после приземления)
|
||||||
|
_groundMovement.CancelJumpRequest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Метод вызывается перед обновлением персонажа (можно использовать для подготовки)
|
||||||
|
public void BeforeCharacterUpdate(float deltaTime)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Метод вызывается после обработки столкновения с землей
|
||||||
|
public void PostGroundingUpdate(float deltaTime)
|
||||||
|
{
|
||||||
|
// Если во время слайда персонаж оторвался от земли - заканчиваем слайд
|
||||||
|
if (_slideMechanic.IsSliding && !motor.GroundingStatus.IsStableOnGround)
|
||||||
|
{
|
||||||
|
_slideMechanic.EndSlide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Метод вызывается после обновления персонажа
|
||||||
|
public void AfterCharacterUpdate(float deltaTime)
|
||||||
|
{
|
||||||
|
_wallLeanMechanic.UpdateLean(motor, deltaTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Проверка валидности коллайдера для обработки столкновений
|
||||||
|
public bool IsColliderValidForCollisions(Collider coll)
|
||||||
|
{
|
||||||
|
return true; // Все коллайдеры считаются валидными для столкновений
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обработка столкновения с землей (вызывается при приземлении)
|
||||||
|
public void OnGroundHit(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint,
|
||||||
|
ref HitStabilityReport hitStabilityReport)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обработка столкновения при движении (вызывается при ударе о препятствие)
|
||||||
|
public void OnMovementHit(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint,
|
||||||
|
ref HitStabilityReport hitStabilityReport)
|
||||||
|
{
|
||||||
|
_wallClimbMechanic.OnMovementHit(motor, hitNormal);
|
||||||
|
|
||||||
|
var dotWithUp = Vector3.Dot(hitNormal, motor.CharacterUp);
|
||||||
|
if (Mathf.Abs(dotWithUp) <= _wallClimbMechanic.WallNormalThreshold)
|
||||||
|
{
|
||||||
|
_wallLeanMechanic.OnWallContact(hitNormal, motor.TransientPosition.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обработка отчета о стабильности столкновения
|
||||||
|
public void ProcessHitStabilityReport(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint,
|
||||||
|
Vector3 atCharacterPosition,
|
||||||
|
Quaternion atCharacterRotation, ref HitStabilityReport hitStabilityReport)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обработка дискретных столкновений (для триггеров и специальных коллайдеров)
|
||||||
|
public void OnDiscreteCollisionDetected(Collider hitCollider)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a6f74123648343c498c883d02909b499
|
||||||
|
timeCreated: 1760641740
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e50ac1a55a4f4706b6385746eb9c6d1f
|
||||||
|
timeCreated: 1761571269
|
||||||
+128
@@ -0,0 +1,128 @@
|
|||||||
|
using Code.Gameplay.Camera;
|
||||||
|
using UnityEngine;
|
||||||
|
using Code.Gameplay.Character.Core;
|
||||||
|
using KinematicCharacterController;
|
||||||
|
|
||||||
|
namespace Code.Gameplay.Character.Controller.Input
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Обработчик входных данных для персонажа
|
||||||
|
* Преобразует сырые данные ввода в векторы движения и направления взгляда
|
||||||
|
*/
|
||||||
|
public class CharacterInputHandler
|
||||||
|
{
|
||||||
|
// Косинус порогового угла для спринта (предвычислен)
|
||||||
|
private readonly float _sprintAngleThresholdCos;
|
||||||
|
|
||||||
|
// Векторы движения и направления взгляда
|
||||||
|
public Vector3 MoveInputVector { get; set; }
|
||||||
|
public Vector3 LookInputVector { get; set; }
|
||||||
|
|
||||||
|
// Флаг-свойство указывающий, что активен режим спринта
|
||||||
|
public bool IsSprinting { get; set; }
|
||||||
|
|
||||||
|
// Вращение камеры в FirstPerson режиме для синхронизации (только горизонтальная компонента)
|
||||||
|
public Quaternion FirstPersonCameraRotation { get; set; }
|
||||||
|
|
||||||
|
// Флаг-свойство указывающий, что нужно применить вращение камеры к персонажу
|
||||||
|
public bool ShouldApplyCameraRotation { get; private set; }
|
||||||
|
|
||||||
|
// Конструктор с пороговым углом
|
||||||
|
public CharacterInputHandler(float sprintAngleThreshold)
|
||||||
|
{
|
||||||
|
// Предвычисляем косинус порогового угла для эффективности
|
||||||
|
// Угол в градусах → радианы → косинус
|
||||||
|
// Чем меньше угол — тем строже условие
|
||||||
|
_sprintAngleThresholdCos = Mathf.Cos(Mathf.Deg2Rad * sprintAngleThreshold);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обработка и преобразование входных данных от персонажа
|
||||||
|
public void ProcessInputs(ref CharacterInputs inputs, KinematicCharacterMotor motor)
|
||||||
|
{
|
||||||
|
// Сохраняем текущий режим камеры
|
||||||
|
var currentCameraMode = inputs.CameraMode;
|
||||||
|
|
||||||
|
// Обработка спринта
|
||||||
|
IsSprinting = inputs.SprintPressed && inputs.MoveAxisForward > _sprintAngleThresholdCos; // Спринт только при движении на заданный в конфиге угол
|
||||||
|
|
||||||
|
// Нормализация вектора движения и ограничение его величины до 1
|
||||||
|
var moveInputVector =
|
||||||
|
Vector3.ClampMagnitude(new Vector3(inputs.MoveAxisRight, 0, inputs.MoveAxisForward), 1f);
|
||||||
|
|
||||||
|
// Раздельная обработка в зависимости от режима камеры
|
||||||
|
if (currentCameraMode == CameraMode.FirstPerson)
|
||||||
|
{
|
||||||
|
HandleFirstPersonInputs(ref inputs, moveInputVector, motor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HandleThirdPersonInputs(ref inputs, moveInputVector, motor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обработка ввода для FirstPerson режима
|
||||||
|
private void HandleFirstPersonInputs(ref CharacterInputs inputs, Vector3 moveInputVector, KinematicCharacterMotor motor)
|
||||||
|
{
|
||||||
|
// Сохраняем вращение камеры для применения в UpdateRotation (только горизонтальная компонента)
|
||||||
|
FirstPersonCameraRotation = ExtractHorizontalRotation(inputs.CameraRotation, motor);
|
||||||
|
ShouldApplyCameraRotation = true;
|
||||||
|
|
||||||
|
// В FirstPerson режиме движение всегда относительно направления камеры
|
||||||
|
// Получаем направление камеры в горизонтальной плоскости
|
||||||
|
var cameraPlanarDirection = inputs.CameraPlanarDirection;
|
||||||
|
|
||||||
|
// Создание вращения на основе направления камеры
|
||||||
|
var cameraPlanarRotation = Quaternion.LookRotation(cameraPlanarDirection, motor.CharacterUp);
|
||||||
|
|
||||||
|
// Преобразование локального ввода в мировые координаты относительно камеры
|
||||||
|
MoveInputVector = cameraPlanarRotation * moveInputVector;
|
||||||
|
|
||||||
|
// В FirstPerson режиме направление взгляда всегда совпадает с направлением камеры (горизонтально)
|
||||||
|
LookInputVector = cameraPlanarDirection;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обработка ввода для ThirdPerson режима
|
||||||
|
private void HandleThirdPersonInputs(ref CharacterInputs inputs, Vector3 moveInputVector, KinematicCharacterMotor motor)
|
||||||
|
{
|
||||||
|
// Сбрасываем флаг применения вращения камеры
|
||||||
|
ShouldApplyCameraRotation = false;
|
||||||
|
|
||||||
|
// Получение направления камеры в горизонтальной плоскости (игнорируя наклон)
|
||||||
|
var cameraPlanarDirection = inputs.CameraPlanarDirection;
|
||||||
|
|
||||||
|
// Резервный расчет направления, если основное направление параллельно вертикали
|
||||||
|
if (cameraPlanarDirection.sqrMagnitude == 0f)
|
||||||
|
{
|
||||||
|
cameraPlanarDirection = Vector3.ProjectOnPlane(inputs.CameraRotation * Vector3.up, motor.CharacterUp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Создание вращения на основе направления камеры
|
||||||
|
var cameraPlanarRotation = Quaternion.LookRotation(cameraPlanarDirection, motor.CharacterUp);
|
||||||
|
|
||||||
|
// Преобразование локального ввода в мировые координаты относительно камеры
|
||||||
|
MoveInputVector = cameraPlanarRotation * moveInputVector;
|
||||||
|
|
||||||
|
// Направление взгляда совпадает с направлением движения (нормализованное)
|
||||||
|
LookInputVector = MoveInputVector.normalized;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Извлечение только горизонтальной компоненты вращения (игнорируя наклон камеры)
|
||||||
|
private static Quaternion ExtractHorizontalRotation(Quaternion cameraRotation, KinematicCharacterMotor motor)
|
||||||
|
{
|
||||||
|
// Получаем вектор направления камеры
|
||||||
|
var cameraForward = cameraRotation * Vector3.forward;
|
||||||
|
|
||||||
|
// Проецируем на горизонтальную плоскость
|
||||||
|
var horizontalForward = Vector3.ProjectOnPlane(cameraForward, motor.CharacterUp).normalized;
|
||||||
|
|
||||||
|
// Если проекция вырождена, используем текущее направление персонажа
|
||||||
|
if (horizontalForward.sqrMagnitude < 0.01f)
|
||||||
|
{
|
||||||
|
horizontalForward = motor.CharacterForward;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Создаем вращение только по горизонтали
|
||||||
|
return Quaternion.LookRotation(horizontalForward, motor.CharacterUp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 513b50847de24c619c380c15e084e932
|
||||||
|
timeCreated: 1761571281
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b3dfd8f0dbeb4e8690e11049cb7e2f55
|
||||||
|
timeCreated: 1761571298
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Gameplay.Character.Controller.Movement
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Система движения персонажа в воздухе
|
||||||
|
*/
|
||||||
|
public class AirMovementSystem
|
||||||
|
{
|
||||||
|
// Вектор, отвечающий за применение гравитации
|
||||||
|
private readonly Vector3 _gravity;
|
||||||
|
|
||||||
|
// Конструктор системы движения в воздухе
|
||||||
|
public AirMovementSystem(Vector3 gravity)
|
||||||
|
{
|
||||||
|
_gravity = gravity;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обновление скорости движения персонажа в воздухе
|
||||||
|
public void UpdateVelocity(ref Vector3 currentVelocity, float deltaTime)
|
||||||
|
{
|
||||||
|
// Применяем гравитацию
|
||||||
|
currentVelocity += _gravity * deltaTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5ea8841f02ff4e17ab8ebd8c7a949f6f
|
||||||
|
timeCreated: 1761571326
|
||||||
+88
@@ -0,0 +1,88 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using Code.Gameplay.Character.Controller.Input;
|
||||||
|
using KinematicCharacterController;
|
||||||
|
|
||||||
|
namespace Code.Gameplay.Character.Controller.Movement
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Система движения персонажа по устойчивой поверхности
|
||||||
|
*/
|
||||||
|
public class GroundMovementSystem
|
||||||
|
{
|
||||||
|
// Максимальная скорость движения по устойчивой поверхности
|
||||||
|
private readonly float _maxStableMoveSpeed;
|
||||||
|
// Максимальная скорость спринта
|
||||||
|
private readonly float _sprintMoveSpeed;
|
||||||
|
// Резкость изменения скорости движения (чем выше - тем резче)
|
||||||
|
private readonly float _stableMovementSharpness;
|
||||||
|
// Скорость прыжка
|
||||||
|
private readonly float _jumpSpeed;
|
||||||
|
|
||||||
|
// Свойство-флаг указывающий, что был запрошен прыжок
|
||||||
|
public bool JumpRequested { get; private set; }
|
||||||
|
|
||||||
|
// Конструктор системы движения на земле
|
||||||
|
public GroundMovementSystem(float maxStableMoveSpeed, float sprintMoveSpeed, float stableMovementSharpness, float jumpSpeed)
|
||||||
|
{
|
||||||
|
_maxStableMoveSpeed = maxStableMoveSpeed;
|
||||||
|
_sprintMoveSpeed = sprintMoveSpeed;
|
||||||
|
_stableMovementSharpness = stableMovementSharpness;
|
||||||
|
_jumpSpeed = jumpSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Метод для установки запроса на прыжок извне
|
||||||
|
public void RequestJump(bool jumpPressed)
|
||||||
|
{
|
||||||
|
if (jumpPressed)
|
||||||
|
JumpRequested = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Метод для отмены запроса на прыжок извне
|
||||||
|
public void CancelJumpRequest()
|
||||||
|
{
|
||||||
|
JumpRequested = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обновление скорости движения персонажа на земле
|
||||||
|
public void UpdateVelocity(
|
||||||
|
ref Vector3 currentVelocity,
|
||||||
|
CharacterInputHandler inputHandler,
|
||||||
|
KinematicCharacterMotor motor,
|
||||||
|
float deltaTime)
|
||||||
|
{
|
||||||
|
// Сохранение текущей величины скорости
|
||||||
|
var currentVelocityMagnitude = currentVelocity.magnitude;
|
||||||
|
|
||||||
|
// Получение нормали поверхности для корректного движения по наклонным плоскостям
|
||||||
|
var effectiveGroundNormal = motor.GroundingStatus.GroundNormal;
|
||||||
|
|
||||||
|
// Переориентация текущей скорости вдоль поверхности
|
||||||
|
currentVelocity = motor.GetDirectionTangentToSurface(currentVelocity, effectiveGroundNormal) *
|
||||||
|
currentVelocityMagnitude;
|
||||||
|
|
||||||
|
// Переориентация входного вектора движения вдоль поверхности
|
||||||
|
var inputRight = Vector3.Cross(inputHandler.MoveInputVector, motor.CharacterUp);
|
||||||
|
var reorientedInput = Vector3.Cross(effectiveGroundNormal, inputRight).normalized *
|
||||||
|
inputHandler.MoveInputVector.magnitude;
|
||||||
|
|
||||||
|
// Расчет целевой скорости движения с учетом ограничения максимальной скорости и спринта
|
||||||
|
var targetSpeed = inputHandler.IsSprinting ? _sprintMoveSpeed : _maxStableMoveSpeed;
|
||||||
|
var targetMovementVelocity = reorientedInput * targetSpeed;
|
||||||
|
|
||||||
|
// Плавная интерполяция текущей скорости к целевой с экспоненциальным сглаживанием
|
||||||
|
currentVelocity = Vector3.Lerp(
|
||||||
|
currentVelocity,
|
||||||
|
targetMovementVelocity,
|
||||||
|
1f - Mathf.Exp(-_stableMovementSharpness * deltaTime)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Если запрошен прыжок
|
||||||
|
if (JumpRequested)
|
||||||
|
{
|
||||||
|
currentVelocity += motor.CharacterUp * _jumpSpeed - Vector3.Project(currentVelocity, motor.CharacterUp);
|
||||||
|
JumpRequested = false; // Сброс сразу после применения
|
||||||
|
motor.ForceUnground();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 21cd95513cd44d52b6ae014403f9e3d1
|
||||||
|
timeCreated: 1761571312
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4028bee0a1774348bb81e0c56e400ddc
|
||||||
|
timeCreated: 1761570805
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
using Code.Gameplay.Camera;
|
||||||
|
using Code.Gameplay.Camera.CameraStates;
|
||||||
|
using Code.Gameplay.Character.Controller;
|
||||||
|
using Code.Input;
|
||||||
|
using Reflex.Attributes;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Gameplay.Character.Core
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Главный скрипт персонажа, объединяющий камеру и контроллер персонажа
|
||||||
|
* Обрабатывает ввод пользователя и распределяет его между компонентами
|
||||||
|
* Синхронизирует состояние камеры и персонажа
|
||||||
|
* Управляет переключением режимов камеры через Input System
|
||||||
|
*/
|
||||||
|
public class Character : MonoBehaviour
|
||||||
|
{
|
||||||
|
[Inject] private CameraStateMachine _cameraStateMachine; // Стейт-машина камеры (нужна для транзакций и т.п.)
|
||||||
|
[SerializeField] private CustomCharacterController customCharacterController; // Компонент управления персонажем
|
||||||
|
[SerializeField] private Transform cameraFollowPoint; // Точка следования камеры (уровень глаз для FirstPerson)
|
||||||
|
|
||||||
|
[Inject] private IInputService _inputService; // Сервис ввода через DI
|
||||||
|
|
||||||
|
// Флаг для отслеживания переключения режима камеры (чтобы избежать многократных срабатываний)
|
||||||
|
private bool _cameraModeToggleHandled;
|
||||||
|
|
||||||
|
// Инициализация персонажа
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
// Настройка камеры для следования за точкой камеры
|
||||||
|
((BaseCameraState)_cameraStateMachine.CurrentBaseState).SetFollowTransform(cameraFollowPoint);
|
||||||
|
|
||||||
|
// Включение Gameplay мапа ввода
|
||||||
|
_inputService.EnableMap(ActionMappings.Gameplay);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обработка ввода для движения персонажа
|
||||||
|
private void HandleCharacterInput()
|
||||||
|
{
|
||||||
|
// Создаем структуру ввода с полной информацией о камере
|
||||||
|
var inputs = new CharacterInputs();
|
||||||
|
|
||||||
|
// Получаем данные движения из Input System
|
||||||
|
var moveInput = _inputService.MoveInput;
|
||||||
|
inputs.MoveAxisForward = moveInput.y; // Vertical ось (W/S или Up/Down)
|
||||||
|
inputs.MoveAxisRight = moveInput.x; // Horizontal ось (A/D или Left/Right)
|
||||||
|
inputs.JumpPressed = _inputService.JumpPressed; // Прыжки (Space)
|
||||||
|
inputs.SprintPressed = _inputService.SprintPressed; // Спринт (Shift)
|
||||||
|
inputs.SlidePressed = _inputService.SlidePressed; // Слайд (Ctrl)
|
||||||
|
inputs.CameraMode = ((ICameraState)_cameraStateMachine.CurrentBaseState).GetCameraMode();
|
||||||
|
|
||||||
|
// Передаем информацию о камере для адаптивного поведения
|
||||||
|
inputs.CameraRotation = ((BaseCameraState)_cameraStateMachine.CurrentBaseState).GetCameraRotation();
|
||||||
|
inputs.CameraPlanarDirection = ((BaseCameraState)_cameraStateMachine.CurrentBaseState).GetPlanarDirection();
|
||||||
|
|
||||||
|
// Передаем ввод в контроллер персонажа
|
||||||
|
customCharacterController.SetInputs(ref inputs);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обработка переключения режима камеры через Input System
|
||||||
|
private void HandleCameraModeInput()
|
||||||
|
{
|
||||||
|
// Получаем состояние переключения режима камеры из Input System
|
||||||
|
var togglePressed = _inputService.ToggleCameraModePressed;
|
||||||
|
|
||||||
|
switch (togglePressed)
|
||||||
|
{
|
||||||
|
// Обрабатываем нажатие только один раз при первом обнаружении
|
||||||
|
case true when !_cameraModeToggleHandled:
|
||||||
|
ToggleCameraMode();
|
||||||
|
_cameraModeToggleHandled = true;
|
||||||
|
break;
|
||||||
|
// Сбрасываем флаг когда кнопка отпущена
|
||||||
|
case false:
|
||||||
|
_cameraModeToggleHandled = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Метод для переключения режимов камеры
|
||||||
|
private void ToggleCameraMode()
|
||||||
|
{
|
||||||
|
var currentMode = ((ICameraState)_cameraStateMachine.CurrentBaseState).GetCameraMode();
|
||||||
|
var newMode = currentMode == CameraMode.FirstPerson ? CameraMode.ThirdPerson : CameraMode.FirstPerson;
|
||||||
|
|
||||||
|
_cameraStateMachine.SwitchState(newMode);
|
||||||
|
((BaseCameraState)_cameraStateMachine.CurrentBaseState).SetFollowTransform(cameraFollowPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Обновление логики каждый кадр
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
// Обработка ввода для движения в Update (физика)
|
||||||
|
HandleCharacterInput();
|
||||||
|
|
||||||
|
// Обработка переключения режима камеры
|
||||||
|
HandleCameraModeInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9f2cdbe59523ace7ab0d8dfc36b4eb02
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using Code.Gameplay.Camera;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Gameplay.Character.Core
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Структура для хранения входных данных от персонажа
|
||||||
|
* Содержит информацию о движении и состоянии камеры
|
||||||
|
*/
|
||||||
|
public struct CharacterInputs
|
||||||
|
{
|
||||||
|
public float MoveAxisForward; // Ввод движения вперед/назад (W/S или Up/Down)
|
||||||
|
public float MoveAxisRight; // Ввод движения влево/вправо (A/D или Left/Right)
|
||||||
|
public Quaternion CameraRotation; // Текущее вращение камеры для определения направления движения
|
||||||
|
public CameraMode CameraMode; // Текущий режим камеры для адаптации поведения
|
||||||
|
public Vector3 CameraPlanarDirection; // Направление камеры в горизонтальной плоскости
|
||||||
|
public bool JumpPressed; // Флаг указывающий, нажата ли кнопка прыжка
|
||||||
|
public bool SprintPressed; // Флаг указывающий, нажата ли кнопка спринта
|
||||||
|
public bool SlidePressed; // Флаг указывающий, нажата ли кнопка слайда
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c3edde7108664ecc9b84a8096a3dec93
|
||||||
|
timeCreated: 1761570939
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 58441fe5bc46071fab2546105689c70b
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Code.Gameplay.Player
|
||||||
|
{
|
||||||
|
public interface IPlayerFactory
|
||||||
|
{
|
||||||
|
PlayerHealth CreatePlayerHealth(int count = -1);
|
||||||
|
PlayerMoney CreatePlayerMoney(int count = 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6d2689e8fb7e48a4a8a62a97d292e1e3
|
||||||
|
timeCreated: 1761761977
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using Code.Configs;
|
||||||
|
using Reflex.Attributes;
|
||||||
|
|
||||||
|
namespace Code.Gameplay.Player
|
||||||
|
{
|
||||||
|
public class PlayerFactory : IPlayerFactory
|
||||||
|
{
|
||||||
|
[Inject] PlayerConfig _playerConfig;
|
||||||
|
|
||||||
|
public PlayerHealth CreatePlayerHealth(int count = -1)
|
||||||
|
{
|
||||||
|
if (count < 0) count = _playerConfig.maxHealth;
|
||||||
|
|
||||||
|
return new(count);
|
||||||
|
}
|
||||||
|
public PlayerMoney CreatePlayerMoney(int count = 0) => new(count);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 77dd77e7e8714974a7c8bc83772e52fa
|
||||||
|
timeCreated: 1761060390
|
||||||
Loaded 100 of 404 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user