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 00000000..a7d878a6 Binary files /dev/null and b/Assets/External/Placeholders/Bonfire_3.png differ 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