Compare commits

...

2 Commits

Author SHA1 Message Date
Michal Pikulski
32888a6843 [Interactions] Switch interactables to trace on layer configured in game settings 2025-09-08 12:51:33 +02:00
Michal Pikulski
749d72904e Add main menu scene, setup framework for orientation switching 2025-09-08 12:44:35 +02:00
34 changed files with 2008 additions and 77 deletions

View File

@@ -17,3 +17,4 @@ MonoBehaviour:
- {fileID: 3304458114253143478, guid: 7244cf6c7874ae448bc99d0c26416ad3, type: 3} - {fileID: 3304458114253143478, guid: 7244cf6c7874ae448bc99d0c26416ad3, type: 3}
- {fileID: 458265635552197097, guid: a77d1e8b2fa8aa945a6f39b312536e0d, type: 3} - {fileID: 458265635552197097, guid: a77d1e8b2fa8aa945a6f39b312536e0d, type: 3}
- {fileID: 552225285624929822, guid: e39992796d5459442be9967c77e27066, type: 3} - {fileID: 552225285624929822, guid: e39992796d5459442be9967c77e27066, type: 3}
- {fileID: 7644433920135100480, guid: 12d242e44fe80ab44af852254b7cab0f, type: 3}

View File

@@ -32,6 +32,9 @@ MonoBehaviour:
endlessDescenderClampXMin: -3.5 endlessDescenderClampXMin: -3.5
endlessDescenderClampXMax: 3.5 endlessDescenderClampXMax: 3.5
endlessDescenderSpeedExponent: 0.97 endlessDescenderSpeedExponent: 0.97
interactableLayerMask:
serializedVersion: 2
m_Bits: 1024
combinationRules: combinationRules:
- itemA: {fileID: 11400000, guid: 33e7ca06b22108d4e802486e08bcdfd1, type: 2} - itemA: {fileID: 11400000, guid: 33e7ca06b22108d4e802486e08bcdfd1, type: 2}
itemB: {fileID: 11400000, guid: 8b2616beb14825a46b9b1ed85ad3cb25, type: 2} itemB: {fileID: 11400000, guid: 8b2616beb14825a46b9b1ed85ad3cb25, type: 2}

View File

@@ -0,0 +1,19 @@
%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: 46888a96d57e4761a5d16861b5b0a9b1, type: 3}
m_Name: SceneOrientationConfig
m_EditorClassIdentifier:
sceneOrientations:
- sceneName: AppleHillsOverworld
requiredOrientation: 1
- sceneName: Quarry
requiredOrientation: 0

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5b21ef7a641efc44894a81133f630a72
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -3,4 +3,5 @@ https://arongranberg.com/astar/ <- Free version
assetstore.unity.com/packages/2d/fonts/fatality-fps-gaming-font-216954 <- for some debug stuff 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://craftpix.net/freebies/free-top-down-animals-farm-pixel-art-sprites/ <- placeholder sprites
https://bonvicio.itch.io/pixel-art-bonfire https://bonvicio.itch.io/pixel-art-bonfire
https://assetstore.unity.com/packages/tools/physics/optimized-ropes-and-cables-tool-287164 https://assetstore.unity.com/packages/tools/physics/optimized-ropes-and-cables-tool-287164
https://www.vecteezy.com/vector-art/5380184-phone-rotation-icon-symbol-tilting-screen-flat-design-on-white-background

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@@ -0,0 +1,247 @@
fileFormatVersion: 2
guid: ea7e819e86dd94d4cb82c1b22e0eee4b
TextureImporter:
internalIDToNameTable:
- first:
213: -9200460974075412672
second: phone_rotate_icon_0
- first:
213: -2320685753038348737
second: phone_rotate_icon_1
- first:
213: -3973883825926085703
second: phone_rotate_icon_2
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: phone_rotate_icon_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 607
height: 783
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 04ff36e7d75615080800000000000000
internalID: -9200460974075412672
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: phone_rotate_icon_1
rect:
serializedVersion: 2
x: 86
y: 79
width: 1069
height: 1151
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: f3ed6d66a944bcfd0800000000000000
internalID: -2320685753038348737
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: phone_rotate_icon_2
rect:
serializedVersion: 2
x: 627
y: 526
width: 608
height: 782
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 9b3610107bde9d8c0800000000000000
internalID: -3973883825926085703
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
phone_rotate_icon_0: -9200460974075412672
phone_rotate_icon_1: -2320685753038348737
phone_rotate_icon_2: -3973883825926085703
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -181,7 +181,7 @@ MonoBehaviour:
rotationSpeed: 360 rotationSpeed: 360
slowdownDistance: 3 slowdownDistance: 3
pickNextWaypointDist: 4 pickNextWaypointDist: 4
endReachedDistance: 1 endReachedDistance: 0.2
alwaysDrawGizmos: 1 alwaysDrawGizmos: 1
slowWhenNotFacingTarget: 1 slowWhenNotFacingTarget: 1
whenCloseToDestination: 0 whenCloseToDestination: 0

