Compare commits
5 Commits
dialogue_i
...
pause_mini
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e17516df7 | ||
| 3807ac652c | |||
| 7b949c5cb8 | |||
|
|
005cf510d5 | ||
| a91b776c20 |
@@ -21,7 +21,7 @@ AnimationClip:
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
- time: 0
|
||||
value: {fileID: 768869974157336279, guid: ab1e8f5d45ee00247af9314b56f4af91, type: 3}
|
||||
value: {fileID: 7799044408606403673, guid: ab1e8f5d45ee00247af9314b56f4af91, type: 3}
|
||||
- time: 0.016666668
|
||||
value: {fileID: 8906880750509030790, guid: ab1e8f5d45ee00247af9314b56f4af91, type: 3}
|
||||
- time: 0.033333335
|
||||
@@ -144,6 +144,8 @@ AnimationClip:
|
||||
value: {fileID: -8322046293593963787, guid: ab1e8f5d45ee00247af9314b56f4af91, type: 3}
|
||||
- time: 1.0166667
|
||||
value: {fileID: 9103460804194853351, guid: ab1e8f5d45ee00247af9314b56f4af91, type: 3}
|
||||
- time: 1.0333333
|
||||
value: {fileID: 7799044408606403673, guid: ab1e8f5d45ee00247af9314b56f4af91, type: 3}
|
||||
attribute: m_Sprite
|
||||
path:
|
||||
classID: 212
|
||||
@@ -166,7 +168,7 @@ AnimationClip:
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
pptrCurveMapping:
|
||||
- {fileID: 768869974157336279, guid: ab1e8f5d45ee00247af9314b56f4af91, type: 3}
|
||||
- {fileID: 7799044408606403673, guid: ab1e8f5d45ee00247af9314b56f4af91, type: 3}
|
||||
- {fileID: 8906880750509030790, guid: ab1e8f5d45ee00247af9314b56f4af91, type: 3}
|
||||
- {fileID: 2041700527519432934, guid: ab1e8f5d45ee00247af9314b56f4af91, type: 3}
|
||||
- {fileID: -122113120711856545, guid: ab1e8f5d45ee00247af9314b56f4af91, type: 3}
|
||||
@@ -228,12 +230,13 @@ AnimationClip:
|
||||
- {fileID: 2840136614405453735, guid: ab1e8f5d45ee00247af9314b56f4af91, type: 3}
|
||||
- {fileID: -8322046293593963787, guid: ab1e8f5d45ee00247af9314b56f4af91, type: 3}
|
||||
- {fileID: 9103460804194853351, guid: ab1e8f5d45ee00247af9314b56f4af91, type: 3}
|
||||
- {fileID: 7799044408606403673, guid: ab1e8f5d45ee00247af9314b56f4af91, type: 3}
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 1.0333333
|
||||
m_StopTime: 1.05
|
||||
m_OrientationOffsetY: 0
|
||||
m_Level: 0
|
||||
m_CycleOffset: 0
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 349 KiB |
@@ -0,0 +1,286 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 86acdf12e6bc90b429ddb65f27b51aa0
|
||||
TextureImporter:
|
||||
internalIDToNameTable:
|
||||
- first:
|
||||
213: 1044824529263882793
|
||||
second: LuringspotB2_0
|
||||
- first:
|
||||
213: -4538801358949311540
|
||||
second: LuringspotB2_1
|
||||
- first:
|
||||
213: -7957117759914298804
|
||||
second: LuringspotB2_2
|
||||
- first:
|
||||
213: 7223264253169275753
|
||||
second: LuringspotB2_3
|
||||
- first:
|
||||
213: -2407001944034927372
|
||||
second: LuringspotB2_4
|
||||
- first:
|
||||
213: 6389133972800371574
|
||||
second: LuringspotB2_5
|
||||
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: 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: 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
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites:
|
||||
- serializedVersion: 2
|
||||
name: LuringspotB2_0
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 638
|
||||
y: 803
|
||||
width: 242
|
||||
height: 113
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
customData:
|
||||
outline: []
|
||||
physicsShape: []
|
||||
tessellationDetail: -1
|
||||
bones: []
|
||||
spriteID: 9227367af56ff7e00800000000000000
|
||||
internalID: 1044824529263882793
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
- serializedVersion: 2
|
||||
name: LuringspotB2_1
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 806
|
||||
y: 95
|
||||
width: 2311
|
||||
height: 1036
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
customData:
|
||||
outline: []
|
||||
physicsShape: []
|
||||
tessellationDetail: -1
|
||||
bones: []
|
||||
spriteID: ccb14cd2630f201c0800000000000000
|
||||
internalID: -4538801358949311540
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
- serializedVersion: 2
|
||||
name: LuringspotB2_2
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 594
|
||||
y: 470
|
||||
width: 212
|
||||
height: 155
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
customData:
|
||||
outline: []
|
||||
physicsShape: []
|
||||
tessellationDetail: -1
|
||||
bones: []
|
||||
spriteID: c423b545e83a29190800000000000000
|
||||
internalID: -7957117759914298804
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
- serializedVersion: 2
|
||||
name: LuringspotB2_3
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 716
|
||||
y: 612
|
||||
width: 187
|
||||
height: 132
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
customData:
|
||||
outline: []
|
||||
physicsShape: []
|
||||
tessellationDetail: -1
|
||||
bones: []
|
||||
spriteID: 9639ee851903e3460800000000000000
|
||||
internalID: 7223264253169275753
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
- serializedVersion: 2
|
||||
name: LuringspotB2_4
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 3064
|
||||
y: 574
|
||||
width: 366
|
||||
height: 165
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
customData:
|
||||
outline: []
|
||||
physicsShape: []
|
||||
tessellationDetail: -1
|
||||
bones: []
|
||||
spriteID: 4fc9f181c7c989ed0800000000000000
|
||||
internalID: -2407001944034927372
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
- serializedVersion: 2
|
||||
name: LuringspotB2_5
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 2954
|
||||
y: 387
|
||||
width: 226
|
||||
height: 146
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
customData:
|
||||
outline: []
|
||||
physicsShape: []
|
||||
tessellationDetail: -1
|
||||
bones: []
|
||||
spriteID: 67b75274f73caa850800000000000000
|
||||
internalID: 6389133972800371574
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable:
|
||||
LuringspotB2_0: 1044824529263882793
|
||||
LuringspotB2_1: -4538801358949311540
|
||||
LuringspotB2_2: -7957117759914298804
|
||||
LuringspotB2_3: 7223264253169275753
|
||||
LuringspotB2_4: -2407001944034927372
|
||||
LuringspotB2_5: 6389133972800371574
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
18
Assets/Data/Items/Basketball_pickup.asset
Normal file
18
Assets/Data/Items/Basketball_pickup.asset
Normal file
@@ -0,0 +1,18 @@
|
||||
%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: Basketball_pickup
|
||||
m_EditorClassIdentifier: AppleHillsScripts::PickupItemData
|
||||
_itemId: Basketball
|
||||
itemName: Basketball
|
||||
description:
|
||||
mapSprite: {fileID: -3019416885370694485, guid: ed57eef56cafff0428d08bce28798f58, type: 3}
|
||||
8
Assets/Data/Items/Basketball_pickup.asset.meta
Normal file
8
Assets/Data/Items/Basketball_pickup.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 43f22dbbb4c0eec4f8108d0f0eea43c2
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
18
Assets/Data/Items/BlueBall_pickup.asset
Normal file
18
Assets/Data/Items/BlueBall_pickup.asset
Normal file
@@ -0,0 +1,18 @@
|
||||
%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: BlueBall_pickup
|
||||
m_EditorClassIdentifier: AppleHillsScripts::PickupItemData
|
||||
_itemId: BlueBall
|
||||
itemName: BlueBall
|
||||
description:
|
||||
mapSprite: {fileID: 4799961156935096247, guid: 74289c1614ce2b2439a5d3ff60a90d66, type: 3}
|
||||
8
Assets/Data/Items/BlueBall_pickup.asset.meta
Normal file
8
Assets/Data/Items/BlueBall_pickup.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8baa800efa25a344a95b190cf349e2d
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
18
Assets/Data/Items/BowlingBall_pickup.asset
Normal file
18
Assets/Data/Items/BowlingBall_pickup.asset
Normal file
@@ -0,0 +1,18 @@
|
||||
%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: BowlingBall_pickup
|
||||
m_EditorClassIdentifier: AppleHillsScripts::PickupItemData
|
||||
_itemId: BowlingBall
|
||||
itemName: BoelingBall
|
||||
description:
|
||||
mapSprite: {fileID: -2082989857396687135, guid: f106ad45f67e9e74895c64edbc1e4614, type: 3}
|
||||
8
Assets/Data/Items/BowlingBall_pickup.asset.meta
Normal file
8
Assets/Data/Items/BowlingBall_pickup.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 560ba2059ce14dc4da580e2f43b2e65f
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
18
Assets/Data/Items/Yellowball_pickup.asset
Normal file
18
Assets/Data/Items/Yellowball_pickup.asset
Normal file
@@ -0,0 +1,18 @@
|
||||
%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: Yellowball_pickup
|
||||
m_EditorClassIdentifier: AppleHillsScripts::PickupItemData
|
||||
_itemId: YellowBall
|
||||
itemName: YellowBall
|
||||
description:
|
||||
mapSprite: {fileID: -4183208330383030991, guid: 26abd62d79d435f438c281aa83ee274a, type: 3}
|
||||
8
Assets/Data/Items/Yellowball_pickup.asset.meta
Normal file
8
Assets/Data/Items/Yellowball_pickup.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b1f3472171abc943bb099ce31d6fc7c
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
157
Assets/Prefabs/Items/Basketball.prefab
Normal file
157
Assets/Prefabs/Items/Basketball.prefab
Normal file
@@ -0,0 +1,157 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &2755476303005018105
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6133778293368838189}
|
||||
- component: {fileID: 6838888653638142452}
|
||||
- component: {fileID: 3696625264308890211}
|
||||
- component: {fileID: 4055726361761331703}
|
||||
- component: {fileID: 1226703179564388091}
|
||||
m_Layer: 10
|
||||
m_Name: Basketball
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &6133778293368838189
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2755476303005018105}
|
||||
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: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &6838888653638142452
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2755476303005018105}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 73d6494a73174ffabc6a7d3089d51e73, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: AppleHillsScripts::Interactions.Interactable
|
||||
isOneTime: 0
|
||||
cooldown: -1
|
||||
characterToInteract: 2
|
||||
interactionStarted:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
interactionInterrupted:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
characterArrived:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
interactionComplete:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!65 &3696625264308890211
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2755476303005018105}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &4055726361761331703
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2755476303005018105}
|
||||
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_ForceMeshLod: -1
|
||||
m_MeshLodSelectionBias: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
|
||||
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_GlobalIlluminationMeshLod: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 1
|
||||
m_Sprite: {fileID: -3019416885370694485, guid: ed57eef56cafff0428d08bce28798f58, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1.2, y: 1.21}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 1
|
||||
--- !u!114 &1226703179564388091
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2755476303005018105}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7846448751da4bdbaaa5cb87890dca42, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: AppleHillsScripts::Interactions.Pickup
|
||||
itemData: {fileID: 11400000, guid: 43f22dbbb4c0eec4f8108d0f0eea43c2, type: 2}
|
||||
iconRenderer: {fileID: 4055726361761331703}
|
||||
7
Assets/Prefabs/Items/Basketball.prefab.meta
Normal file
7
Assets/Prefabs/Items/Basketball.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 015a2865b4d5f6f45a9835b0117d9944
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
157
Assets/Prefabs/Items/BlueBall.prefab
Normal file
157
Assets/Prefabs/Items/BlueBall.prefab
Normal file
@@ -0,0 +1,157 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &5070378814342643473
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 9162571094694503926}
|
||||
- component: {fileID: 3036964942126424676}
|
||||
- component: {fileID: 8812271188036963294}
|
||||
- component: {fileID: 4774534086162962138}
|
||||
- component: {fileID: 5483561632297398438}
|
||||
m_Layer: 10
|
||||
m_Name: BlueBall
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &9162571094694503926
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5070378814342643473}
|
||||
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: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &3036964942126424676
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5070378814342643473}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 73d6494a73174ffabc6a7d3089d51e73, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: AppleHillsScripts::Interactions.Interactable
|
||||
isOneTime: 0
|
||||
cooldown: -1
|
||||
characterToInteract: 2
|
||||
interactionStarted:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
interactionInterrupted:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
characterArrived:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
interactionComplete:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!65 &8812271188036963294
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5070378814342643473}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &4774534086162962138
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5070378814342643473}
|
||||
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_ForceMeshLod: -1
|
||||
m_MeshLodSelectionBias: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
|
||||
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_GlobalIlluminationMeshLod: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 1
|
||||
m_Sprite: {fileID: 4799961156935096247, guid: 74289c1614ce2b2439a5d3ff60a90d66, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 0.95, y: 0.94}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 1
|
||||
--- !u!114 &5483561632297398438
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5070378814342643473}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7846448751da4bdbaaa5cb87890dca42, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: AppleHillsScripts::Interactions.Pickup
|
||||
itemData: {fileID: 11400000, guid: a8baa800efa25a344a95b190cf349e2d, type: 2}
|
||||
iconRenderer: {fileID: 4774534086162962138}
|
||||
7
Assets/Prefabs/Items/BlueBall.prefab.meta
Normal file
7
Assets/Prefabs/Items/BlueBall.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4694d95ffaa4a4343ae04db32b13cbcc
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
157
Assets/Prefabs/Items/BowlingBall.prefab
Normal file
157
Assets/Prefabs/Items/BowlingBall.prefab
Normal file
@@ -0,0 +1,157 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &2331806108796329904
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1099560239978781683}
|
||||
- component: {fileID: 2946468825538066170}
|
||||
- component: {fileID: 4272383251773444855}
|
||||
- component: {fileID: 4986096986936361008}
|
||||
- component: {fileID: 2753389442270867527}
|
||||
m_Layer: 10
|
||||
m_Name: BoelingBall
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1099560239978781683
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2331806108796329904}
|
||||
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: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &2946468825538066170
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2331806108796329904}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 73d6494a73174ffabc6a7d3089d51e73, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: AppleHillsScripts::Interactions.Interactable
|
||||
isOneTime: 0
|
||||
cooldown: -1
|
||||
characterToInteract: 2
|
||||
interactionStarted:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
interactionInterrupted:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
characterArrived:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
interactionComplete:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!65 &4272383251773444855
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2331806108796329904}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &4986096986936361008
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2331806108796329904}
|
||||
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_ForceMeshLod: -1
|
||||
m_MeshLodSelectionBias: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
|
||||
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_GlobalIlluminationMeshLod: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 1
|
||||
m_Sprite: {fileID: -2082989857396687135, guid: f106ad45f67e9e74895c64edbc1e4614, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1.28, y: 1.31}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 1
|
||||
--- !u!114 &2753389442270867527
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2331806108796329904}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7846448751da4bdbaaa5cb87890dca42, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: AppleHillsScripts::Interactions.Pickup
|
||||
itemData: {fileID: 11400000, guid: 560ba2059ce14dc4da580e2f43b2e65f, type: 2}
|
||||
iconRenderer: {fileID: 4986096986936361008}
|
||||
7
Assets/Prefabs/Items/BowlingBall.prefab.meta
Normal file
7
Assets/Prefabs/Items/BowlingBall.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d677a46297a07994fa1b551de27f821c
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
157
Assets/Prefabs/Items/Yellowball.prefab
Normal file
157
Assets/Prefabs/Items/Yellowball.prefab
Normal file
@@ -0,0 +1,157 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &825072831861764844
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 25208727450420889}
|
||||
- component: {fileID: 3384252353480975861}
|
||||
- component: {fileID: 8318004605383042340}
|
||||
- component: {fileID: 4266110216568578813}
|
||||
- component: {fileID: 1707774147108908574}
|
||||
m_Layer: 10
|
||||
m_Name: YellowBall
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &25208727450420889
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 825072831861764844}
|
||||
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: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &3384252353480975861
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 825072831861764844}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 73d6494a73174ffabc6a7d3089d51e73, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: AppleHillsScripts::Interactions.Interactable
|
||||
isOneTime: 0
|
||||
cooldown: -1
|
||||
characterToInteract: 2
|
||||
interactionStarted:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
interactionInterrupted:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
characterArrived:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
interactionComplete:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!65 &8318004605383042340
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 825072831861764844}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &4266110216568578813
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 825072831861764844}
|
||||
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_ForceMeshLod: -1
|
||||
m_MeshLodSelectionBias: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
|
||||
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_GlobalIlluminationMeshLod: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 1
|
||||
m_Sprite: {fileID: -4183208330383030991, guid: 26abd62d79d435f438c281aa83ee274a, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 0.76, y: 0.76}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 1
|
||||
--- !u!114 &1707774147108908574
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 825072831861764844}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7846448751da4bdbaaa5cb87890dca42, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: AppleHillsScripts::Interactions.Pickup
|
||||
itemData: {fileID: 11400000, guid: 3b1f3472171abc943bb099ce31d6fc7c, type: 2}
|
||||
iconRenderer: {fileID: 4266110216568578813}
|
||||
7
Assets/Prefabs/Items/Yellowball.prefab.meta
Normal file
7
Assets/Prefabs/Items/Yellowball.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3beba8513eb20af4493d170a3203efb0
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1087
Assets/Prefabs/Puzzles/AnneLiseBush.prefab
Normal file
1087
Assets/Prefabs/Puzzles/AnneLiseBush.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Prefabs/Puzzles/AnneLiseBush.prefab.meta
Normal file
7
Assets/Prefabs/Puzzles/AnneLiseBush.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b2926886934b554f9a1727331d34787
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,9 @@
|
||||
using UnityEngine;
|
||||
using AppleHills.Core.Settings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using AppleHills.Core.Interfaces;
|
||||
using UI;
|
||||
|
||||
/// <summary>
|
||||
/// Singleton manager for global game state and settings. Provides accessors for various gameplay parameters.
|
||||
@@ -36,6 +39,21 @@ public class GameManager : MonoBehaviour
|
||||
[SerializeField] private bool _developerSettingsLoaded = false;
|
||||
public bool SettingsLoaded => _settingsLoaded;
|
||||
public bool DeveloperSettingsLoaded => _developerSettingsLoaded;
|
||||
|
||||
[Header("Game State")]
|
||||
[SerializeField] private bool _isPaused = false;
|
||||
|
||||
/// <summary>
|
||||
/// Current pause state of the game
|
||||
/// </summary>
|
||||
public bool IsPaused => _isPaused;
|
||||
|
||||
// List of pausable components that have registered with the GameManager
|
||||
private List<IPausable> _pausableComponents = new List<IPausable>();
|
||||
|
||||
// Events for pause state changes
|
||||
public event Action OnGamePaused;
|
||||
public event Action OnGameResumed;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
@@ -53,6 +71,136 @@ public class GameManager : MonoBehaviour
|
||||
|
||||
// DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// Find and subscribe to PauseMenu events
|
||||
PauseMenu pauseMenu = PauseMenu.Instance;
|
||||
if (pauseMenu != null)
|
||||
{
|
||||
pauseMenu.OnGamePaused += OnPauseMenuPaused;
|
||||
pauseMenu.OnGameResumed += OnPauseMenuResumed;
|
||||
|
||||
Debug.Log("[GameManager] Subscribed to PauseMenu events");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("[GameManager] PauseMenu not found. Pause functionality won't work properly.");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
// Unsubscribe from PauseMenu events
|
||||
PauseMenu pauseMenu = FindFirstObjectByType<PauseMenu>();
|
||||
if (pauseMenu != null)
|
||||
{
|
||||
pauseMenu.OnGamePaused -= OnPauseMenuPaused;
|
||||
pauseMenu.OnGameResumed -= OnPauseMenuResumed;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register a component as pausable, so it receives pause/resume notifications
|
||||
/// </summary>
|
||||
/// <param name="component">The pausable component to register</param>
|
||||
public void RegisterPausableComponent(IPausable component)
|
||||
{
|
||||
if (component != null && !_pausableComponents.Contains(component))
|
||||
{
|
||||
_pausableComponents.Add(component);
|
||||
|
||||
// If the game is already paused, pause the component immediately
|
||||
if (_isPaused)
|
||||
{
|
||||
component.Pause();
|
||||
}
|
||||
|
||||
Debug.Log($"[GameManager] Registered pausable component: {(component as MonoBehaviour)?.name ?? "Unknown"}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unregister a pausable component
|
||||
/// </summary>
|
||||
/// <param name="component">The pausable component to unregister</param>
|
||||
public void UnregisterPausableComponent(IPausable component)
|
||||
{
|
||||
if (component != null && _pausableComponents.Contains(component))
|
||||
{
|
||||
_pausableComponents.Remove(component);
|
||||
Debug.Log($"[GameManager] Unregistered pausable component: {(component as MonoBehaviour)?.name ?? "Unknown"}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the PauseMenu broadcasts a pause event
|
||||
/// </summary>
|
||||
private void OnPauseMenuPaused()
|
||||
{
|
||||
PauseGame();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the PauseMenu broadcasts a resume event
|
||||
/// </summary>
|
||||
private void OnPauseMenuResumed()
|
||||
{
|
||||
ResumeGame();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pause the game and notify all registered pausable components
|
||||
/// </summary>
|
||||
public void PauseGame()
|
||||
{
|
||||
if (_isPaused) return; // Already paused
|
||||
|
||||
_isPaused = true;
|
||||
|
||||
// Pause all registered components
|
||||
foreach (var component in _pausableComponents)
|
||||
{
|
||||
component.Pause();
|
||||
}
|
||||
|
||||
// Broadcast pause event
|
||||
OnGamePaused?.Invoke();
|
||||
|
||||
Debug.Log($"[GameManager] Game paused. Paused {_pausableComponents.Count} components.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resume the game and notify all registered pausable components
|
||||
/// </summary>
|
||||
public void ResumeGame()
|
||||
{
|
||||
if (!_isPaused) return; // Already running
|
||||
|
||||
_isPaused = false;
|
||||
|
||||
// Resume all registered components
|
||||
foreach (var component in _pausableComponents)
|
||||
{
|
||||
component.Resume();
|
||||
}
|
||||
|
||||
// Broadcast resume event
|
||||
OnGameResumed?.Invoke();
|
||||
|
||||
Debug.Log($"[GameManager] Game resumed. Resumed {_pausableComponents.Count} components.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Toggle the pause state of the game
|
||||
/// </summary>
|
||||
public void TogglePause()
|
||||
{
|
||||
if (_isPaused)
|
||||
ResumeGame();
|
||||
else
|
||||
PauseGame();
|
||||
}
|
||||
|
||||
private void InitializeSettings()
|
||||
{
|
||||
@@ -164,5 +312,4 @@ public class GameManager : MonoBehaviour
|
||||
public float PlayerStopDistance => GetSettings<IInteractionSettings>()?.PlayerStopDistance ?? 6.0f;
|
||||
public float PlayerStopDistanceDirectInteraction => GetSettings<IInteractionSettings>()?.PlayerStopDistanceDirectInteraction ?? 2.0f;
|
||||
public float DefaultPuzzlePromptRange => GetSettings<IInteractionSettings>()?.DefaultPuzzlePromptRange ?? 3.0f;
|
||||
|
||||
}
|
||||
|
||||
3
Assets/Scripts/Core/Interfaces.meta
Normal file
3
Assets/Scripts/Core/Interfaces.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba87fe038e914973bc341817149a9ebe
|
||||
timeCreated: 1759916676
|
||||
25
Assets/Scripts/Core/Interfaces/IPausable.cs
Normal file
25
Assets/Scripts/Core/Interfaces/IPausable.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace AppleHills.Core.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface for components that can be paused and resumed
|
||||
/// </summary>
|
||||
public interface IPausable
|
||||
{
|
||||
/// <summary>
|
||||
/// Pauses the component's functionality
|
||||
/// </summary>
|
||||
void Pause();
|
||||
|
||||
/// <summary>
|
||||
/// Resumes the component's functionality
|
||||
/// </summary>
|
||||
void Resume();
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the component is currently paused
|
||||
/// </summary>
|
||||
bool IsPaused { get; }
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Core/Interfaces/IPausable.cs.meta
Normal file
3
Assets/Scripts/Core/Interfaces/IPausable.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3a493ef684ce47208a3f6e7d67727882
|
||||
timeCreated: 1759916676
|
||||
@@ -1,6 +1,7 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using Pooling;
|
||||
using AppleHills.Core.Interfaces;
|
||||
|
||||
namespace Minigames.DivingForPictures
|
||||
{
|
||||
@@ -8,7 +9,7 @@ namespace Minigames.DivingForPictures
|
||||
/// Represents a single bubble, handling its movement, wobble effect, scaling, and sprite assignment.
|
||||
/// Uses coroutines for better performance instead of Update() calls.
|
||||
/// </summary>
|
||||
public class Bubble : MonoBehaviour, IPoolableWithReference<BubblePool>
|
||||
public class Bubble : MonoBehaviour, IPoolableWithReference<BubblePool>, IPausable
|
||||
{
|
||||
public float speed = 1f;
|
||||
public float wobbleSpeed = 1f;
|
||||
@@ -26,6 +27,12 @@ namespace Minigames.DivingForPictures
|
||||
private Coroutine _movementCoroutine;
|
||||
private Coroutine _wobbleCoroutine;
|
||||
private Coroutine _offScreenCheckCoroutine;
|
||||
|
||||
// Pause state tracking
|
||||
private bool _isPaused = false;
|
||||
|
||||
// IPausable implementation
|
||||
public bool IsPaused => _isPaused;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
@@ -53,12 +60,42 @@ namespace Minigames.DivingForPictures
|
||||
{
|
||||
StopBubbleBehavior();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pauses all bubble behaviors
|
||||
/// </summary>
|
||||
public void Pause()
|
||||
{
|
||||
if (_isPaused) return; // Already paused
|
||||
|
||||
_isPaused = true;
|
||||
StopBubbleBehavior();
|
||||
|
||||
// Debug log for troubleshooting
|
||||
Debug.Log($"[Bubble] Paused bubble: {name}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resumes all bubble behaviors
|
||||
/// </summary>
|
||||
public void Resume()
|
||||
{
|
||||
if (!_isPaused) return; // Already running
|
||||
|
||||
_isPaused = false;
|
||||
StartBubbleBehavior();
|
||||
|
||||
// Debug log for troubleshooting
|
||||
Debug.Log($"[Bubble] Resumed bubble: {name}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts all bubble behavior coroutines
|
||||
/// </summary>
|
||||
private void StartBubbleBehavior()
|
||||
{
|
||||
if (_isPaused) return; // Don't start if paused
|
||||
|
||||
_movementCoroutine = StartCoroutine(MovementCoroutine());
|
||||
_wobbleCoroutine = StartCoroutine(WobbleCoroutine());
|
||||
_offScreenCheckCoroutine = StartCoroutine(OffScreenCheckCoroutine());
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using Pooling;
|
||||
using AppleHills.Core.Settings;
|
||||
using AppleHills.Core.Interfaces;
|
||||
|
||||
namespace Minigames.DivingForPictures
|
||||
{
|
||||
/// <summary>
|
||||
/// Spawns bubbles at intervals, randomizing their properties and assigning a random sprite to each.
|
||||
/// </summary>
|
||||
public class BubbleSpawner : MonoBehaviour
|
||||
public class BubbleSpawner : MonoBehaviour, IPausable
|
||||
{
|
||||
public Bubble bubblePrefab;
|
||||
public Sprite[] bubbleSprites; // Assign in inspector
|
||||
@@ -20,6 +22,15 @@ namespace Minigames.DivingForPictures
|
||||
private BubblePool _bubblePool;
|
||||
private Camera _mainCamera; // Cache camera reference
|
||||
private bool _isSurfacing = false;
|
||||
|
||||
// Pause state
|
||||
private bool _isPaused = false;
|
||||
|
||||
// Coroutines for pause/resume
|
||||
private Coroutine _spawnCoroutine;
|
||||
|
||||
// IPausable implementation
|
||||
public bool IsPaused => _isPaused;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
@@ -50,23 +61,110 @@ namespace Minigames.DivingForPictures
|
||||
InvokeRepeating(nameof(LogPoolStats), 5f, 30f);
|
||||
#endif
|
||||
}
|
||||
|
||||
SetNextSpawnInterval();
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
// Initialize the next spawn interval
|
||||
_nextSpawnInterval = GetRandomizedInterval();
|
||||
// Register with DivingGameManager for pause/resume events
|
||||
DivingGameManager gameManager = FindFirstObjectByType<DivingGameManager>();
|
||||
if (gameManager != null)
|
||||
{
|
||||
gameManager.RegisterPausableComponent(this);
|
||||
}
|
||||
|
||||
// Start spawning if not paused
|
||||
StartSpawningCoroutine();
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
// Unregister from DivingGameManager
|
||||
DivingGameManager gameManager = FindFirstObjectByType<DivingGameManager>();
|
||||
if (gameManager != null)
|
||||
{
|
||||
gameManager.UnregisterPausableComponent(this);
|
||||
}
|
||||
|
||||
// Clean up any active coroutines
|
||||
StopAllCoroutines();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pauses the bubble spawner and all bubbles
|
||||
/// </summary>
|
||||
public void Pause()
|
||||
{
|
||||
if (_isPaused) return; // Already paused
|
||||
|
||||
_isPaused = true;
|
||||
|
||||
// Stop spawning coroutine
|
||||
if (_spawnCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_spawnCoroutine);
|
||||
_spawnCoroutine = null;
|
||||
}
|
||||
|
||||
// Pause all active bubbles
|
||||
Bubble[] activeBubbles = FindObjectsOfType<Bubble>();
|
||||
foreach (var bubble in activeBubbles)
|
||||
{
|
||||
if (bubble != null)
|
||||
{
|
||||
bubble.Pause();
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log("[BubbleSpawner] Paused");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resumes the bubble spawner and all bubbles
|
||||
/// </summary>
|
||||
public void Resume()
|
||||
{
|
||||
if (!_isPaused) return; // Already running
|
||||
|
||||
_isPaused = false;
|
||||
|
||||
// Restart spawning coroutine
|
||||
StartSpawningCoroutine();
|
||||
|
||||
// Resume all active bubbles
|
||||
Bubble[] activeBubbles = FindObjectsOfType<Bubble>();
|
||||
foreach (var bubble in activeBubbles)
|
||||
{
|
||||
if (bubble != null)
|
||||
{
|
||||
bubble.Resume();
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log("[BubbleSpawner] Resumed");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the bubble spawning coroutine if it's not already running
|
||||
/// </summary>
|
||||
private void StartSpawningCoroutine()
|
||||
{
|
||||
if (_spawnCoroutine == null && !_isPaused)
|
||||
{
|
||||
_spawnCoroutine = StartCoroutine(SpawnBubblesRoutine());
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
/// <summary>
|
||||
/// Sets the next spawn interval using randomized timing
|
||||
/// </summary>
|
||||
private void SetNextSpawnInterval()
|
||||
{
|
||||
_timer += Time.deltaTime;
|
||||
if (_timer >= _nextSpawnInterval)
|
||||
{
|
||||
SpawnBubble();
|
||||
_timer = 0f;
|
||||
_nextSpawnInterval = GetRandomizedInterval();
|
||||
}
|
||||
if (_devSettings == null) return;
|
||||
|
||||
_nextSpawnInterval = GetRandomizedInterval();
|
||||
Debug.Log($"[BubbleSpawner] Next spawn interval set to: {_nextSpawnInterval:F2}s");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -128,6 +226,12 @@ namespace Minigames.DivingForPictures
|
||||
|
||||
// Pass min/max scale for wobble clamping
|
||||
bubble.SetWobbleScaleLimits(_devSettings.BubbleWobbleMinScale, _devSettings.BubbleWobbleMaxScale);
|
||||
|
||||
// If the game is already paused, pause this bubble immediately
|
||||
if (_isPaused)
|
||||
{
|
||||
bubble.Pause();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -159,5 +263,24 @@ namespace Minigames.DivingForPictures
|
||||
_bubblePool.LogPoolStats();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Coroutine that handles the bubble spawning logic
|
||||
/// </summary>
|
||||
private IEnumerator SpawnBubblesRoutine()
|
||||
{
|
||||
Debug.Log("[BubbleSpawner] Started bubble spawning coroutine");
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy && !_isPaused)
|
||||
{
|
||||
SpawnBubble();
|
||||
SetNextSpawnInterval(); // Set interval for next spawn
|
||||
yield return new WaitForSeconds(_nextSpawnInterval);
|
||||
}
|
||||
|
||||
_spawnCoroutine = null;
|
||||
|
||||
Debug.Log("[BubbleSpawner] Bubble spawning coroutine ended");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,12 @@ using UnityEngine.Events;
|
||||
using UnityEngine.Playables;
|
||||
using AppleHills.Core.Settings;
|
||||
using Utility;
|
||||
using AppleHills.Core.Interfaces;
|
||||
using UI;
|
||||
|
||||
namespace Minigames.DivingForPictures
|
||||
{
|
||||
public class DivingGameManager : MonoBehaviour
|
||||
public class DivingGameManager : MonoBehaviour, IPausable
|
||||
{
|
||||
[Header("Monster Prefabs")]
|
||||
[Tooltip("Array of monster prefabs to spawn randomly")]
|
||||
@@ -66,6 +68,15 @@ namespace Minigames.DivingForPictures
|
||||
// Event for game components to subscribe to
|
||||
public event Action OnGameInitialized;
|
||||
|
||||
// Pause state
|
||||
private bool _isPaused = false;
|
||||
|
||||
// List of pausable components controlled by this manager
|
||||
private List<IPausable> _pausableComponents = new List<IPausable>();
|
||||
|
||||
// IPausable implementation
|
||||
public bool IsPaused => _isPaused;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// Get settings from GameManager
|
||||
@@ -81,6 +92,26 @@ namespace Minigames.DivingForPictures
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// Find PauseMenu and subscribe to its events
|
||||
PauseMenu pauseMenu = PauseMenu.Instance;
|
||||
if (pauseMenu != null)
|
||||
{
|
||||
pauseMenu.OnGamePaused += Pause;
|
||||
pauseMenu.OnGameResumed += Resume;
|
||||
|
||||
Debug.Log("[DivingGameManager] Subscribed to PauseMenu events");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("[DivingGameManager] PauseMenu not found. Pause functionality won't work properly.");
|
||||
}
|
||||
|
||||
// Register this manager with the global GameManager
|
||||
if (GameManager.Instance != null)
|
||||
{
|
||||
GameManager.Instance.RegisterPausableComponent(this);
|
||||
}
|
||||
|
||||
// Subscribe to SceneOrientationEnforcer's event
|
||||
if (SceneOrientationEnforcer.Instance != null)
|
||||
{
|
||||
@@ -144,6 +175,23 @@ namespace Minigames.DivingForPictures
|
||||
{
|
||||
SceneOrientationEnforcer.Instance.OnOrientationCorrect -= InitializeGame;
|
||||
}
|
||||
|
||||
// Unsubscribe from PauseMenu events
|
||||
PauseMenu pauseMenu = PauseMenu.Instance;
|
||||
if (pauseMenu != null)
|
||||
{
|
||||
pauseMenu.OnGamePaused -= Pause;
|
||||
pauseMenu.OnGameResumed -= Resume;
|
||||
}
|
||||
|
||||
// Unregister from GameManager
|
||||
if (GameManager.Instance != null)
|
||||
{
|
||||
GameManager.Instance.UnregisterPausableComponent(this);
|
||||
}
|
||||
|
||||
// Unregister all pausable components
|
||||
_pausableComponents.Clear();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@@ -651,5 +699,74 @@ namespace Minigames.DivingForPictures
|
||||
// Final assignment to ensure exact target value
|
||||
OnVelocityFactorChanged?.Invoke(_currentVelocityFactor);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register a component as pausable with this manager
|
||||
/// </summary>
|
||||
/// <param name="component">The pausable component to register</param>
|
||||
public void RegisterPausableComponent(IPausable component)
|
||||
{
|
||||
if (component != null && !_pausableComponents.Contains(component))
|
||||
{
|
||||
_pausableComponents.Add(component);
|
||||
|
||||
// If the game is already paused, pause the component immediately
|
||||
if (_isPaused)
|
||||
{
|
||||
component.Pause();
|
||||
}
|
||||
|
||||
Debug.Log($"[DivingGameManager] Registered pausable component: {(component as MonoBehaviour)?.name ?? "Unknown"}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unregister a pausable component
|
||||
/// </summary>
|
||||
/// <param name="component">The pausable component to unregister</param>
|
||||
public void UnregisterPausableComponent(IPausable component)
|
||||
{
|
||||
if (component != null && _pausableComponents.Contains(component))
|
||||
{
|
||||
_pausableComponents.Remove(component);
|
||||
Debug.Log($"[DivingGameManager] Unregistered pausable component: {(component as MonoBehaviour)?.name ?? "Unknown"}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pause the game and all registered components
|
||||
/// </summary>
|
||||
public void Pause()
|
||||
{
|
||||
if (_isPaused) return; // Already paused
|
||||
|
||||
_isPaused = true;
|
||||
|
||||
// Pause all registered components
|
||||
foreach (var component in _pausableComponents)
|
||||
{
|
||||
component.Pause();
|
||||
}
|
||||
|
||||
Debug.Log($"[DivingGameManager] Game paused. Paused {_pausableComponents.Count} components.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resume the game and all registered components
|
||||
/// </summary>
|
||||
public void Resume()
|
||||
{
|
||||
if (!_isPaused) return; // Already running
|
||||
|
||||
_isPaused = false;
|
||||
|
||||
// Resume all registered components
|
||||
foreach (var component in _pausableComponents)
|
||||
{
|
||||
component.Resume();
|
||||
}
|
||||
|
||||
Debug.Log($"[DivingGameManager] Game resumed. Resumed {_pausableComponents.Count} components.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections;
|
||||
using AppleHills.Core.Settings;
|
||||
using Pooling;
|
||||
using Utils;
|
||||
using AppleHills.Core.Interfaces;
|
||||
|
||||
namespace Minigames.DivingForPictures
|
||||
{
|
||||
@@ -12,7 +13,7 @@ namespace Minigames.DivingForPictures
|
||||
/// Once an obstacle hits the player, its collider is disabled to prevent further collisions.
|
||||
/// Uses coroutines for better performance instead of Update() calls.
|
||||
/// </summary>
|
||||
public class FloatingObstacle : MonoBehaviour, IPoolable
|
||||
public class FloatingObstacle : MonoBehaviour, IPoolable, IPausable
|
||||
{
|
||||
[Header("Obstacle Properties")]
|
||||
[Tooltip("Index of the prefab this obstacle was created from")]
|
||||
@@ -57,6 +58,12 @@ namespace Minigames.DivingForPictures
|
||||
private float _screenNormalizationFactor = 1.0f;
|
||||
private IDivingMinigameSettings _settings;
|
||||
|
||||
// Pause state
|
||||
private bool _isPaused = false;
|
||||
|
||||
// IPausable implementation
|
||||
public bool IsPaused => _isPaused;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_collider = GetComponent<Collider2D>();
|
||||
@@ -115,31 +122,67 @@ namespace Minigames.DivingForPictures
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
StartObstacleBehavior();
|
||||
// Only start coroutines if not paused
|
||||
if (!_isPaused)
|
||||
{
|
||||
StartObstacleCoroutines();
|
||||
}
|
||||
|
||||
// Screen bounds are calculated in CheckIfOffScreen method
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
StopObstacleBehavior();
|
||||
// Stop coroutines when disabled
|
||||
StopObstacleCoroutines();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the obstacle behavior coroutines
|
||||
/// Pause this obstacle's movement and behavior
|
||||
/// </summary>
|
||||
private void StartObstacleBehavior()
|
||||
public void Pause()
|
||||
{
|
||||
if (enableMovement)
|
||||
if (_isPaused) return; // Already paused
|
||||
|
||||
_isPaused = true;
|
||||
StopObstacleCoroutines();
|
||||
|
||||
Debug.Log($"[FloatingObstacle] Paused obstacle: {name}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resume this obstacle's movement and behavior
|
||||
/// </summary>
|
||||
public void Resume()
|
||||
{
|
||||
if (!_isPaused) return; // Already running
|
||||
|
||||
_isPaused = false;
|
||||
StartObstacleCoroutines();
|
||||
|
||||
Debug.Log($"[FloatingObstacle] Resumed obstacle: {name}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start all coroutines used by this obstacle
|
||||
/// </summary>
|
||||
private void StartObstacleCoroutines()
|
||||
{
|
||||
if (enableMovement && _movementCoroutine == null)
|
||||
{
|
||||
_movementCoroutine = StartCoroutine(MovementCoroutine());
|
||||
}
|
||||
|
||||
_offScreenCheckCoroutine = StartCoroutine(OffScreenCheckCoroutine());
|
||||
if (_offScreenCheckCoroutine == null)
|
||||
{
|
||||
_offScreenCheckCoroutine = StartCoroutine(OffScreenCheckCoroutine());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops all obstacle behavior coroutines
|
||||
/// Stop all coroutines used by this obstacle
|
||||
/// </summary>
|
||||
private void StopObstacleBehavior()
|
||||
private void StopObstacleCoroutines()
|
||||
{
|
||||
if (_movementCoroutine != null)
|
||||
{
|
||||
@@ -270,7 +313,7 @@ namespace Minigames.DivingForPictures
|
||||
{
|
||||
// CRITICAL: Stop all behavior first to prevent race conditions
|
||||
// This ensures no more off-screen checks or movement happen during pool return
|
||||
StopObstacleBehavior();
|
||||
StopObstacleCoroutines();
|
||||
|
||||
if (spawner != null)
|
||||
{
|
||||
@@ -333,7 +376,7 @@ namespace Minigames.DivingForPictures
|
||||
public void OnDespawn()
|
||||
{
|
||||
// Stop all coroutines before returning to pool
|
||||
StopObstacleBehavior();
|
||||
StopObstacleCoroutines();
|
||||
|
||||
// Re-enable collider for next use (in case it was disabled)
|
||||
if (_collider != null)
|
||||
@@ -364,8 +407,8 @@ namespace Minigames.DivingForPictures
|
||||
// Restart coroutines to apply movement change
|
||||
if (gameObject.activeInHierarchy)
|
||||
{
|
||||
StopObstacleBehavior();
|
||||
StartObstacleBehavior();
|
||||
StopObstacleCoroutines();
|
||||
StartObstacleCoroutines();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using Pooling;
|
||||
using AppleHills.Core.Settings;
|
||||
using AppleHills.Core.Interfaces;
|
||||
|
||||
namespace Minigames.DivingForPictures
|
||||
{
|
||||
@@ -11,7 +12,7 @@ namespace Minigames.DivingForPictures
|
||||
/// Spawns and manages mobile obstacles for the diving minigame.
|
||||
/// Uses object pooling and validates spawn positions to avoid colliding with tiles.
|
||||
/// </summary>
|
||||
public class ObstacleSpawner : MonoBehaviour
|
||||
public class ObstacleSpawner : MonoBehaviour, IPausable
|
||||
{
|
||||
[Header("Obstacle Prefabs")]
|
||||
[Tooltip("List of possible obstacle prefabs to spawn")]
|
||||
@@ -34,11 +35,19 @@ namespace Minigames.DivingForPictures
|
||||
private float _screenBottom;
|
||||
private float _spawnRangeX;
|
||||
private Coroutine _spawnCoroutine;
|
||||
private Coroutine _moveCoroutine;
|
||||
private Coroutine _despawnCoroutine;
|
||||
private readonly List<GameObject> _activeObstacles = new List<GameObject>();
|
||||
private int _obstacleCounter = 0; // Counter for unique obstacle naming
|
||||
private bool _isSurfacing = false; // Flag to track surfacing state
|
||||
private float _velocityFactor = 1.0f; // Current velocity factor from the game manager
|
||||
|
||||
// Pause state
|
||||
private bool _isPaused = false;
|
||||
|
||||
// IPausable implementation
|
||||
public bool IsPaused => _isPaused;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_mainCamera = Camera.main;
|
||||
@@ -75,14 +84,15 @@ namespace Minigames.DivingForPictures
|
||||
|
||||
private void Start()
|
||||
{
|
||||
|
||||
|
||||
// Find DivingGameManager and subscribe to its initialization event
|
||||
DivingGameManager gameManager = FindFirstObjectByType<DivingGameManager>();
|
||||
if (gameManager != null)
|
||||
{
|
||||
gameManager.OnGameInitialized += Initialize;
|
||||
|
||||
// Register with the DivingGameManager for pause/resume events
|
||||
gameManager.RegisterPausableComponent(this);
|
||||
|
||||
// If game is already initialized, initialize immediately
|
||||
if (gameManager.GetType().GetField("_isGameInitialized",
|
||||
System.Reflection.BindingFlags.NonPublic |
|
||||
@@ -97,20 +107,130 @@ namespace Minigames.DivingForPictures
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
// Unregister from DivingGameManager
|
||||
DivingGameManager gameManager = FindFirstObjectByType<DivingGameManager>();
|
||||
if (gameManager != null)
|
||||
{
|
||||
gameManager.UnregisterPausableComponent(this);
|
||||
}
|
||||
|
||||
// Clean up any active coroutines
|
||||
StopAllCoroutines();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the obstacle spawner when triggered by DivingGameManager
|
||||
/// </summary>
|
||||
private void Initialize()
|
||||
{
|
||||
// Calculate screen bounds
|
||||
CalculateScreenBounds();
|
||||
StartSpawning();
|
||||
|
||||
// Start coroutines if not paused
|
||||
StartSpawnCoroutine();
|
||||
StartMoveCoroutine();
|
||||
StartDespawnCoroutine();
|
||||
|
||||
Debug.Log("[ObstacleSpawner] Initialized");
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
|
||||
/// <summary>
|
||||
/// Pauses the spawner and all associated processes
|
||||
/// </summary>
|
||||
public void Pause()
|
||||
{
|
||||
StopSpawning();
|
||||
if (_isPaused) return; // Already paused
|
||||
|
||||
_isPaused = true;
|
||||
|
||||
// Stop spawning coroutine
|
||||
if (_spawnCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_spawnCoroutine);
|
||||
_spawnCoroutine = null;
|
||||
}
|
||||
|
||||
// Pause all active obstacles
|
||||
foreach (var obstacle in _activeObstacles.ToArray())
|
||||
{
|
||||
if (obstacle != null)
|
||||
{
|
||||
FloatingObstacle obstacleComponent = obstacle.GetComponent<FloatingObstacle>();
|
||||
if (obstacleComponent != null)
|
||||
{
|
||||
obstacleComponent.Pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"[ObstacleSpawner] Paused with {_activeObstacles.Count} active obstacles");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resumes the spawner and all associated processes
|
||||
/// </summary>
|
||||
public void Resume()
|
||||
{
|
||||
if (!_isPaused) return; // Already running
|
||||
|
||||
_isPaused = false;
|
||||
|
||||
// Restart spawning coroutine if not in surfacing mode
|
||||
if (!_isSurfacing)
|
||||
{
|
||||
StartSpawnCoroutine();
|
||||
}
|
||||
|
||||
// Resume all active obstacles
|
||||
foreach (var obstacle in _activeObstacles.ToArray())
|
||||
{
|
||||
if (obstacle != null)
|
||||
{
|
||||
FloatingObstacle obstacleComponent = obstacle.GetComponent<FloatingObstacle>();
|
||||
if (obstacleComponent != null)
|
||||
{
|
||||
obstacleComponent.Resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"[ObstacleSpawner] Resumed with {_activeObstacles.Count} active obstacles");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the obstacle spawning coroutine if not already running
|
||||
/// </summary>
|
||||
private void StartSpawnCoroutine()
|
||||
{
|
||||
if (_spawnCoroutine == null && !_isPaused && !_isSurfacing)
|
||||
{
|
||||
_spawnCoroutine = StartCoroutine(SpawnObstacleRoutine());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the obstacle movement coroutine if not already running
|
||||
/// </summary>
|
||||
private void StartMoveCoroutine()
|
||||
{
|
||||
if (_moveCoroutine == null && !_isPaused)
|
||||
{
|
||||
_moveCoroutine = StartCoroutine(MoveObstaclesRoutine());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the obstacle despawning coroutine if not already running
|
||||
/// </summary>
|
||||
private void StartDespawnCoroutine()
|
||||
{
|
||||
if (_despawnCoroutine == null && !_isPaused)
|
||||
{
|
||||
_despawnCoroutine = StartCoroutine(DespawnObstaclesRoutine());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -444,8 +564,14 @@ namespace Minigames.DivingForPictures
|
||||
_settings.ObstacleMinMoveSpeed,
|
||||
_settings.ObstacleMaxMoveSpeed);
|
||||
|
||||
// Set spawner reference (since FloatingObstacle has this built-in now)
|
||||
// Set spawner reference
|
||||
obstacleComponent.SetSpawner(this);
|
||||
|
||||
// If spawner is already paused, pause the obstacle immediately
|
||||
if (_isPaused)
|
||||
{
|
||||
obstacleComponent.Pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -559,6 +685,147 @@ namespace Minigames.DivingForPictures
|
||||
/// </summary>
|
||||
public int ActiveObstacleCount => _activeObstacles.Count;
|
||||
|
||||
/// <summary>
|
||||
/// Coroutine that handles obstacle spawning at regular intervals
|
||||
/// </summary>
|
||||
private IEnumerator SpawnObstacleRoutine()
|
||||
{
|
||||
Debug.Log("[ObstacleSpawner] Started spawning coroutine");
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy && !_isPaused && !_isSurfacing)
|
||||
{
|
||||
// Calculate next spawn time with variation
|
||||
float nextSpawnTime = _settings.ObstacleSpawnInterval +
|
||||
Random.Range(-_settings.ObstacleSpawnIntervalVariation,
|
||||
_settings.ObstacleSpawnIntervalVariation);
|
||||
nextSpawnTime = Mathf.Max(0.1f, nextSpawnTime); // Ensure minimum interval
|
||||
|
||||
// Attempt to spawn an obstacle
|
||||
TrySpawnObstacle();
|
||||
|
||||
yield return new WaitForSeconds(nextSpawnTime);
|
||||
}
|
||||
|
||||
// Clear coroutine reference when stopped
|
||||
_spawnCoroutine = null;
|
||||
|
||||
Debug.Log("[ObstacleSpawner] Spawning coroutine ended");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Coroutine that handles checking obstacle positions
|
||||
/// Unlike the previous implementation, we don't need to move obstacles manually
|
||||
/// since the FloatingObstacle handles its own movement via coroutines
|
||||
/// </summary>
|
||||
private IEnumerator MoveObstaclesRoutine()
|
||||
{
|
||||
Debug.Log("[ObstacleSpawner] Started obstacle monitoring coroutine");
|
||||
|
||||
// This coroutine now just monitors obstacles, not moves them
|
||||
while (enabled && gameObject.activeInHierarchy && !_isPaused)
|
||||
{
|
||||
// Clean up any null references in the active obstacles list
|
||||
_activeObstacles.RemoveAll(obstacle => obstacle == null);
|
||||
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
}
|
||||
|
||||
// Clear coroutine reference when stopped
|
||||
_moveCoroutine = null;
|
||||
|
||||
Debug.Log("[ObstacleSpawner] Obstacle monitoring coroutine ended");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Coroutine that checks for obstacles that are off-screen and should be despawned
|
||||
/// </summary>
|
||||
private IEnumerator DespawnObstaclesRoutine()
|
||||
{
|
||||
const float checkInterval = 0.5f; // Check every half second
|
||||
Debug.Log("[ObstacleSpawner] Started despawn coroutine with interval: " + checkInterval);
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy && !_isPaused)
|
||||
{
|
||||
// Calculate screen bounds for despawning
|
||||
float despawnBuffer = 2f; // Extra buffer beyond screen edges
|
||||
|
||||
if (_mainCamera == null)
|
||||
{
|
||||
_mainCamera = Camera.main;
|
||||
if (_mainCamera == null)
|
||||
{
|
||||
yield return new WaitForSeconds(checkInterval);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Vector3 topWorldPoint = _mainCamera.ViewportToWorldPoint(new Vector3(0.5f, 1f, _mainCamera.transform.position.z));
|
||||
float _screenTop = topWorldPoint.y;
|
||||
|
||||
Vector3 bottomWorldPoint = _mainCamera.ViewportToWorldPoint(new Vector3(0.5f, 0f, _mainCamera.transform.position.z));
|
||||
float _screenBottom = bottomWorldPoint.y;
|
||||
|
||||
float topEdge = _screenTop + despawnBuffer;
|
||||
float bottomEdge = _screenBottom - despawnBuffer;
|
||||
|
||||
// Find obstacles that need to be despawned
|
||||
List<GameObject> obstaclesToRemove = new List<GameObject>();
|
||||
|
||||
foreach (var obstacle in _activeObstacles)
|
||||
{
|
||||
if (obstacle == null)
|
||||
{
|
||||
obstaclesToRemove.Add(obstacle);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if obstacle is out of screen bounds
|
||||
float obstacleY = obstacle.transform.position.y;
|
||||
|
||||
bool shouldDespawn;
|
||||
if (_isSurfacing)
|
||||
{
|
||||
// When surfacing, despawn obstacles below the bottom edge
|
||||
shouldDespawn = obstacleY < bottomEdge;
|
||||
}
|
||||
else
|
||||
{
|
||||
// When descending, despawn obstacles above the top edge
|
||||
shouldDespawn = obstacleY > topEdge;
|
||||
}
|
||||
|
||||
if (shouldDespawn)
|
||||
{
|
||||
obstaclesToRemove.Add(obstacle);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove and despawn obstacles
|
||||
foreach (var obstacle in obstaclesToRemove)
|
||||
{
|
||||
FloatingObstacle obstacleComponent = obstacle?.GetComponent<FloatingObstacle>();
|
||||
if (obstacleComponent != null)
|
||||
{
|
||||
// Instead of calling a non-existent DespawnObstacle method,
|
||||
// use FloatingObstacle's ForceReturnToPool method
|
||||
obstacleComponent.ForceReturnToPool();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fallback if component not found
|
||||
ReturnObstacleToPool(obstacle, -1);
|
||||
}
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(checkInterval);
|
||||
}
|
||||
|
||||
// Clear coroutine reference when stopped
|
||||
_despawnCoroutine = null;
|
||||
|
||||
Debug.Log("[ObstacleSpawner] Despawn coroutine ended");
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
|
||||
@@ -6,13 +6,14 @@ using UnityEngine.Serialization;
|
||||
using Pooling;
|
||||
using AppleHills.Core.Settings;
|
||||
using Utils;
|
||||
using AppleHills.Core.Interfaces;
|
||||
|
||||
namespace Minigames.DivingForPictures
|
||||
{
|
||||
/// <summary>
|
||||
/// Spawns and manages trench wall tiles for the endless descender minigame.
|
||||
/// </summary>
|
||||
public class TrenchTileSpawner : MonoBehaviour
|
||||
public class TrenchTileSpawner : MonoBehaviour, IPausable
|
||||
{
|
||||
[Header("Tile Prefabs")]
|
||||
[Tooltip("List of possible trench tile prefabs.")]
|
||||
@@ -67,6 +68,12 @@ namespace Minigames.DivingForPictures
|
||||
// Screen normalization
|
||||
private float _screenNormalizationFactor = 1.0f;
|
||||
|
||||
// Pause state
|
||||
private bool _isPaused = false;
|
||||
|
||||
// IPausable implementation
|
||||
public bool IsPaused => _isPaused;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_mainCamera = Camera.main;
|
||||
@@ -124,6 +131,9 @@ namespace Minigames.DivingForPictures
|
||||
{
|
||||
gameManager.OnGameInitialized += Initialize;
|
||||
|
||||
// Register with the DivingGameManager for pause/resume events
|
||||
gameManager.RegisterPausableComponent(this);
|
||||
|
||||
// If game is already initialized, initialize immediately
|
||||
if (gameManager.GetType().GetField("_isGameInitialized",
|
||||
System.Reflection.BindingFlags.NonPublic |
|
||||
@@ -139,6 +149,71 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
// Unregister from DivingGameManager
|
||||
DivingGameManager gameManager = FindFirstObjectByType<DivingGameManager>();
|
||||
if (gameManager != null)
|
||||
{
|
||||
gameManager.UnregisterPausableComponent(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pauses the spawner and all associated processes
|
||||
/// </summary>
|
||||
public void Pause()
|
||||
{
|
||||
if (_isPaused) return; // Already paused
|
||||
|
||||
_isPaused = true;
|
||||
|
||||
// Stop all active coroutines but save their references
|
||||
if (_movementCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_movementCoroutine);
|
||||
_movementCoroutine = null;
|
||||
}
|
||||
|
||||
if (_tileDestructionCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_tileDestructionCoroutine);
|
||||
_tileDestructionCoroutine = null;
|
||||
}
|
||||
|
||||
if (_tileSpawningCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_tileSpawningCoroutine);
|
||||
_tileSpawningCoroutine = null;
|
||||
}
|
||||
|
||||
if (_speedRampingCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_speedRampingCoroutine);
|
||||
_speedRampingCoroutine = null;
|
||||
}
|
||||
|
||||
Debug.Log("[TrenchTileSpawner] Paused");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resumes the spawner and all associated processes
|
||||
/// </summary>
|
||||
public void Resume()
|
||||
{
|
||||
if (!_isPaused) return; // Already running
|
||||
|
||||
_isPaused = false;
|
||||
|
||||
// Restart all necessary coroutines
|
||||
StartMovementCoroutine();
|
||||
StartTileDestructionCoroutine();
|
||||
StartTileSpawningCoroutine();
|
||||
StartSpeedRampingCoroutine();
|
||||
|
||||
Debug.Log("[TrenchTileSpawner] Resumed");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the tile spawner when triggered by DivingGameManager
|
||||
/// </summary>
|
||||
@@ -385,25 +460,57 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the movement coroutine and stores its reference
|
||||
/// Starts the movement coroutine if it's not already running
|
||||
/// </summary>
|
||||
private void StartMovementCoroutine()
|
||||
{
|
||||
if (_movementCoroutine != null)
|
||||
if (_movementCoroutine == null && !_isPaused)
|
||||
{
|
||||
StopCoroutine(_movementCoroutine);
|
||||
_movementCoroutine = StartCoroutine(MoveActiveTilesRoutine());
|
||||
}
|
||||
_movementCoroutine = StartCoroutine(MovementCoroutine());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the tile destruction coroutine if it's not already running
|
||||
/// </summary>
|
||||
private void StartTileDestructionCoroutine()
|
||||
{
|
||||
if (_tileDestructionCoroutine == null && !_isPaused)
|
||||
{
|
||||
_tileDestructionCoroutine = StartCoroutine(TileDestructionRoutine());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the tile spawning coroutine if it's not already running
|
||||
/// </summary>
|
||||
private void StartTileSpawningCoroutine()
|
||||
{
|
||||
if (_tileSpawningCoroutine == null && !_isPaused && !_stopSpawning)
|
||||
{
|
||||
_tileSpawningCoroutine = StartCoroutine(TileSpawningRoutine());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the speed ramping coroutine if it's not already running
|
||||
/// </summary>
|
||||
private void StartSpeedRampingCoroutine()
|
||||
{
|
||||
if (_speedRampingCoroutine == null && !_isPaused)
|
||||
{
|
||||
_speedRampingCoroutine = StartCoroutine(SpeedRampingRoutine());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Coroutine that handles obstacle movement using normalized screen-relative speed
|
||||
/// </summary>
|
||||
private IEnumerator MovementCoroutine()
|
||||
private IEnumerator MoveActiveTilesRoutine()
|
||||
{
|
||||
Debug.Log($"[TrenchTileSpawner] Started movement coroutine with normalized speed: {_baseMoveSpeed:F3}");
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy)
|
||||
while (enabled && gameObject.activeInHierarchy && !_isPaused)
|
||||
{
|
||||
// Skip if no active tiles
|
||||
if (_activeTiles.Count == 0)
|
||||
@@ -431,167 +538,194 @@ namespace Minigames.DivingForPictures
|
||||
// Wait for next frame
|
||||
yield return null;
|
||||
}
|
||||
|
||||
// Clear coroutine reference when stopped
|
||||
_movementCoroutine = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Coroutine that checks for tiles to destroy periodically
|
||||
/// </summary>
|
||||
private IEnumerator TileDestructionRoutine()
|
||||
{
|
||||
const float checkInterval = 0.5f; // Check every half second
|
||||
Debug.Log($"[TrenchTileSpawner] Started tile destruction coroutine with interval: {checkInterval}s");
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy && !_isPaused)
|
||||
{
|
||||
// Check and handle tile destruction
|
||||
if (_activeTiles.Count > 0)
|
||||
{
|
||||
GameObject topTile = _activeTiles[0];
|
||||
if (topTile == null)
|
||||
{
|
||||
_activeTiles.RemoveAt(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
float tileHeight = GetTileHeight(topTile);
|
||||
|
||||
bool shouldDestroy;
|
||||
if (_isSurfacing)
|
||||
{
|
||||
// When surfacing, destroy tiles at the bottom
|
||||
shouldDestroy = topTile.transform.position.y + tileHeight / 2 < _screenBottom - _settings.TileSpawnBuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
// When descending, destroy tiles at the top
|
||||
shouldDestroy = topTile.transform.position.y - tileHeight / 2 > _screenTop + _settings.TileSpawnBuffer;
|
||||
}
|
||||
|
||||
if (shouldDestroy)
|
||||
{
|
||||
_activeTiles.RemoveAt(0);
|
||||
onTileDestroyed?.Invoke(topTile);
|
||||
|
||||
if (_devSettings != null && _devSettings.TrenchTileUseObjectPooling && _tilePool != null)
|
||||
{
|
||||
// Find the prefab index for this tile
|
||||
int prefabIndex = GetPrefabIndex(topTile);
|
||||
if (prefabIndex >= 0)
|
||||
{
|
||||
_tilePool.ReturnTile(topTile, prefabIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(topTile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(topTile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for the next check interval
|
||||
yield return new WaitForSeconds(checkInterval);
|
||||
}
|
||||
|
||||
// Clear coroutine reference when stopped
|
||||
_tileDestructionCoroutine = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the movement of all active tiles based on the current velocity
|
||||
/// Coroutine that checks if new tiles need to be spawned periodically
|
||||
/// </summary>
|
||||
private void HandleMovement()
|
||||
private IEnumerator TileSpawningRoutine()
|
||||
{
|
||||
foreach (var tile in _activeTiles)
|
||||
{
|
||||
if (tile != null)
|
||||
{
|
||||
// Use velocity factor to determine direction
|
||||
Vector3 direction = Vector3.up * Mathf.Sign(_velocityFactor);
|
||||
float speed = _currentVelocity;
|
||||
|
||||
// Apply movement
|
||||
tile.transform.position += direction * speed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check for tiles that have moved off screen and should be destroyed or returned to pool
|
||||
/// </summary>
|
||||
private void HandleTileDestruction()
|
||||
{
|
||||
if (_activeTiles.Count == 0) return;
|
||||
const float checkInterval = 0.2f; // Check every fifth of a second
|
||||
Debug.Log($"[TrenchTileSpawner] Started tile spawning coroutine with interval: {checkInterval}s");
|
||||
|
||||
GameObject topTile = _activeTiles[0];
|
||||
if (topTile == null)
|
||||
while (enabled && gameObject.activeInHierarchy && !_isPaused && !_stopSpawning)
|
||||
{
|
||||
_activeTiles.RemoveAt(0);
|
||||
return;
|
||||
}
|
||||
|
||||
float tileHeight = GetTileHeight(topTile);
|
||||
|
||||
bool shouldDestroy;
|
||||
if (_isSurfacing)
|
||||
{
|
||||
// When surfacing, destroy tiles at the bottom
|
||||
shouldDestroy = topTile.transform.position.y + tileHeight / 2 < _screenBottom - _settings.TileSpawnBuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
// When descending, destroy tiles at the top
|
||||
shouldDestroy = topTile.transform.position.y - tileHeight / 2 > _screenTop + _settings.TileSpawnBuffer;
|
||||
}
|
||||
|
||||
if (shouldDestroy)
|
||||
{
|
||||
_activeTiles.RemoveAt(0);
|
||||
onTileDestroyed?.Invoke(topTile);
|
||||
|
||||
if (_devSettings != null && _devSettings.TrenchTileUseObjectPooling && _tilePool != null)
|
||||
// Check if we need to spawn new tiles
|
||||
if (_activeTiles.Count == 0)
|
||||
{
|
||||
// Find the prefab index for this tile
|
||||
int prefabIndex = GetPrefabIndex(topTile);
|
||||
if (prefabIndex >= 0)
|
||||
{
|
||||
_tilePool.ReturnTile(topTile, prefabIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(topTile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(topTile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if new tiles need to be spawned
|
||||
/// </summary>
|
||||
private void HandleTileSpawning()
|
||||
{
|
||||
if (_activeTiles.Count == 0)
|
||||
{
|
||||
// If we have no active tiles and spawning is stopped, trigger the event
|
||||
if (_stopSpawning)
|
||||
{
|
||||
onLastTileLeft.Invoke();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
GameObject bottomTile = _activeTiles[^1];
|
||||
if (bottomTile == null)
|
||||
{
|
||||
_activeTiles.RemoveAt(_activeTiles.Count - 1);
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the tile height once to use in all calculations
|
||||
float tileHeight = GetTileHeight(bottomTile);
|
||||
|
||||
// If we're in stop spawning mode, don't spawn new tiles
|
||||
if (_stopSpawning)
|
||||
{
|
||||
// Check if this is the last tile, and if it's about to leave the screen
|
||||
if (_activeTiles.Count == 1)
|
||||
{
|
||||
bool isLastTileLeaving;
|
||||
|
||||
if (_isSurfacing)
|
||||
{
|
||||
// When surfacing, check if the bottom of the tile is above the top of the screen
|
||||
isLastTileLeaving = bottomTile.transform.position.y - tileHeight / 2 > _screenTop + _settings.TileSpawnBuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
// When descending, check if the top of the tile is below the bottom of the screen
|
||||
isLastTileLeaving = bottomTile.transform.position.y + tileHeight / 2 < _screenBottom - _settings.TileSpawnBuffer;
|
||||
}
|
||||
|
||||
if (isLastTileLeaving)
|
||||
// If we have no active tiles and spawning is stopped, trigger the event
|
||||
if (_stopSpawning)
|
||||
{
|
||||
onLastTileLeft.Invoke();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
bool shouldSpawn;
|
||||
float newY;
|
||||
|
||||
if (_isSurfacing)
|
||||
{
|
||||
// When surfacing, spawn new tiles at the top
|
||||
float topEdge = bottomTile.transform.position.y + tileHeight / 2;
|
||||
shouldSpawn = topEdge < _screenTop + _settings.TileSpawnBuffer;
|
||||
newY = bottomTile.transform.position.y + tileHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
// When descending, spawn new tiles at the bottom
|
||||
float bottomEdge = bottomTile.transform.position.y - tileHeight / 2;
|
||||
shouldSpawn = bottomEdge > _screenBottom - _settings.TileSpawnBuffer;
|
||||
newY = bottomTile.transform.position.y - tileHeight;
|
||||
else
|
||||
{
|
||||
GameObject bottomTile = _activeTiles[^1];
|
||||
if (bottomTile == null)
|
||||
{
|
||||
_activeTiles.RemoveAt(_activeTiles.Count - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the tile height once to use in all calculations
|
||||
float tileHeight = GetTileHeight(bottomTile);
|
||||
|
||||
// If we're in stop spawning mode, check if last tile is leaving
|
||||
if (_stopSpawning)
|
||||
{
|
||||
// Check if this is the last tile, and if it's about to leave the screen
|
||||
if (_activeTiles.Count == 1)
|
||||
{
|
||||
bool isLastTileLeaving;
|
||||
|
||||
if (_isSurfacing)
|
||||
{
|
||||
// When surfacing, check if bottom of tile is above top of screen
|
||||
isLastTileLeaving = bottomTile.transform.position.y - tileHeight / 2 > _screenTop + _settings.TileSpawnBuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
// When descending, check if top of tile is below bottom of screen
|
||||
isLastTileLeaving = bottomTile.transform.position.y + tileHeight / 2 < _screenBottom - _settings.TileSpawnBuffer;
|
||||
}
|
||||
|
||||
if (isLastTileLeaving)
|
||||
{
|
||||
onLastTileLeft.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Normal spawning mode
|
||||
bool shouldSpawn;
|
||||
float newY;
|
||||
|
||||
if (_isSurfacing)
|
||||
{
|
||||
// When surfacing, spawn new tiles at the top
|
||||
float topEdge = bottomTile.transform.position.y + tileHeight / 2;
|
||||
shouldSpawn = topEdge < _screenTop + _settings.TileSpawnBuffer;
|
||||
newY = bottomTile.transform.position.y + tileHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
// When descending, spawn new tiles at the bottom
|
||||
float bottomEdge = bottomTile.transform.position.y - tileHeight / 2;
|
||||
shouldSpawn = bottomEdge > _screenBottom - _settings.TileSpawnBuffer;
|
||||
newY = bottomTile.transform.position.y - tileHeight;
|
||||
}
|
||||
|
||||
if (shouldSpawn)
|
||||
{
|
||||
SpawnTileAtY(newY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for the next check interval
|
||||
yield return new WaitForSeconds(checkInterval);
|
||||
}
|
||||
|
||||
if (shouldSpawn)
|
||||
{
|
||||
SpawnTileAtY(newY);
|
||||
}
|
||||
// Clear coroutine reference when stopped
|
||||
_tileSpawningCoroutine = null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Handle increasing the movement speed over time
|
||||
/// Coroutine that handles increasing the movement speed over time
|
||||
/// </summary>
|
||||
private void HandleSpeedRamping()
|
||||
private IEnumerator SpeedRampingRoutine()
|
||||
{
|
||||
_speedUpTimer += Time.deltaTime;
|
||||
if (_speedUpTimer >= _settings.SpeedUpInterval)
|
||||
const float checkInterval = 1.0f; // Check once per second
|
||||
Debug.Log($"[TrenchTileSpawner] Started speed ramping coroutine with interval: {checkInterval}s");
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy && !_isPaused)
|
||||
{
|
||||
// Increase the base move speed up to the maximum
|
||||
_baseMoveSpeed = Mathf.Min(_baseMoveSpeed + _settings.SpeedUpFactor, _settings.MaxNormalizedMoveSpeed);
|
||||
_speedUpTimer = 0f;
|
||||
|
||||
// Recalculate velocity with the new base speed
|
||||
CalculateVelocity();
|
||||
|
||||
// Wait for the next check interval
|
||||
yield return new WaitForSeconds(checkInterval);
|
||||
}
|
||||
|
||||
// Clear coroutine reference when stopped
|
||||
_speedRampingCoroutine = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -816,217 +950,5 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the tile destruction coroutine and stores its reference
|
||||
/// </summary>
|
||||
private void StartTileDestructionCoroutine()
|
||||
{
|
||||
if (_tileDestructionCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_tileDestructionCoroutine);
|
||||
}
|
||||
_tileDestructionCoroutine = StartCoroutine(TileDestructionCoroutine());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Coroutine that checks for tiles to destroy periodically
|
||||
/// </summary>
|
||||
private IEnumerator TileDestructionCoroutine()
|
||||
{
|
||||
const float checkInterval = 0.5f; // Check every half second as requested
|
||||
Debug.Log($"[TrenchTileSpawner] Started tile destruction coroutine with interval: {checkInterval}s");
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy)
|
||||
{
|
||||
// Check and handle tile destruction
|
||||
if (_activeTiles.Count > 0)
|
||||
{
|
||||
GameObject topTile = _activeTiles[0];
|
||||
if (topTile == null)
|
||||
{
|
||||
_activeTiles.RemoveAt(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
float tileHeight = GetTileHeight(topTile);
|
||||
|
||||
bool shouldDestroy;
|
||||
if (_isSurfacing)
|
||||
{
|
||||
// When surfacing, destroy tiles at the bottom
|
||||
shouldDestroy = topTile.transform.position.y + tileHeight / 2 < _screenBottom - _settings.TileSpawnBuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
// When descending, destroy tiles at the top
|
||||
shouldDestroy = topTile.transform.position.y - tileHeight / 2 > _screenTop + _settings.TileSpawnBuffer;
|
||||
}
|
||||
|
||||
if (shouldDestroy)
|
||||
{
|
||||
_activeTiles.RemoveAt(0);
|
||||
onTileDestroyed?.Invoke(topTile);
|
||||
|
||||
if (_devSettings != null && _devSettings.TrenchTileUseObjectPooling && _tilePool != null)
|
||||
{
|
||||
// Find the prefab index for this tile
|
||||
int prefabIndex = GetPrefabIndex(topTile);
|
||||
if (prefabIndex >= 0)
|
||||
{
|
||||
_tilePool.ReturnTile(topTile, prefabIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(topTile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(topTile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for the next check interval
|
||||
yield return new WaitForSeconds(checkInterval);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the tile spawning coroutine and stores its reference
|
||||
/// </summary>
|
||||
private void StartTileSpawningCoroutine()
|
||||
{
|
||||
if (_tileSpawningCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_tileSpawningCoroutine);
|
||||
}
|
||||
_tileSpawningCoroutine = StartCoroutine(TileSpawningCoroutine());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Coroutine that checks if new tiles need to be spawned periodically
|
||||
/// </summary>
|
||||
private IEnumerator TileSpawningCoroutine()
|
||||
{
|
||||
const float checkInterval = 0.2f; // Check every half second as requested
|
||||
Debug.Log($"[TrenchTileSpawner] Started tile spawning coroutine with interval: {checkInterval}s");
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy)
|
||||
{
|
||||
// Check if we need to spawn new tiles
|
||||
if (_activeTiles.Count == 0)
|
||||
{
|
||||
// If we have no active tiles and spawning is stopped, trigger the event
|
||||
if (_stopSpawning)
|
||||
{
|
||||
onLastTileLeft.Invoke();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GameObject bottomTile = _activeTiles[^1];
|
||||
if (bottomTile == null)
|
||||
{
|
||||
_activeTiles.RemoveAt(_activeTiles.Count - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the tile height once to use in all calculations
|
||||
float tileHeight = GetTileHeight(bottomTile);
|
||||
|
||||
// If we're in stop spawning mode, check if last tile is leaving
|
||||
if (_stopSpawning)
|
||||
{
|
||||
// Check if this is the last tile, and if it's about to leave the screen
|
||||
if (_activeTiles.Count == 1)
|
||||
{
|
||||
bool isLastTileLeaving;
|
||||
|
||||
if (_isSurfacing)
|
||||
{
|
||||
// When surfacing, check if bottom of tile is above top of screen
|
||||
isLastTileLeaving = bottomTile.transform.position.y - tileHeight / 2 > _screenTop + _settings.TileSpawnBuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
// When descending, check if top of tile is below bottom of screen
|
||||
isLastTileLeaving = bottomTile.transform.position.y + tileHeight / 2 < _screenBottom - _settings.TileSpawnBuffer;
|
||||
}
|
||||
|
||||
if (isLastTileLeaving)
|
||||
{
|
||||
onLastTileLeft.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Normal spawning mode
|
||||
bool shouldSpawn;
|
||||
float newY;
|
||||
|
||||
if (_isSurfacing)
|
||||
{
|
||||
// When surfacing, spawn new tiles at the top
|
||||
float topEdge = bottomTile.transform.position.y + tileHeight / 2;
|
||||
shouldSpawn = topEdge < _screenTop + _settings.TileSpawnBuffer;
|
||||
newY = bottomTile.transform.position.y + tileHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
// When descending, spawn new tiles at the bottom
|
||||
float bottomEdge = bottomTile.transform.position.y - tileHeight / 2;
|
||||
shouldSpawn = bottomEdge > _screenBottom - _settings.TileSpawnBuffer;
|
||||
newY = bottomTile.transform.position.y - tileHeight;
|
||||
}
|
||||
|
||||
if (shouldSpawn)
|
||||
{
|
||||
SpawnTileAtY(newY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for the next check interval
|
||||
yield return new WaitForSeconds(checkInterval);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the speed ramping coroutine and stores its reference
|
||||
/// </summary>
|
||||
private void StartSpeedRampingCoroutine()
|
||||
{
|
||||
if (_speedRampingCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_speedRampingCoroutine);
|
||||
}
|
||||
_speedRampingCoroutine = StartCoroutine(SpeedRampingCoroutine());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Coroutine that handles increasing the movement speed over time
|
||||
/// </summary>
|
||||
private IEnumerator SpeedRampingCoroutine()
|
||||
{
|
||||
const float checkInterval = 1.0f; // Check once per second as requested
|
||||
Debug.Log($"[TrenchTileSpawner] Started speed ramping coroutine with interval: {checkInterval}s");
|
||||
|
||||
while (enabled && gameObject.activeInHierarchy)
|
||||
{
|
||||
// Increase the base move speed up to the maximum
|
||||
_baseMoveSpeed = Mathf.Min(_baseMoveSpeed + _settings.SpeedUpFactor, _settings.MaxNormalizedMoveSpeed);
|
||||
|
||||
// Recalculate velocity with the new base speed
|
||||
CalculateVelocity();
|
||||
|
||||
// Wait for the next check interval
|
||||
yield return new WaitForSeconds(checkInterval);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,13 @@ namespace UI
|
||||
public event Action OnGamePaused;
|
||||
public event Action OnGameResumed;
|
||||
|
||||
private bool _isPaused = false;
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether the game is currently paused
|
||||
/// </summary>
|
||||
public bool IsPaused => _isPaused;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// Subscribe to scene loaded events
|
||||
@@ -92,6 +99,12 @@ namespace UI
|
||||
|
||||
// Change input mode to UI when menu is open
|
||||
InputManager.Instance.SetInputMode(InputMode.UI);
|
||||
|
||||
// Set paused flag and broadcast event
|
||||
_isPaused = true;
|
||||
OnGamePaused?.Invoke();
|
||||
|
||||
Debug.Log("[PauseMenu] Game Paused");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -108,6 +121,12 @@ namespace UI
|
||||
// Change input mode back to Game when menu is closed
|
||||
if(resetInput)
|
||||
InputManager.Instance.SetInputMode(InputMode.Game);
|
||||
|
||||
// Clear paused flag and broadcast event
|
||||
_isPaused = false;
|
||||
OnGameResumed?.Invoke();
|
||||
|
||||
Debug.Log("[PauseMenu] Game Resumed");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user