From 05a8a5445fdc8252d17399b3e575f90478cd5cc0 Mon Sep 17 00:00:00 2001 From: Michal Pikulski Date: Thu, 4 Sep 2025 14:24:28 +0200 Subject: [PATCH] [Interactions] Pulver now swaps, slots and combines items --- Assets/Data/Items/Bonfire.asset | 17 ++ Assets/Data/Items/Bonfire.asset.meta | 8 + Assets/Data/Settings/DefaultSettings.asset | 5 + Assets/External/Placeholders/Bonfire_3.png | Bin 0 -> 7434 bytes .../External/Placeholders/Bonfire_3.png.meta | 195 ++++++++++++++ .../Placeholders/PlaceholderCreditList.txt | 1 + Assets/Scenes/AppleHillsOverworld.unity | 253 +++++++++++++++++- Assets/Scripts/FollowerController.cs | 6 + Assets/Scripts/GameManager.cs | 11 + Assets/Scripts/GameSettings.cs | 10 +- Assets/Scripts/Pickup.cs | 11 +- Assets/Scripts/SlotItemBehavior.cs | 96 +++++++ Assets/Scripts/SlotItemBehavior.cs.meta | 3 + 13 files changed, 612 insertions(+), 4 deletions(-) create mode 100644 Assets/Data/Items/Bonfire.asset create mode 100644 Assets/Data/Items/Bonfire.asset.meta create mode 100644 Assets/External/Placeholders/Bonfire_3.png create mode 100644 Assets/External/Placeholders/Bonfire_3.png.meta create mode 100644 Assets/Scripts/SlotItemBehavior.cs create mode 100644 Assets/Scripts/SlotItemBehavior.cs.meta diff --git a/Assets/Data/Items/Bonfire.asset b/Assets/Data/Items/Bonfire.asset new file mode 100644 index 00000000..58b3565c --- /dev/null +++ b/Assets/Data/Items/Bonfire.asset @@ -0,0 +1,17 @@ +%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: 951b5c8af5114086a865d4bb7eae4548, type: 3} + m_Name: Bonfire + m_EditorClassIdentifier: + itemName: Bonfire + description: Well... how do you like 'em? + mapSprite: {fileID: 6277786745957211492, guid: 016288f704d38e747a8eac9795051717, type: 3} diff --git a/Assets/Data/Items/Bonfire.asset.meta b/Assets/Data/Items/Bonfire.asset.meta new file mode 100644 index 00000000..b3f353a0 --- /dev/null +++ b/Assets/Data/Items/Bonfire.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e0fad48a84a6b6346ac17c84bc512500 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Data/Settings/DefaultSettings.asset b/Assets/Data/Settings/DefaultSettings.asset index 107fa397..f3192b37 100644 --- a/Assets/Data/Settings/DefaultSettings.asset +++ b/Assets/Data/Settings/DefaultSettings.asset @@ -30,3 +30,8 @@ MonoBehaviour: - itemA: {fileID: 11400000, guid: 33e7ca06b22108d4e802486e08bcdfd1, type: 2} itemB: {fileID: 11400000, guid: 8b2616beb14825a46b9b1ed85ad3cb25, type: 2} result: {fileID: 11400000, guid: ecae2d83a5ab2a047a2733ebff607380, type: 2} + slotItemConfigs: + - slotItem: {fileID: 11400000, guid: e0fad48a84a6b6346ac17c84bc512500, type: 2} + allowedItems: + - {fileID: 11400000, guid: ecae2d83a5ab2a047a2733ebff607380, type: 2} + forbiddenItems: [] diff --git a/Assets/External/Placeholders/Bonfire_3.png b/Assets/External/Placeholders/Bonfire_3.png new file mode 100644 index 0000000000000000000000000000000000000000..a7d878a6ac52c75f11cd2aed120c9db6bc331b79 GIT binary patch literal 7434 zcmeHMc{r5a`yaAP$P!AXA%qz-W-x}a6Iqh2LYNJMv5c`~$(|4;OA=XIBumybqTZ~9 zRF>>imIw(c!uO%x-rno?{pY=|-}k?FW}bQGIrn`&=e|GZbIx_{Yhukzk8*K{aDYG{ zE<*!dbKtHCTyktIz;};B{T2ws`8d$>6wMsx5B8#ZI+5K;VA@$P5||V~b^?I{2IkV; zs1mhYQCmy=>e`F!pV3TWy!GLi7P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)EDg4)mGv@?cS#V|a{$Yi1NLB<+&x~m7#VKmdl%TOEb|Av~96O3ba^i~kiv{Vd zgwBKTd&WhNLJ0elY-YO!3q;BcDy1A}TQz3l;d*oi^Y4>Zy{``pOUjvuX;QS3-Y^m9 z6rGJ_RR$4e9}08z{|%fzaX-p%(I(H49Ti@~`09e!lz zXn6Zl;VII+{l(Y^Hr_`bo_^T4_4+Ae%K`sgpgjoq|FA>Y#2QXNlL%SfS#nvHPzTa u#k*PVNP-?a!a<Xv9bM*IgWw>#PZ literal 0 HcmV?d00001 diff --git a/Assets/External/Placeholders/Bonfire_3.png.meta b/Assets/External/Placeholders/Bonfire_3.png.meta new file mode 100644 index 00000000..1222a671 --- /dev/null +++ b/Assets/External/Placeholders/Bonfire_3.png.meta @@ -0,0 +1,195 @@ +fileFormatVersion: 2 +guid: 016288f704d38e747a8eac9795051717 +TextureImporter: + internalIDToNameTable: + - first: + 213: 6277786745957211492 + second: Bonfire_3_0 + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 2 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: iOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WindowsStoreApps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: + - serializedVersion: 2 + name: Bonfire_3_0 + rect: + serializedVersion: 2 + x: 22 + y: 0 + width: 20 + height: 29 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + customData: + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 46d5f68c8cd2f1750800000000000000 + internalID: 6277786745957211492 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: + Bonfire_3_0: 6277786745957211492 + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Placeholders/PlaceholderCreditList.txt b/Assets/External/Placeholders/PlaceholderCreditList.txt index b84a8a2c..84b50623 100644 --- a/Assets/External/Placeholders/PlaceholderCreditList.txt +++ b/Assets/External/Placeholders/PlaceholderCreditList.txt @@ -2,3 +2,4 @@ https://joszs.itch.io/medieval-item-pack https://arongranberg.com/astar/ <- Free version assetstore.unity.com/packages/2d/fonts/fatality-fps-gaming-font-216954 <- for some debug stuff https://craftpix.net/freebies/free-top-down-animals-farm-pixel-art-sprites/ <- placeholder sprites +https://bonvicio.itch.io/pixel-art-bonfire \ No newline at end of file diff --git a/Assets/Scenes/AppleHillsOverworld.unity b/Assets/Scenes/AppleHillsOverworld.unity index d44ab92c..69569560 100644 --- a/Assets/Scenes/AppleHillsOverworld.unity +++ b/Assets/Scenes/AppleHillsOverworld.unity @@ -283,6 +283,93 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: b5fc01af35233eb4cbeede05e50a7c34, type: 3} +--- !u!1 &124275611 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 124275612} + - component: {fileID: 124275613} + m_Layer: 0 + m_Name: SlotItem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &124275612 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 124275611} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1631660123} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &124275613 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 124275611} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 0 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &189988799 GameObject: m_ObjectHideFlags: 0 @@ -807,11 +894,11 @@ PrefabInstance: objectReference: {fileID: 11400000, guid: 8b2616beb14825a46b9b1ed85ad3cb25, type: 2} - target: {fileID: 1730119453103664125, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} propertyPath: m_LocalPosition.x - value: -5.64 + value: -10.37 objectReference: {fileID: 0} - target: {fileID: 1730119453103664125, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} propertyPath: m_LocalPosition.y - value: -14.25 + value: -15.31 objectReference: {fileID: 0} - target: {fileID: 1730119453103664125, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} propertyPath: m_LocalPosition.z @@ -982,6 +1069,137 @@ Transform: m_CorrespondingSourceObject: {fileID: 3823830588451517910, guid: 301b4e0735896334f8f6fb9a68a7e419, type: 3} m_PrefabInstance: {fileID: 8865498003578620591} m_PrefabAsset: {fileID: 0} +--- !u!1001 &1336824707 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 592045584872845087, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: itemData + value: + objectReference: {fileID: 11400000, guid: e0fad48a84a6b6346ac17c84bc512500, type: 2} + - target: {fileID: 1730119453103664125, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_LocalScale.x + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 1730119453103664125, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_LocalScale.y + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 1730119453103664125, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_LocalScale.z + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 1730119453103664125, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_LocalPosition.x + value: 6.18 + objectReference: {fileID: 0} + - target: {fileID: 1730119453103664125, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_LocalPosition.y + value: -13.06 + objectReference: {fileID: 0} + - target: {fileID: 1730119453103664125, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1730119453103664125, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1730119453103664125, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1730119453103664125, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1730119453103664125, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1730119453103664125, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1730119453103664125, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1730119453103664125, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1730119453103664125, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_ConstrainProportionsScale + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3070149615425714466, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_SpriteTilingProperty.pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3070149615425714466, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_SpriteTilingProperty.pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3070149615425714466, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_SpriteTilingProperty.newSize.x + value: 0.2 + objectReference: {fileID: 0} + - target: {fileID: 3070149615425714466, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_SpriteTilingProperty.newSize.y + value: 0.29 + objectReference: {fileID: 0} + - target: {fileID: 3070149615425714466, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_SpriteTilingProperty.oldSize.x + value: 0.2 + objectReference: {fileID: 0} + - target: {fileID: 3070149615425714466, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_SpriteTilingProperty.oldSize.y + value: 0.29 + objectReference: {fileID: 0} + - target: {fileID: 3070149615425714466, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_SpriteTilingProperty.adaptiveTilingThreshold + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 7447346505753002421, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_Name + value: Bonfire + objectReference: {fileID: 0} + - target: {fileID: 7494677664706785084, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_Size.x + value: 0.2 + objectReference: {fileID: 0} + - target: {fileID: 7494677664706785084, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_Size.y + value: 0.29 + objectReference: {fileID: 0} + - target: {fileID: 7494677664706785084, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_Sprite + value: + objectReference: {fileID: 6277786745957211492, guid: 016288f704d38e747a8eac9795051717, type: 3} + - target: {fileID: 7494677664706785084, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_SpriteSortPoint + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7494677664706785084, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + propertyPath: m_WasSpriteAssigned + value: 1 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: + - targetCorrespondingSourceObject: {fileID: 1730119453103664125, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + insertIndex: -1 + addedObject: {fileID: 124275612} + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 7447346505753002421, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + insertIndex: -1 + addedObject: {fileID: 1631660124} + m_SourcePrefab: {fileID: 100100000, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} --- !u!4 &1553825406 stripped Transform: m_CorrespondingSourceObject: {fileID: 2844046668579196942, guid: b5fc01af35233eb4cbeede05e50a7c34, type: 3} @@ -1123,6 +1341,36 @@ Transform: m_CorrespondingSourceObject: {fileID: 2844046668579196942, guid: b5fc01af35233eb4cbeede05e50a7c34, type: 3} m_PrefabInstance: {fileID: 448642088} m_PrefabAsset: {fileID: 0} +--- !u!1 &1631660118 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 7447346505753002421, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + m_PrefabInstance: {fileID: 1336824707} + m_PrefabAsset: {fileID: 0} +--- !u!4 &1631660123 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 1730119453103664125, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} + m_PrefabInstance: {fileID: 1336824707} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1631660124 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1631660118} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ec1a2e6e32f746c4990c579e13b79104, type: 3} + m_Name: + m_EditorClassIdentifier: + OnSuccess: + m_PersistentCalls: + m_Calls: [] + OnFailure: + m_PersistentCalls: + m_Calls: [] + currentlySlottedItem: {fileID: 0} + slottedItemRenderer: {fileID: 124275613} --- !u!1 &1728894744 GameObject: m_ObjectHideFlags: 0 @@ -23399,3 +23647,4 @@ SceneRoots: - {fileID: 1255598768} - {fileID: 1578994555} - {fileID: 1234715653} + - {fileID: 1336824707} diff --git a/Assets/Scripts/FollowerController.cs b/Assets/Scripts/FollowerController.cs index 08ea6c23..33868aa5 100644 --- a/Assets/Scripts/FollowerController.cs +++ b/Assets/Scripts/FollowerController.cs @@ -276,6 +276,12 @@ public class FollowerController : MonoBehaviour var pickup = hit.GetComponent(); if (pickup != null) { + var slotBehavior = pickup.GetComponent(); + if (slotBehavior != null) + { + // Slot item: do not destroy or swap, just return to player + break; + } if (justCombined) { // Combination: just destroy the pickup, don't spawn anything diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 26e44051..144765db 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -57,5 +57,16 @@ public class GameManager : MonoBehaviour } return null; } + + public GameSettings.SlotItemConfig GetSlotItemConfig(PickupItemData slotItem) + { + if (gameSettings == null || gameSettings.slotItemConfigs == null || slotItem == null) return null; + foreach (var config in gameSettings.slotItemConfigs) + { + if (config.slotItem == slotItem) + return config; + } + return null; + } // Add more accessors as needed } diff --git a/Assets/Scripts/GameSettings.cs b/Assets/Scripts/GameSettings.cs index d5463c5d..fc58cd53 100644 --- a/Assets/Scripts/GameSettings.cs +++ b/Assets/Scripts/GameSettings.cs @@ -35,8 +35,16 @@ public class GameSettings : ScriptableObject public PickupItemData result; } - [Header("Combination Rules")] + [System.Serializable] + public class SlotItemConfig { + public PickupItemData slotItem; // The slot object (SO reference) + public System.Collections.Generic.List allowedItems; + public System.Collections.Generic.List forbiddenItems; + } + + [Header("Item Configuration")] public System.Collections.Generic.List combinationRules; + public System.Collections.Generic.List slotItemConfigs; // Singleton pattern private static GameSettings _instance; diff --git a/Assets/Scripts/Pickup.cs b/Assets/Scripts/Pickup.cs index 62483406..11684087 100644 --- a/Assets/Scripts/Pickup.cs +++ b/Assets/Scripts/Pickup.cs @@ -127,6 +127,15 @@ public class Pickup : MonoBehaviour playerController.OnArrivedAtTarget += OnPlayerArrived; playerController.OnMoveToCancelled += OnPlayerMoveCancelled; Vector3 stopPoint = transform.position + (playerObj.transform.position - transform.position).normalized * playerStopDistance; - playerController.MoveToAndNotify(stopPoint); + float dist = Vector2.Distance(new Vector2(playerObj.transform.position.x, playerObj.transform.position.y), new Vector2(stopPoint.x, stopPoint.y)); + if (dist <= 0.2f) + { + // Already within stop range, trigger arrival logic immediately + OnPlayerArrived(); + } + else + { + playerController.MoveToAndNotify(stopPoint); + } } } diff --git a/Assets/Scripts/SlotItemBehavior.cs b/Assets/Scripts/SlotItemBehavior.cs new file mode 100644 index 00000000..85ee0ce8 --- /dev/null +++ b/Assets/Scripts/SlotItemBehavior.cs @@ -0,0 +1,96 @@ +using UnityEngine; +using UnityEngine.Events; +using System.Collections.Generic; + +[RequireComponent(typeof(Interactable))] +[RequireComponent(typeof(Pickup))] +public class SlotItemBehavior : InteractionRequirementBase +{ + [Header("Slot State")] + public PickupItemData currentlySlottedItem; + public SpriteRenderer slottedItemRenderer; + + public override bool TryInteract(FollowerController follower) + { + var heldItem = follower.currentlyHeldItem; + var pickup = GetComponent(); + var slotItem = pickup != null ? pickup.itemData : null; + var config = GameManager.Instance.GetSlotItemConfig(slotItem); + var allowed = config?.allowedItems ?? new List(); + var forbidden = config?.forbiddenItems ?? new List(); + + // CASE 1: No held item, slot has item -> pick up slotted item + if (heldItem == null && currentlySlottedItem != null) + { + follower.SetHeldItem(currentlySlottedItem); + currentlySlottedItem = null; + UpdateSlottedSprite(); + return true; + } + // CASE 2: Held item, slot has item -> swap + if (heldItem != null && currentlySlottedItem != null) + { + var temp = currentlySlottedItem; + currentlySlottedItem = heldItem; + UpdateSlottedSprite(); + follower.SetHeldItem(temp); + return true; + } + // CASE 3: Held item, slot empty -> slot the held item + if (heldItem != null && currentlySlottedItem == null) + { + if (forbidden.Contains(heldItem)) + { + DebugUIMessage.Show("Can't place that here."); + return false; + } + currentlySlottedItem = heldItem; + UpdateSlottedSprite(); + follower.SetHeldItem(null); + if (allowed.Contains(heldItem)) + { + OnSuccess?.Invoke(); + return true; + } + else + { + DebugUIMessage.Show("I'm not sure this works."); + OnFailure?.Invoke(); + return true; + } + } + // CASE 4: No held item, slot empty -> show warning + if (heldItem == null && currentlySlottedItem == null) + { + DebugUIMessage.Show("This requires an item."); + return false; + } + return false; + } + + private void UpdateSlottedSprite() + { + if (slottedItemRenderer != null && currentlySlottedItem != null && currentlySlottedItem.mapSprite != null) + { + slottedItemRenderer.sprite = currentlySlottedItem.mapSprite; + // Scale sprite to desired height, preserve aspect ratio, compensate for parent scale + float desiredHeight = GameManager.Instance.HeldIconDisplayHeight; + var sprite = currentlySlottedItem.mapSprite; + float spriteHeight = sprite.bounds.size.y; + float spriteWidth = sprite.bounds.size.x; + Vector3 parentScale = slottedItemRenderer.transform.parent != null + ? slottedItemRenderer.transform.parent.localScale + : Vector3.one; + if (spriteHeight > 0f) + { + float uniformScale = desiredHeight / spriteHeight; + float scale = uniformScale / Mathf.Max(parentScale.x, parentScale.y); + slottedItemRenderer.transform.localScale = new Vector3(scale, scale, 1f); + } + } + else if (slottedItemRenderer != null) + { + slottedItemRenderer.sprite = null; + } + } +} diff --git a/Assets/Scripts/SlotItemBehavior.cs.meta b/Assets/Scripts/SlotItemBehavior.cs.meta new file mode 100644 index 00000000..08271f7f --- /dev/null +++ b/Assets/Scripts/SlotItemBehavior.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ec1a2e6e32f746c4990c579e13b79104 +timeCreated: 1756985692 \ No newline at end of file