View File

@@ -13,7 +13,7 @@ GameObject:
- component: {fileID: 3070149615425714466} - component: {fileID: 3070149615425714466}
- component: {fileID: 7616859841301711022} - component: {fileID: 7616859841301711022}
- component: {fileID: 592045584872845087} - component: {fileID: 592045584872845087}
m_Layer: 0 m_Layer: 10
m_Name: BasePickup m_Name: BasePickup
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}

View File

@@ -98,11 +98,11 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7447346505753002421, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} - target: {fileID: 7447346505753002421, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: TestApple value: TestAss
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7447346505753002421, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} - target: {fileID: 7447346505753002421, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3}
propertyPath: m_Layer propertyPath: m_Layer
value: 6 value: 10
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7494677664706785084, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} - target: {fileID: 7494677664706785084, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3}
propertyPath: m_Size.x propertyPath: m_Size.x

View File

@@ -13,7 +13,7 @@ GameObject:
- component: {fileID: 841695541655102207} - component: {fileID: 841695541655102207}
- component: {fileID: 4981092805118965486} - component: {fileID: 4981092805118965486}
- component: {fileID: 1397300447834037203} - component: {fileID: 1397300447834037203}
m_Layer: 0 m_Layer: 10
m_Name: BaseLevelSwitch m_Name: BaseLevelSwitch
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}

View File

@@ -0,0 +1,51 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7644433920135100480
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8950196090942657951}
- component: {fileID: 8580662658518916835}
m_Layer: 0
m_Name: OrientationEnforcer
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8950196090942657951
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7644433920135100480}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -5.02902, y: -8.20187, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &8580662658518916835
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7644433920135100480}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5be782e6ff7641519b9bad2e7552d4e8, type: 3}
m_Name:
m_EditorClassIdentifier:
orientationConfig: {fileID: 0}
orientationPromptPrefab: {fileID: 0}
OnOrientationCorrect:
m_PersistentCalls:
m_Calls: []

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 12d242e44fe80ab44af852254b7cab0f
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1042,6 +1042,107 @@ PrefabInstance:
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 1631660124} addedObject: {fileID: 1631660124}
m_SourcePrefab: {fileID: 100100000, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3} m_SourcePrefab: {fileID: 100100000, guid: bf4b9d7045397f946b2125b1ad4a3fbd, type: 3}
--- !u!1 &1369934763
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1369934767}
- component: {fileID: 1369934766}
- component: {fileID: 1369934765}
- component: {fileID: 1369934764}
m_Layer: 5
m_Name: RotatePhonePrompt
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1369934764
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1369934763}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &1369934765
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1369934763}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 1920, y: 1080}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0.7
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &1369934766
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1369934763}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 0
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &1369934767
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1369934763}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!4 &1553825406 stripped --- !u!4 &1553825406 stripped
Transform: Transform:
m_CorrespondingSourceObject: {fileID: 2844046668579196942, guid: b5fc01af35233eb4cbeede05e50a7c34, type: 3} m_CorrespondingSourceObject: {fileID: 2844046668579196942, guid: b5fc01af35233eb4cbeede05e50a7c34, type: 3}
@@ -23468,10 +23569,6 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: Player value: Player
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7393789300602426170, guid: 301b4e0735896334f8f6fb9a68a7e419, type: 3}
propertyPath: endReachedDistance
value: 0.2
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
@@ -23493,3 +23590,4 @@ SceneRoots:
- {fileID: 1578994555} - {fileID: 1578994555}
- {fileID: 1234715653} - {fileID: 1234715653}
- {fileID: 1336824707} - {fileID: 1336824707}
- {fileID: 1369934767}

View File

@@ -440950,7 +440950,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1443463278548606047, guid: e660bbbe18c2a044f9f066822a6fd703, type: 3} - target: {fileID: 1443463278548606047, guid: e660bbbe18c2a044f9f066822a6fd703, type: 3}
propertyPath: m_Layer propertyPath: m_Layer
value: 0 value: 10
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4092047856540417737, guid: e660bbbe18c2a044f9f066822a6fd703, type: 3} - target: {fileID: 4092047856540417737, guid: e660bbbe18c2a044f9f066822a6fd703, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x

1002
Assets/Scenes/MainMenu.unity Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b93f2f3b39a62684c8474ba79c8f698d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -58,6 +58,7 @@ public class GameManager : MonoBehaviour
public float FollowerSpeedMultiplier => gameSettings != null ? gameSettings.followerSpeedMultiplier : 1.2f; public float FollowerSpeedMultiplier => gameSettings != null ? gameSettings.followerSpeedMultiplier : 1.2f;
public float HeldIconDisplayHeight => gameSettings != null ? gameSettings.heldIconDisplayHeight : 2.0f; public float HeldIconDisplayHeight => gameSettings != null ? gameSettings.heldIconDisplayHeight : 2.0f;
public GameObject BasePickupPrefab => gameSettings != null ? gameSettings.basePickupPrefab : null; public GameObject BasePickupPrefab => gameSettings != null ? gameSettings.basePickupPrefab : null;
public LayerMask InteractableLayerMask => gameSettings != null ? gameSettings.interactableLayerMask : -1;
/// <summary> /// <summary>
/// Returns the combination rule for two items, if any. /// Returns the combination rule for two items, if any.

View File

@@ -45,6 +45,10 @@ public class GameSettings : ScriptableObject
[Tooltip("Exponent for speed drop-off curve (higher = sharper drop near target)")] [Tooltip("Exponent for speed drop-off curve (higher = sharper drop near target)")]
public float endlessDescenderSpeedExponent = 2.5f; public float endlessDescenderSpeedExponent = 2.5f;
[Header("InputManager Settings")]
[Tooltip("Layer(s) to use for interactable objects.")]
public LayerMask interactableLayerMask = -1; // Default to Everything
[System.Serializable] [System.Serializable]
public class CombinationRule { public class CombinationRule {
public PickupItemData itemA; public PickupItemData itemA;

View File

@@ -149,18 +149,29 @@ public class InputManager : MonoBehaviour
/// <summary> /// <summary>
/// Attempts to delegate a tap to an interactable at the given world position. /// Attempts to delegate a tap to an interactable at the given world position.
/// Traces on the "Interactable" channel and logs detailed info.
/// </summary> /// </summary>
private bool TryDelegateToInteractable(Vector2 worldPos) private bool TryDelegateToInteractable(Vector2 worldPos)
{ {
Collider2D hit = Physics2D.OverlapPoint(worldPos); LayerMask mask = GameManager.Instance != null ? GameManager.Instance.InteractableLayerMask : -1;
Collider2D hit = Physics2D.OverlapPoint(worldPos, mask);
if (hit != null) if (hit != null)
{ {
var interactable = hit.GetComponent<ITouchInputConsumer>(); var interactable = hit.GetComponent<ITouchInputConsumer>();
if (interactable != null) if (interactable != null)
{ {
Debug.unityLogger.Log("Interactable", $"[InputManager] Delegating tap to interactable at {worldPos} (GameObject: {hit.gameObject.name})");
interactable.OnTap(worldPos); interactable.OnTap(worldPos);
return true; return true;
} }
else
{
Debug.unityLogger.Log("Interactable", $"[InputManager] Collider2D hit at {worldPos} (GameObject: {hit.gameObject.name}), but no ITouchInputConsumer found.");
}
}
else
{
Debug.unityLogger.Log("Interactable", $"[InputManager] No Collider2D found at {worldPos} for interactable delegation.");
} }
return false; return false;
} }

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3b8016679a814f4ebc03e4f8e59ee0e2
timeCreated: 1757316711

View File

@@ -0,0 +1,29 @@
using UnityEngine;
using System.Collections.Generic;
namespace Settings
{
[CreateAssetMenu(fileName = "SceneOrientationConfig", menuName = "Settings/Scene Orientation Config")]
public class SceneOrientationConfig : ScriptableObject
{
[System.Serializable]
public class SceneOrientationEntry
{
public string sceneName;
public ScreenOrientationRequirement requiredOrientation;
}
public List<SceneOrientationEntry> sceneOrientations = new List<SceneOrientationEntry>();
public ScreenOrientationRequirement GetRequirementForScene(string sceneName)
{
foreach (var entry in sceneOrientations)
{
if (entry.sceneName == sceneName)
return entry.requiredOrientation;
}
// Default to Portrait if not found
return ScreenOrientationRequirement.Portrait;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 46888a96d57e4761a5d16861b5b0a9b1
timeCreated: 1757316711

View File

@@ -0,0 +1,9 @@
namespace Settings
{
public enum ScreenOrientationRequirement
{
Portrait,
Landscape
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f1a3b10d13874397abfc29e36c1633ef
timeCreated: 1757316711

8
Assets/Scripts/UI.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 364c78baf25bd6a49a93580fc0384138
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,19 @@
using UnityEngine;
using UnityEngine.SceneManagement;
public class MainMenu : MonoBehaviour
{
public void StartGame()
{
// Replace with the actual scene name as set in Build Settings
SceneManager.LoadScene("AppleHillsOverworld");
}
public void QuitGame()
{
Application.Quit();
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#endif
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 1db41e23e1963544989e5298f201e730

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 91906734c1e6462b86642f3b19844694
timeCreated: 1757316712

View File

@@ -0,0 +1,114 @@
using UnityEngine;
using UnityEngine.SceneManagement;
using System;
using Settings;
namespace Utility
{
public class SceneOrientationEnforcer : MonoBehaviour
{
private static SceneOrientationEnforcer _instance;
private static bool _isQuitting;
public static SceneOrientationEnforcer Instance
{
get
{
if (_instance == null && Application.isPlaying && !_isQuitting)
{
_instance = FindAnyObjectByType<SceneOrientationEnforcer>();
if (_instance == null)
{
var go = new GameObject("SceneOrientationEnforcer");
_instance = go.AddComponent<SceneOrientationEnforcer>();
// DontDestroyOnLoad(go); // Uncomment if you want persistence
}
}
return _instance;
}
}
[Header("Config")]
public SceneOrientationConfig orientationConfig;
public GameObject orientationPromptPrefab;
public event Action OnOrientationCorrect;
private GameObject promptInstance;
private ScreenOrientationRequirement requiredOrientation;
private bool orientationCorrect;
private Coroutine orientationCheckCoroutine;
void Awake()
{
_instance = this;
OnOrientationCorrect += HandleOrientationCorrect;
}
void Start()
{
string sceneName = SceneManager.GetActiveScene().name;
requiredOrientation = orientationConfig != null ? orientationConfig.GetRequirementForScene(sceneName) : ScreenOrientationRequirement.Portrait;
orientationCorrect = IsOrientationCorrect();
if (!orientationCorrect)
{
ShowPrompt();
orientationCheckCoroutine = StartCoroutine(OrientationCheckRoutine());
}
}
private bool IsOrientationCorrect()
{
switch (requiredOrientation)
{
case ScreenOrientationRequirement.Portrait:
return Screen.height >= Screen.width;
case ScreenOrientationRequirement.Landscape:
return Screen.width > Screen.height;
default:
return true;
}
}
private System.Collections.IEnumerator OrientationCheckRoutine()
{
while (!IsOrientationCorrect())
{
yield return new WaitForSeconds(0.5f);
}
orientationCorrect = true;
OnOrientationCorrect?.Invoke();
}
private void ShowPrompt()
{
if (orientationPromptPrefab != null && promptInstance == null)
{
promptInstance = Instantiate(orientationPromptPrefab);
}
}
private void HandleOrientationCorrect()
{
if (promptInstance != null)
{
Destroy(promptInstance);
promptInstance = null;
}
if (orientationCheckCoroutine != null)
{
StopCoroutine(orientationCheckCoroutine);
orientationCheckCoroutine = null;
}
}
void OnDestroy()
{
OnOrientationCorrect -= HandleOrientationCorrect;
}
void OnApplicationQuit()
{
_isQuitting = true;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5be782e6ff7641519b9bad2e7552d4e8
timeCreated: 1757316712

File diff suppressed because one or more lines are too long

View File

@@ -6,7 +6,7 @@
"com.unity.addressables.android": "1.0.6", "com.unity.addressables.android": "1.0.6",
"com.unity.cinemachine": "3.1.4", "com.unity.cinemachine": "3.1.4",
"com.unity.feature.2d": "2.0.1", "com.unity.feature.2d": "2.0.1",
"com.unity.ide.rider": "3.0.36", "com.unity.ide.rider": "3.0.37",
"com.unity.inputsystem": "1.14.2", "com.unity.inputsystem": "1.14.2",
"com.unity.multiplayer.center": "1.0.0", "com.unity.multiplayer.center": "1.0.0",
"com.unity.render-pipelines.universal": "17.1.0", "com.unity.render-pipelines.universal": "17.1.0",

View File

@@ -176,7 +176,7 @@
} }
}, },
"com.unity.ide.rider": { "com.unity.ide.rider": {
"version": "3.0.36", "version": "3.0.37",
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": { "dependencies": {