MVP of the plane throwing game (#77)

Co-authored-by: Michal Pikulski <michal@foolhardyhorizons.com>
Co-authored-by: Michal Pikulski <michal.a.pikulski@gmail.com>
Reviewed-on: #77
This commit is contained in:
2025-12-07 19:36:57 +00:00
parent ad8338f37e
commit c27f22ef0a
128 changed files with 15474 additions and 1589 deletions

View File

@@ -70,6 +70,11 @@ MonoBehaviour:
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: c56b7c4096b59584c93f2cfa79230643
m_Address: Settings/AirplaneSettings
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
m_ReadOnly: 0
m_Settings: {fileID: 11400000, guid: 11da9bb90d9dd5848b4f7629415a6937, type: 2}
m_SchemaSet:

View File

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

View File

@@ -27,3 +27,5 @@ MonoBehaviour:
requiredOrientation: 1
- sceneName: FortFight
requiredOrientation: 1
- sceneName: ValentineNoteDelivery
requiredOrientation: 1

View File

@@ -3,6 +3,7 @@ using UnityEditor;
using System.Collections.Generic;
using System.Linq;
using Core.Settings;
using Minigames.Airplane.Settings;
namespace AppleHills.Core.Settings.Editor
{
@@ -10,7 +11,8 @@ namespace AppleHills.Core.Settings.Editor
{
private Vector2 scrollPosition;
private List<BaseSettings> allSettings = new List<BaseSettings>();
private string[] tabNames = new string[] { "Player & Follower", "Interaction & Items", "Diving Minigame", "Card System", "Card Sorting", "Bird Pooper", "Statue Dressup", "Fort Fight" };
private string[] tabNames = new string[] { "Player & Follower", "Interaction & Items", "Diving Minigame",
"Card System", "Card Sorting", "Bird Pooper", "Statue Dressup", "Fort Fight", "Airplane" };
private int selectedTab = 0;
private Dictionary<string, SerializedObject> serializedSettingsObjects = new Dictionary<string, SerializedObject>();
private GUIStyle headerStyle;
@@ -53,6 +55,7 @@ namespace AppleHills.Core.Settings.Editor
CreateSettingsIfMissing<BirdPooperSettings>("BirdPooperSettings");
CreateSettingsIfMissing<StatueDressupSettings>("StatueDressupSettings");
CreateSettingsIfMissing<Minigames.FortFight.Core.FortFightSettings>("FortFightSettings");
CreateSettingsIfMissing<AirplaneSettings>("AirplaneSettings");
}
private void CreateSettingsIfMissing<T>(string fileName) where T : BaseSettings
@@ -134,6 +137,9 @@ namespace AppleHills.Core.Settings.Editor
case 7: // Fort Fight
DrawSettingsEditor<Minigames.FortFight.Core.FortFightSettings>();
break;
case 8: // Airplane
DrawSettingsEditor<Minigames.Airplane.Settings.AirplaneSettings>();
break;
}
EditorGUILayout.EndScrollView();

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -0,0 +1,195 @@
fileFormatVersion: 2
guid: 4f579a820baebc14a9151832fbe37559
TextureImporter:
internalIDToNameTable:
- first:
213: 1411070990185071134
second: paperplane_0
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: iOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WindowsStoreApps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: paperplane_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 292
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: e1207d2e691259310800000000000000
internalID: 1411070990185071134
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
paperplane_0: 1411070990185071134
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@@ -0,0 +1,195 @@
fileFormatVersion: 2
guid: ba6d4f958f29f8b45a8f670d869733fe
TextureImporter:
internalIDToNameTable:
- first:
213: -1386115237479607260
second: paperplane_blue_0
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: iOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WindowsStoreApps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: paperplane_blue_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 292
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: 4249544198783cce0800000000000000
internalID: -1386115237479607260
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
paperplane_blue_0: -1386115237479607260
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -0,0 +1,195 @@
fileFormatVersion: 2
guid: 333a17a4395130b46984c04bbb6e09ea
TextureImporter:
internalIDToNameTable:
- first:
213: -5545584635573524598
second: paperplane_red_0
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: iOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WindowsStoreApps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: paperplane_red_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 292
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: a87a6ccd7202a03b0800000000000000
internalID: -5545584635573524598
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
paperplane_red_0: -5545584635573524598
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@@ -0,0 +1,223 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2043346932243838886
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 980265469572593645}
- component: {fileID: 8935501695810778450}
- component: {fileID: 7899983481931266200}
- component: {fileID: 413068145424314250}
m_Layer: 0
m_Name: AirPlane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &980265469572593645
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2043346932243838886}
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:
- {fileID: 4853861366619627820}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!50 &8935501695810778450
Rigidbody2D:
serializedVersion: 5
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2043346932243838886}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDamping: 0
m_AngularDamping: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!60 &7899983481931266200
PolygonCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2043346932243838886}
m_Enabled: 1
serializedVersion: 3
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 1
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
oldSize: {x: 0, y: 0}
newSize: {x: 0, y: 0}
adaptiveTilingThreshold: 0
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Points:
m_Paths:
- - {x: -3.2368588, y: 1.4336461}
- {x: -2.0041978, y: 0.278042}
- {x: -2.1517262, y: -1.1380495}
- {x: -1.0833807, y: -0.7780423}
- {x: -0.69766605, y: -1.4749737}
- {x: 3.0137086, y: 0.7569043}
- {x: 2.8869755, y: 1.0059484}
m_UseDelaunayMesh: 0
--- !u!114 &413068145424314250
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2043346932243838886}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cdaac23e969495d8c0deeaf236c259e, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::Minigames.Airplane.Core.AirplaneController
gravity: 9.81
rotateToVelocity: 1
showDebugLogs: 0
--- !u!1 &5971651627485237503
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4853861366619627820}
- component: {fileID: 2064624806715645393}
m_Layer: 0
m_Name: Visual
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4853861366619627820
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5971651627485237503}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2, y: 2, z: 2}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 980265469572593645}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &2064624806715645393
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5971651627485237503}
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: 9dfc825aed78fcd4ba02077103263b40, 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: 0
m_Sprite: {fileID: 1411070990185071134, guid: 4f579a820baebc14a9151832fbe37559, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 2.92, y: 1.32}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0

View File

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

View File

@@ -0,0 +1,222 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2043346932243838886
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 980265469572593645}
- component: {fileID: 8935501695810778450}
- component: {fileID: 7899983481931266200}
- component: {fileID: 413068145424314250}
m_Layer: 0
m_Name: AirPlane_blue
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &980265469572593645
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2043346932243838886}
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:
- {fileID: 4853861366619627820}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!50 &8935501695810778450
Rigidbody2D:
serializedVersion: 5
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2043346932243838886}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDamping: 0
m_AngularDamping: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!60 &7899983481931266200
PolygonCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2043346932243838886}
m_Enabled: 1
serializedVersion: 3
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 1
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
oldSize: {x: 0, y: 0}
newSize: {x: 0, y: 0}
adaptiveTilingThreshold: 0
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Points:
m_Paths:
- - {x: -3.2368588, y: 1.4336461}
- {x: -2.0041978, y: 0.278042}
- {x: -2.1517262, y: -1.1380495}
- {x: -1.0833807, y: -0.7780423}
- {x: -0.69766605, y: -1.4749737}
- {x: 3.0137086, y: 0.7569043}
- {x: 2.8869755, y: 1.0059484}
m_UseDelaunayMesh: 0
--- !u!114 &413068145424314250
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2043346932243838886}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cdaac23e969495d8c0deeaf236c259e, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::Minigames.Airplane.Core.AirplaneController
gravity: 9.81
showDebugLogs: 0
--- !u!1 &5971651627485237503
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4853861366619627820}
- component: {fileID: 2064624806715645393}
m_Layer: 0
m_Name: Visual
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4853861366619627820
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5971651627485237503}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2, y: 2, z: 2}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 980265469572593645}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &2064624806715645393
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5971651627485237503}
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: 9dfc825aed78fcd4ba02077103263b40, 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: 0
m_Sprite: {fileID: -1386115237479607260, guid: ba6d4f958f29f8b45a8f670d869733fe, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 2.92, y: 1.32}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0

View File

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

View File

@@ -0,0 +1,222 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2043346932243838886
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 980265469572593645}
- component: {fileID: 8935501695810778450}
- component: {fileID: 7899983481931266200}
- component: {fileID: 413068145424314250}
m_Layer: 0
m_Name: AirPlane_red
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &980265469572593645
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2043346932243838886}
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:
- {fileID: 4853861366619627820}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!50 &8935501695810778450
Rigidbody2D:
serializedVersion: 5
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2043346932243838886}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDamping: 0
m_AngularDamping: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!60 &7899983481931266200
PolygonCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2043346932243838886}
m_Enabled: 1
serializedVersion: 3
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 1
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
oldSize: {x: 0, y: 0}
newSize: {x: 0, y: 0}
adaptiveTilingThreshold: 0
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Points:
m_Paths:
- - {x: -3.2368588, y: 1.4336461}
- {x: -2.0041978, y: 0.278042}
- {x: -2.1517262, y: -1.1380495}
- {x: -1.0833807, y: -0.7780423}
- {x: -0.69766605, y: -1.4749737}
- {x: 3.0137086, y: 0.7569043}
- {x: 2.8869755, y: 1.0059484}
m_UseDelaunayMesh: 0
--- !u!114 &413068145424314250
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2043346932243838886}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cdaac23e969495d8c0deeaf236c259e, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::Minigames.Airplane.Core.AirplaneController
gravity: 9.81
showDebugLogs: 0
--- !u!1 &5971651627485237503
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4853861366619627820}
- component: {fileID: 2064624806715645393}
m_Layer: 0
m_Name: Visual
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4853861366619627820
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5971651627485237503}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2, y: 2, z: 2}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 980265469572593645}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &2064624806715645393
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5971651627485237503}
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: 9dfc825aed78fcd4ba02077103263b40, 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: 0
m_Sprite: {fileID: -5545584635573524598, guid: 333a17a4395130b46984c04bbb6e09ea, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 2.92, y: 1.32}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0

View File

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

View File

@@ -0,0 +1,26 @@
%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: 36baaa8bdcb9d8b49b9199833965d2c3, type: 3}
m_Name: AirplaneGameBlends
m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineBlenderSettings
CustomBlends:
- From: AimingCamera
To: FlightCamera
Blend:
Style: 4
Time: 0.5
CustomCurve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 0
m_PostInfinity: 0
m_RotationOrder: 0

View File

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

View File

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

View File

@@ -0,0 +1,167 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5175967588203935335
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5380908876971534942}
- component: {fileID: 2759613245048873088}
- component: {fileID: 4087529250869919713}
- component: {fileID: 2988436043155334896}
m_Layer: 14
m_Name: PlaceholderGround
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5380908876971534942
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5175967588203935335}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 13.207894, y: 9.360231, z: 2.6263}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &2759613245048873088
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5175967588203935335}
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: 9dfc825aed78fcd4ba02077103263b40, 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: 0
m_Sprite: {fileID: -4331849829665928538, guid: 8be45455b29f80241a3b8aae36291752, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 2.68, y: 1.07}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!50 &4087529250869919713
Rigidbody2D:
serializedVersion: 5
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5175967588203935335}
m_BodyType: 2
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDamping: 0
m_AngularDamping: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!61 &2988436043155334896
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5175967588203935335}
m_Enabled: 1
serializedVersion: 3
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 0
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 2.68, y: 1.07}
newSize: {x: 2.68, y: 1.07}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Size: {x: 2.68, y: 1.07}
m_EdgeRadius: 0

View File

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

View File

@@ -0,0 +1,92 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &9221047222437043327
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8794843206966253100}
- component: {fileID: 8404313326119756094}
m_Layer: 0
m_Name: Placeholder_Bad
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8794843206966253100
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9221047222437043327}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2, y: 2, z: 2}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &8404313326119756094
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9221047222437043327}
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: 9dfc825aed78fcd4ba02077103263b40, 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: 0
m_Sprite: {fileID: 1152548570994208632, guid: 84a9632f9bdc1ee4bab91cf4b764b5f7, type: 3}
m_Color: {r: 1, g: 0, b: 0.07523346, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 2.01, y: 2.01}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0

View File

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

View File

@@ -0,0 +1,92 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &9221047222437043327
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8794843206966253100}
- component: {fileID: 8404313326119756094}
m_Layer: 0
m_Name: Placeholder_Good
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8794843206966253100
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9221047222437043327}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2, y: 2, z: 2}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &8404313326119756094
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9221047222437043327}
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: 9dfc825aed78fcd4ba02077103263b40, 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: 0
m_Sprite: {fileID: 1152548570994208632, guid: 84a9632f9bdc1ee4bab91cf4b764b5f7, type: 3}
m_Color: {r: 0, g: 1, b: 0.0054848194, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 2.01, y: 2.01}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0

View File

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

View File

@@ -0,0 +1,157 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3207629437433571205
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3894978829138749710}
- component: {fileID: 8972759402263058808}
- component: {fileID: 2399602594988894182}
- component: {fileID: 7284054513935473023}
m_Layer: 0
m_Name: Placeholder_Target_Bob
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3894978829138749710
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3207629437433571205}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 5, y: 5, z: 5}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &8972759402263058808
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3207629437433571205}
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: 9dfc825aed78fcd4ba02077103263b40, 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: 0
m_Sprite: {fileID: 6741082507358000137, guid: 2406a20d35d3e8946b1e3f83ecd269c2, 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.59, y: 0.71}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!61 &2399602594988894182
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3207629437433571205}
m_Enabled: 1
serializedVersion: 3
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 0
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 0.59, y: 0.71}
newSize: {x: 0.59, y: 0.71}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Size: {x: 0.59, y: 0.71}
m_EdgeRadius: 0
--- !u!114 &7284054513935473023
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3207629437433571205}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 53e3dae13bb14c109a038bb5a84bd941, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::Minigames.Airplane.Targets.AirplaneTarget
targetName: bob_target
spriteRenderer: {fileID: 8972759402263058808}
activeColor: {r: 0, g: 0.45736456, b: 1, a: 1}
inactiveColor: {r: 0.10131009, g: 0.1014865, b: 0.10188681, a: 0.40784314}
showDebugLogs: 0

View File

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

View File

@@ -0,0 +1,157 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3207629437433571205
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3894978829138749710}
- component: {fileID: 8972759402263058808}
- component: {fileID: 2399602594988894182}
- component: {fileID: 7284054513935473023}
m_Layer: 0
m_Name: Placeholder_Target_Gardener
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3894978829138749710
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3207629437433571205}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 5, y: 5, z: 5}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &8972759402263058808
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3207629437433571205}
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: 9dfc825aed78fcd4ba02077103263b40, 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: 0
m_Sprite: {fileID: 6741082507358000137, guid: 2406a20d35d3e8946b1e3f83ecd269c2, 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.59, y: 0.71}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!61 &2399602594988894182
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3207629437433571205}
m_Enabled: 1
serializedVersion: 3
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 0
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 0.59, y: 0.71}
newSize: {x: 0.59, y: 0.71}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Size: {x: 0.59, y: 0.71}
m_EdgeRadius: 0
--- !u!114 &7284054513935473023
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3207629437433571205}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 53e3dae13bb14c109a038bb5a84bd941, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::Minigames.Airplane.Targets.AirplaneTarget
targetName: gardener_target
spriteRenderer: {fileID: 8972759402263058808}
activeColor: {r: 0, g: 0.45736456, b: 1, a: 1}
inactiveColor: {r: 0.10131009, g: 0.1014865, b: 0.10188681, a: 0.40784314}
showDebugLogs: 0

View File

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

View File

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

View File

@@ -0,0 +1,257 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1671093966628372905
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3732436404526530178}
- component: {fileID: 7382080916513676693}
- component: {fileID: 1934426468406867304}
- component: {fileID: 5250555121143694571}
m_Layer: 0
m_Name: SelectionFrame
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3732436404526530178
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1671093966628372905}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.1, y: 1.1, z: 1.1}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 5528987915987008050}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7382080916513676693
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1671093966628372905}
m_CullTransparentMesh: 1
--- !u!114 &1934426468406867304
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1671093966628372905}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 0
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 0.2
--- !u!114 &5250555121143694571
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1671093966628372905}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Button
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1934426468406867304}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!1 &4133732546673625852
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5528987915987008050}
- component: {fileID: 7917576286574375620}
- component: {fileID: 6970111833125190983}
- component: {fileID: 1741502439611665070}
- component: {fileID: 5077210419087688757}
m_Layer: 0
m_Name: AirplaneSelectionButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5528987915987008050
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4133732546673625852}
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:
- {fileID: 3732436404526530178}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 300, y: 300}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7917576286574375620
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4133732546673625852}
m_CullTransparentMesh: 1
--- !u!114 &6970111833125190983
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4133732546673625852}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0}
m_Color: {r: 0.4716981, g: 0.30927375, b: 0.30927375, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &1741502439611665070
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4133732546673625852}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Button
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 6970111833125190983}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &5077210419087688757
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4133732546673625852}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4ccf530e55324aec8dc6e09eb827f123, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::Minigames.Airplane.UI.AirplaneSelectionButton
highlightImage: {fileID: 1934426468406867304}

View File

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

View File

@@ -106,8 +106,8 @@ Rigidbody2D:
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDamping: 0
m_AngularDamping: 0.05
m_LinearDamping: 1
m_AngularDamping: 1
m_GravityScale: 1
m_Material: {fileID: 0}
m_IncludeLayers:

File diff suppressed because one or more lines are too long

View File

@@ -2712,7 +2712,7 @@ GameObject:
- component: {fileID: 841922114}
- component: {fileID: 841922117}
- component: {fileID: 841922116}
- component: {fileID: 841922115}
- component: {fileID: 841922118}
m_Layer: 0
m_Name: SlingShot
m_TagString: Untagged
@@ -2737,21 +2737,6 @@ Transform:
- {fileID: 1448546925}
m_Father: {fileID: 1009687014}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &841922115
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 841922113}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b1e26667c6d4415f8dc51e4a58ba9479, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::Minigames.FortFight.Core.TrajectoryPreview
simulationSteps: 50
lineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1}
lineWidth: 0.1
--- !u!120 &841922116
LineRenderer:
serializedVersion: 2
@@ -2874,9 +2859,28 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: fc81b72132764f09a0ba180c90b432cf, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::Minigames.FortFight.Core.SlingshotController
maxDragDistance: 5
projectileSpawnPoint: {fileID: 1668202570}
trajectoryPreview: {fileID: 0}
maxDragDistanceOverride: 0
maxForceOverride: 0
launchAnchor: {fileID: 1668202570}
trajectoryPreview: {fileID: 841922118}
showDebugLogs: 1
--- !u!114 &841922118
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 841922113}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b86a4cd82d4a47de9d1e4d97ffd01f5e, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::Common.Visual.TrajectoryPreview
trajectoryPoints: 50
timeStep: 0.1
groundLevel: -10
lineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1}
lineWidth: 0.1
--- !u!1 &846792101
GameObject:
m_ObjectHideFlags: 0
@@ -4363,7 +4367,7 @@ GameObject:
- component: {fileID: 1460473367}
- component: {fileID: 1460473370}
- component: {fileID: 1460473369}
- component: {fileID: 1460473368}
- component: {fileID: 1460473371}
m_Layer: 0
m_Name: SlingShot
m_TagString: Untagged
@@ -4388,21 +4392,6 @@ Transform:
- {fileID: 56461670}
m_Father: {fileID: 799036564}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1460473368
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1460473366}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b1e26667c6d4415f8dc51e4a58ba9479, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::Minigames.FortFight.Core.TrajectoryPreview
simulationSteps: 30
lineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1}
lineWidth: 0.1
--- !u!120 &1460473369
LineRenderer:
serializedVersion: 2
@@ -4525,9 +4514,28 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: fc81b72132764f09a0ba180c90b432cf, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::Minigames.FortFight.Core.SlingshotController
maxDragDistance: 5
projectileSpawnPoint: {fileID: 497509525}
trajectoryPreview: {fileID: 0}
maxDragDistanceOverride: 0
maxForceOverride: 0
launchAnchor: {fileID: 497509525}
trajectoryPreview: {fileID: 1460473371}
showDebugLogs: 1
--- !u!114 &1460473371
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1460473366}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b86a4cd82d4a47de9d1e4d97ffd01f5e, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::Common.Visual.TrajectoryPreview
trajectoryPoints: 50
timeStep: 0.1
groundLevel: -10
lineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1}
lineWidth: 0.1
--- !u!1 &1543340062
GameObject:
m_ObjectHideFlags: 0
@@ -4867,10 +4875,18 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: aa30fcfc16ed44d59edd73fd0224d03c, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::Minigames.FortFight.Core.CameraController
wideViewCamera: {fileID: 858149304}
playerOneCamera: {fileID: 846792105}
playerTwoCamera: {fileID: 630420675}
projectileCamera: {fileID: 1592155790}
cameraMappings:
- state: 0
camera: {fileID: 858149304}
- state: 1
camera: {fileID: 846792105}
- state: 2
camera: {fileID: 630420675}
- state: 3
camera: {fileID: 1592155790}
inactivePriority: 10
activePriority: 20
showDebugLogs: 0
--- !u!4 &1674657453
Transform:
m_ObjectHideFlags: 0
@@ -6978,7 +6994,6 @@ SceneRoots:
- {fileID: 1277046016}
- {fileID: 2124351765}
- {fileID: 1543340064}
- {fileID: 1674657453}
- {fileID: 878268908}
- {fileID: 1007359451}
- {fileID: 570857724}
@@ -6988,6 +7003,7 @@ SceneRoots:
- {fileID: 1760833216}
- {fileID: 2071632755}
- {fileID: 1582224593}
- {fileID: 1674657453}
- {fileID: 846792102}
- {fileID: 630420672}
- {fileID: 1592155791}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 70833f6496d94acab58cfe981c757d2d
timeCreated: 1764851204

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 44c4b5c8fcd54d1887fb05ca65a9bb20
timeCreated: 1764851223

View File

@@ -0,0 +1,299 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Core;
using Core.Lifecycle;
using Unity.Cinemachine;
using UnityEngine;
namespace Common.Camera
{
/// <summary>
/// Serializable mapping between a camera state and its Cinemachine camera.
/// Used to assign cameras in the Inspector for each enum state.
/// </summary>
[Serializable]
public class CameraStateMapping<TState> where TState : Enum
{
[Tooltip("The state this camera represents")]
public TState state;
[Tooltip("The Cinemachine camera for this state")]
public CinemachineCamera camera;
public CameraStateMapping(TState state)
{
this.state = state;
this.camera = null;
}
}
/// <summary>
/// Generic state-based camera controller using Cinemachine.
/// Manages camera transitions by setting priorities on virtual cameras.
/// Type parameter TState must be an enum representing camera states.
/// </summary>
///
public abstract class CameraStateManager<TState> : ManagedBehaviour where TState : Enum
{
#region Configuration
[Header("Camera Mappings")]
[Tooltip("Assign cameras for each state - list auto-populates from enum")]
[SerializeField] protected List<CameraStateMapping<TState>> cameraMappings = new List<CameraStateMapping<TState>>();
[Header("Camera Priority Settings")]
[Tooltip("Priority for inactive cameras")]
[SerializeField] protected int inactivePriority = 10;
[Tooltip("Priority for the active camera")]
[SerializeField] protected int activePriority = 20;
[Header("Debug")]
[SerializeField] protected bool showDebugLogs = false;
#endregion
#region State
private Dictionary<TState, CinemachineCamera> _cameraMap = new Dictionary<TState, CinemachineCamera>();
private TState _currentState;
private bool _isInitialized = false;
public TState CurrentState => _currentState;
#endregion
#region Events
/// <summary>
/// Fired when camera state changes. Parameters: (TState oldState, TState newState)
/// </summary>
public event Action<TState, TState> OnStateChanged;
#endregion
#region Lifecycle
/// <summary>
/// Initialize camera mappings and validate them.
/// Subclasses should call base.OnManagedAwake() to get automatic initialization.
/// If custom initialization is needed, override without calling base.
/// </summary>
internal override void OnManagedAwake()
{
base.OnManagedAwake();
// Initialize cameras from Inspector mappings
InitializeCameraMap();
// Validate all cameras are assigned
ValidateCameras();
}
#endregion
#region Initialization
/// <summary>
/// Initialize camera mappings from Inspector-assigned list.
/// Call this in OnManagedAwake - no need to manually register cameras!
/// This is the preferred method for new implementations.
/// </summary>
protected void InitializeCameraMap()
{
_cameraMap.Clear();
// Build dictionary from serialized mappings
foreach (var mapping in cameraMappings)
{
if (mapping.camera == null)
{
Logging.Warning($"[{GetType().Name}] No camera assigned for state {mapping.state}");
continue;
}
_cameraMap[mapping.state] = mapping.camera;
mapping.camera.Priority.Value = inactivePriority;
if (showDebugLogs)
Logging.Debug($"[{GetType().Name}] Registered camera '{mapping.camera.gameObject.name}' for state {mapping.state}");
}
_isInitialized = true;
if (_cameraMap.Count == 0)
{
Logging.Warning($"[{GetType().Name}] No cameras registered!");
}
if (showDebugLogs) Logging.Debug($"[{GetType().Name}] Initialized with {_cameraMap.Count} cameras");
}
/// <summary>
/// DEPRECATED: Use InitializeCameraMap() instead for cleaner code.
/// Kept for backward compatibility with existing implementations.
/// </summary>
protected void RegisterCamera(TState state, CinemachineCamera pCamera)
{
if (pCamera == null)
{
Logging.Warning($"[{GetType().Name}] Attempted to register null camera for state {state}");
return;
}
if (_cameraMap.ContainsKey(state))
{
Logging.Warning($"[{GetType().Name}] Camera for state {state} already registered, overwriting");
}
_cameraMap[state] = pCamera;
pCamera.Priority.Value = inactivePriority;
if (showDebugLogs) Logging.Debug($"[{GetType().Name}] Registered camera '{pCamera.gameObject.name}' for state {state}");
}
/// <summary>
/// DEPRECATED: Use InitializeCameraMap() instead.
/// Kept for backward compatibility with existing implementations.
/// </summary>
protected void FinalizeInitialization()
{
_isInitialized = true;
if (_cameraMap.Count == 0)
{
Logging.Warning($"[{GetType().Name}] No cameras registered!");
}
if (showDebugLogs) Logging.Debug($"[{GetType().Name}] Initialized with {_cameraMap.Count} cameras");
}
#endregion
#region State Management
/// <summary>
/// Switch to a specific camera state
/// </summary>
public virtual void SwitchToState(TState newState)
{
if (!_isInitialized)
{
Logging.Error($"[{GetType().Name}] Cannot switch state - not initialized!");
return;
}
if (!_cameraMap.ContainsKey(newState))
{
Logging.Error($"[{GetType().Name}] No camera registered for state {newState}!");
return;
}
TState oldState = _currentState;
_currentState = newState;
// Set all cameras to inactive priority
foreach (var kvp in _cameraMap)
{
kvp.Value.Priority.Value = inactivePriority;
}
// Set target camera to active priority
_cameraMap[newState].Priority.Value = activePriority;
if (showDebugLogs) Logging.Debug($"[{GetType().Name}] Switched from {oldState} to {newState} (camera: {_cameraMap[newState].gameObject.name})");
OnStateChanged?.Invoke(oldState, newState);
}
/// <summary>
/// Get the camera for a specific state
/// </summary>
public CinemachineCamera GetCamera(TState state)
{
if (_cameraMap.TryGetValue(state, out CinemachineCamera pCamera))
{
return pCamera;
}
Logging.Warning($"[{GetType().Name}] No camera found for state {state}");
return null;
}
/// <summary>
/// Check if a camera is registered for a state
/// </summary>
public bool HasCamera(TState state)
{
return _cameraMap.ContainsKey(state);
}
#endregion
#region Validation
/// <summary>
/// Validate that all enum states have cameras registered.
/// Override to add custom validation (e.g., check for specific components).
/// </summary>
protected virtual void ValidateCameras()
{
// Check that all enum values have cameras assigned
foreach (TState state in Enum.GetValues(typeof(TState)))
{
if (!_cameraMap.ContainsKey(state))
{
Logging.Warning($"[{GetType().Name}] No camera assigned for state {state}");
}
else if (_cameraMap[state] == null)
{
Logging.Error($"[{GetType().Name}] Camera for state {state} is null!");
}
}
}
#endregion
#region Editor Support
#if UNITY_EDITOR
/// <summary>
/// Auto-populate camera mappings list with all enum values.
/// Called automatically in the Editor when the component is added or values change.
/// </summary>
protected virtual void OnValidate()
{
// Get all enum values
TState[] allStates = (TState[])Enum.GetValues(typeof(TState));
// Add missing states to the list
foreach (TState state in allStates)
{
bool exists = cameraMappings.Any(m => EqualityComparer<TState>.Default.Equals(m.state, state));
if (!exists)
{
cameraMappings.Add(new CameraStateMapping<TState>(state));
}
}
// Remove mappings for states that no longer exist in the enum
cameraMappings.RemoveAll(m => !System.Array.Exists(allStates, s => EqualityComparer<TState>.Default.Equals(s, m.state)));
// Sort by enum order for cleaner Inspector display
cameraMappings = cameraMappings.OrderBy(m => (int)(object)m.state).ToList();
}
/// <summary>
/// Initialize list when component is first added
/// </summary>
protected virtual void Reset()
{
OnValidate();
}
#endif
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c4fc438e61b94c529f7d1e8fe9fb70fa
timeCreated: 1764851223

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 35838202f1ac4fa4b606b0582fa4e439
timeCreated: 1764851204

View File

@@ -0,0 +1,405 @@
using System;
using Core;
using Core.Lifecycle;
using Input;
using UnityEngine;
namespace Common.Input
{
/// <summary>
/// Cached launch parameters calculated during drag.
/// Avoids recalculating force/direction multiple times.
/// </summary>
public struct LaunchParameters
{
public Vector2 Direction;
public float Force;
public float DragDistance;
public float DragRatio;
public float Mass;
public bool IsValid => Force > 0f && DragDistance > 0f;
}
/// <summary>
/// Base class for drag-to-launch mechanics (Angry Birds style).
/// Provides core drag logic, force calculation, and input handling.
/// Uses SlingshotConfig for all settings - fully configuration-driven.
/// Subclasses implement visual feedback and specific launch behavior.
/// </summary>
public abstract class DragLaunchController : ManagedBehaviour, ITouchInputConsumer
{
#region Events
/// <summary>
/// Fired when drag starts. Parameters: (Vector2 startPosition)
/// </summary>
public event Action<Vector2> OnDragStart;
/// <summary>
/// Fired during drag update. Parameters: (Vector2 currentPosition, Vector2 direction, float force)
/// </summary>
public event Action<Vector2, Vector2, float> OnDragUpdate;
/// <summary>
/// Fired when drag ends. Parameters: (Vector2 endPosition, Vector2 direction, float force)
/// </summary>
public event Action<Vector2, Vector2, float> OnDragEnd;
/// <summary>
/// Fired when launch occurs. Parameters: (Vector2 direction, float force)
/// </summary>
public event Action<Vector2, float> OnLaunch;
#endregion
#region Settings
private SlingshotConfig _config;
protected SlingshotConfig Config
{
get
{
if (_config == null)
{
_config = GetSlingshotConfig();
}
return _config;
}
}
/// <summary>
/// Subclasses implement to return their slingshot configuration
/// from their specific settings object
/// </summary>
protected abstract SlingshotConfig GetSlingshotConfig();
/// <summary>
/// Subclasses implement to return the projectile prefab that will be launched.
/// Used for reading Rigidbody2D properties (mass, gravityScale) for trajectory calculations.
/// </summary>
protected abstract GameObject GetProjectilePrefab();
#endregion
#region Inspector Properties
[Header("Launch Settings Overrides (leave 0 to use config)")]
[Tooltip("Override max drag distance (0 = use config)")]
[SerializeField] protected float maxDragDistanceOverride = 0f;
[Tooltip("Override max force (0 = use config)")]
[SerializeField] protected float maxForceOverride = 0f;
[Header("References")]
[Tooltip("Launch anchor point (spawn/slingshot position)")]
[SerializeField] protected Transform launchAnchor;
[Tooltip("Trajectory preview component (auto-found if not assigned)")]
[SerializeField] protected Common.Visual.TrajectoryPreview trajectoryPreview;
[Header("Debug")]
[SerializeField] protected bool showDebugLogs;
#endregion
#region Computed Properties
protected float MaxDragDistance => maxDragDistanceOverride > 0 ? maxDragDistanceOverride : Config?.maxDragDistance ?? 5f;
protected float MaxForce => maxForceOverride > 0 ? maxForceOverride : Config?.baseLaunchForce ?? 20f;
#endregion
#region State
private bool _isDragging;
private Vector2 _dragStartPosition;
private bool _isEnabled = false;
private bool _isRegisteredForInput = false;
// Cached launch parameters - calculated once during drag, used for both preview and launch
private LaunchParameters _cachedLaunchParams;
public bool IsDragging => _isDragging;
public bool IsEnabled => _isEnabled;
#endregion
#region Lifecycle
internal override void OnManagedAwake()
{
base.OnManagedAwake();
if (launchAnchor == null)
{
launchAnchor = transform;
}
// Auto-find trajectory preview if not assigned
if (trajectoryPreview == null)
{
trajectoryPreview = GetComponent<Common.Visual.TrajectoryPreview>();
}
}
#endregion
#region Enable/Disable
/// <summary>
/// Enable the launch controller and register with InputManager
/// </summary>
public virtual void Enable()
{
_isEnabled = true;
// Register with InputManager as override consumer
if (InputManager.Instance != null && !_isRegisteredForInput)
{
InputManager.Instance.RegisterOverrideConsumer(this);
_isRegisteredForInput = true;
if (showDebugLogs) Logging.Debug($"[{GetType().Name}] Registered with InputManager");
}
// Show preview visuals
ShowPreview();
if (showDebugLogs) Logging.Debug($"[{GetType().Name}] Enabled");
}
/// <summary>
/// Disable the launch controller and unregister from InputManager
/// </summary>
public virtual void Disable()
{
_isEnabled = false;
_isDragging = false;
// Unregister from InputManager
if (InputManager.Instance != null && _isRegisteredForInput)
{
InputManager.Instance.UnregisterOverrideConsumer(this);
_isRegisteredForInput = false;
if (showDebugLogs) Logging.Debug($"[{GetType().Name}] Unregistered from InputManager");
}
// Hide preview visuals
HidePreview();
if (showDebugLogs) Logging.Debug($"[{GetType().Name}] Disabled");
}
#endregion
#region ITouchInputConsumer Implementation
public void OnTap(Vector2 worldPosition)
{
// Drag-to-launch uses hold/drag, not tap
}
public void OnHoldStart(Vector2 worldPosition)
{
if (!_isEnabled) return;
StartDrag(worldPosition);
}
public void OnHoldMove(Vector2 worldPosition)
{
if (!_isEnabled || !_isDragging) return;
UpdateDrag(worldPosition);
}
public void OnHoldEnd(Vector2 worldPosition)
{
if (!_isEnabled || !_isDragging) return;
EndDrag(worldPosition);
}
#endregion
#region Drag Handling
/// <summary>
/// Start drag operation
/// </summary>
protected virtual void StartDrag(Vector2 worldPosition)
{
_isDragging = true;
// Use launch anchor as the reference point (like Angry Birds)
_dragStartPosition = launchAnchor.position;
if (showDebugLogs) Logging.Debug($"[{GetType().Name}] Started drag at {worldPosition}, anchor at {_dragStartPosition}");
OnDragStart?.Invoke(worldPosition);
}
/// <summary>
/// Update drag operation
/// </summary>
protected virtual void UpdateDrag(Vector2 currentWorldPosition)
{
// Calculate launch parameters once and cache
_cachedLaunchParams = CalculateLaunchParameters(currentWorldPosition);
// Warn if mass is zero or invalid
if (_cachedLaunchParams.Mass <= 0f && showDebugLogs)
{
Logging.Warning($"[{GetType().Name}] Projectile mass is {_cachedLaunchParams.Mass}! Trajectory calculation will be inaccurate. Override GetProjectileMass().");
}
// Update visuals with cached parameters
UpdateVisuals(currentWorldPosition, _cachedLaunchParams);
OnDragUpdate?.Invoke(currentWorldPosition, _cachedLaunchParams.Direction, _cachedLaunchParams.Force);
}
/// <summary>
/// End drag operation and potentially launch
/// </summary>
protected virtual void EndDrag(Vector2 currentWorldPosition)
{
_isDragging = false;
// Hide preview
HidePreview();
// Recalculate final parameters (position may have changed since last UpdateDrag)
_cachedLaunchParams = CalculateLaunchParameters(currentWorldPosition);
OnDragEnd?.Invoke(currentWorldPosition, _cachedLaunchParams.Direction, _cachedLaunchParams.Force);
if (showDebugLogs)
Logging.Debug($"[{GetType().Name}] Launching with force {_cachedLaunchParams.Force:F2}");
PerformLaunch(_cachedLaunchParams.Direction, _cachedLaunchParams.Force);
OnLaunch?.Invoke(_cachedLaunchParams.Direction, _cachedLaunchParams.Force);
}
/// <summary>
/// Calculate launch parameters from current drag position.
/// Caches results to avoid recalculating force multiple times.
/// </summary>
private LaunchParameters CalculateLaunchParameters(Vector2 currentWorldPosition)
{
// Calculate drag vector from anchor to current drag position
// Pull back (away from anchor) = launch forward (toward anchor direction)
Vector2 dragVector = _dragStartPosition - currentWorldPosition;
// Calculate distance and ratio
float dragDistance = dragVector.magnitude;
float dragRatio = Mathf.Clamp01(dragDistance / MaxDragDistance);
// Calculate force using config
float force = Config?.CalculateForce(dragDistance, dragRatio) ?? (dragRatio * MaxForce);
// Normalize direction
Vector2 direction = dragDistance > 0.01f ? dragVector.normalized : Vector2.zero;
// Get mass from projectile
float mass = GetProjectileMass();
return new LaunchParameters
{
Direction = direction,
Force = force,
DragDistance = dragDistance,
DragRatio = dragRatio,
Mass = mass
};
}
#endregion
#region Abstract Methods - Subclass Implementation
/// <summary>
/// Perform the actual launch (spawn projectile/airplane, apply force, etc.)
/// </summary>
protected abstract void PerformLaunch(Vector2 direction, float force);
#endregion
#region Virtual Methods - Visual Feedback (Override if needed)
/// <summary>
/// Update visual feedback during drag (trajectory preview, rubber band, etc.)
/// Default: Updates trajectory preview using prefab's physics properties.
/// Override for custom visuals.
/// </summary>
/// <param name="currentPosition">Current drag position</param>
/// <param name="launchParams">Cached launch parameters (direction, force, etc.)</param>
protected virtual void UpdateVisuals(Vector2 currentPosition, LaunchParameters launchParams)
{
if (trajectoryPreview != null && launchParams.DragDistance > 0.1f)
{
GameObject prefab = GetProjectilePrefab();
if (prefab == null) return;
// Get gravity from prefab's Rigidbody2D gravityScale
var rb = prefab.GetComponent<Rigidbody2D>();
float gravityScale = rb != null ? rb.gravityScale : 1f;
float gravity = Physics2D.gravity.magnitude * gravityScale;
// Use mass from settings (already in launchParams)
trajectoryPreview.UpdateTrajectory(launchAnchor.position, launchParams.Direction,
launchParams.Force, launchParams.Mass, gravity);
}
}
/// <summary>
/// Show preview visuals when controller is enabled.
/// Default: Shows trajectory preview.
/// Override for custom visuals.
/// </summary>
protected virtual void ShowPreview()
{
trajectoryPreview?.Show();
}
/// <summary>
/// Hide preview visuals when controller is disabled.
/// Default: Hides trajectory preview.
/// Override for custom visuals.
/// </summary>
protected virtual void HidePreview()
{
trajectoryPreview?.Hide();
}
public Transform GetLaunchAnchorTransform()
{
return launchAnchor;
}
#endregion
#region Abstract Methods - Physics Configuration
/// <summary>
/// Get projectile mass for trajectory calculation.
/// MUST read from settings - the same source that Initialize() uses.
/// Subclasses implement to return the actual runtime mass.
/// </summary>
protected abstract float GetProjectileMass();
#endregion
#region Cleanup
internal override void OnManagedDestroy()
{
base.OnManagedDestroy();
// Ensure we unregister from InputManager
if (_isRegisteredForInput && InputManager.Instance != null)
{
InputManager.Instance.UnregisterOverrideConsumer(this);
}
}
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 44e042d1338149f6bb8adf6129e1c6c2
timeCreated: 1764851204

View File

@@ -0,0 +1,59 @@
using System;
using UnityEngine;
namespace Common.Input
{
/// <summary>
/// Configuration for slingshot launch mechanics.
/// Can be embedded in any minigame settings that use drag-to-launch.
/// </summary>
[Serializable]
public class SlingshotConfig
{
[Header("Drag & Force Settings")]
[Tooltip("Distance to reach max force")]
public float maxDragDistance = 5f;
[Tooltip("Base force value")]
public float baseLaunchForce = 20f;
[Tooltip("Minimum threshold (0-1)")]
[Range(0f, 1f)]
public float minForceMultiplier = 0.1f;
[Tooltip("Maximum cap (0-2, usually 1)")]
[Range(0f, 2f)]
public float maxForceMultiplier = 1f;
[Header("Trajectory Settings")]
[Tooltip("Number of preview points")]
public int trajectoryPoints = 50;
[Tooltip("Time between points")]
public float trajectoryTimeStep = 0.1f;
[Tooltip("Show trajectory after launch (seconds, 0 = no lock)")]
public float trajectoryLockDuration = 2f;
[Header("Input")]
[Tooltip("Auto-register with InputManager on Enable()")]
public bool autoRegisterInput = true;
/// <summary>
/// Calculate force from drag parameters using configured multipliers
/// </summary>
public float CalculateForce(float dragDistance, float dragRatio)
{
return dragRatio * maxForceMultiplier * baseLaunchForce;
}
/// <summary>
/// Calculate minimum force threshold
/// </summary>
public float GetMinForce()
{
return baseLaunchForce * minForceMultiplier;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: be4f5d5fd7084425a7bf28a1fadf125e
timeCreated: 1764854225

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e8315fa927ac4db4a53e985fac95c178
timeCreated: 1764857542

View File

@@ -0,0 +1,257 @@
using Core;
using UnityEngine;
namespace Common.Visual
{
/// <summary>
/// Common trajectory preview component for slingshot-style mechanics.
/// Displays a line showing the predicted arc of a launched projectile.
/// Supports multiple API overloads for different use cases.
/// </summary>
[RequireComponent(typeof(LineRenderer))]
public class TrajectoryPreview : MonoBehaviour
{
[Header("Trajectory Settings")]
[Tooltip("Number of points in trajectory line")]
[SerializeField] private int trajectoryPoints = 50;
[Tooltip("Time step between trajectory points (seconds)")]
[SerializeField] private float timeStep = 0.1f;
[Tooltip("Ground level Y position (trajectory stops here)")]
[SerializeField] private float groundLevel = -10f;
[Header("Visual")]
[Tooltip("Color of trajectory line")]
[SerializeField] private Color lineColor = Color.yellow;
[Tooltip("Width of trajectory line")]
[SerializeField] private float lineWidth = 0.1f;
private LineRenderer _lineRenderer;
private bool _isLocked;
private float _lockTimer;
private float _lockDuration;
#region Unity Lifecycle
private void Awake()
{
_lineRenderer = GetComponent<LineRenderer>();
if (_lineRenderer != null)
{
_lineRenderer.startWidth = lineWidth;
_lineRenderer.endWidth = lineWidth;
_lineRenderer.startColor = lineColor;
_lineRenderer.endColor = lineColor;
_lineRenderer.positionCount = trajectoryPoints;
_lineRenderer.enabled = false;
}
}
private void Update()
{
if (_isLocked)
{
_lockTimer += Time.deltaTime;
if (_lockTimer >= _lockDuration)
{
_isLocked = false;
Hide();
}
}
}
#endregion
#region Public API - Visibility
/// <summary>
/// Show the trajectory preview line.
/// Clears any existing trajectory data so nothing displays until UpdateTrajectory is called.
/// </summary>
public void Show()
{
if (_lineRenderer != null)
{
// Clear old trajectory data
_lineRenderer.positionCount = 0;
// Enable the line renderer
_lineRenderer.enabled = true;
}
}
/// <summary>
/// Hide the trajectory preview line (unless locked)
/// </summary>
public void Hide()
{
if (_isLocked) return;
if (_lineRenderer != null)
{
_lineRenderer.enabled = false;
}
}
/// <summary>
/// Lock the trajectory display for a duration (keeps showing after launch)
/// </summary>
public void LockTrajectory(float duration)
{
_isLocked = true;
_lockTimer = 0f;
_lockDuration = duration;
if (_lineRenderer != null)
{
_lineRenderer.enabled = true;
}
}
/// <summary>
/// Force hide the trajectory immediately, clearing any lock state.
/// Use this when transitioning turns or resetting the slingshot.
/// </summary>
public void ForceHide()
{
_isLocked = false;
_lockTimer = 0f;
if (_lineRenderer != null)
{
_lineRenderer.enabled = false;
}
}
#endregion
#region Public API - Update Trajectory (Multiple Overloads)
/// <summary>
/// Update trajectory from velocity and gravity directly.
/// Most explicit - caller calculates everything.
/// </summary>
public void UpdateTrajectory(Vector2 startPos, Vector2 velocity, float gravity)
{
if (_lineRenderer == null) return;
CalculateAndSetTrajectory(startPos, velocity, gravity);
}
/// <summary>
/// Update trajectory from launch force and mass.
/// Calculates velocity as: v = (direction * force) / mass
/// </summary>
public void UpdateTrajectory(Vector2 startPos, Vector2 direction, float force, float mass, float gravity)
{
if (_lineRenderer == null) return;
if (mass <= 0f)
{
Logging.Warning("[TrajectoryPreview] Cannot calculate trajectory with zero or negative mass!");
return;
}
Vector2 velocity = (direction * force) / mass;
CalculateAndSetTrajectory(startPos, velocity, gravity);
}
/// <summary>
/// Update trajectory from prefab's Rigidbody2D properties.
/// Reads mass and gravityScale from prefab, calculates gravity automatically.
/// </summary>
public void UpdateTrajectory(Vector2 startPos, Vector2 direction, float force, GameObject prefab)
{
if (_lineRenderer == null || prefab == null) return;
var rb = prefab.GetComponent<Rigidbody2D>();
if (rb == null)
{
Logging.Warning($"[TrajectoryPreview] Prefab '{prefab.name}' has no Rigidbody2D!");
return;
}
float mass = rb.mass;
float gravity = Physics2D.gravity.magnitude * rb.gravityScale;
if (mass <= 0f)
{
Logging.Warning($"[TrajectoryPreview] Prefab '{prefab.name}' has zero mass!");
return;
}
Vector2 velocity = (direction * force) / mass;
CalculateAndSetTrajectory(startPos, velocity, gravity);
}
#endregion
#region Internal Calculation
/// <summary>
/// Calculate and set trajectory points using kinematic formula.
/// Uses: y = y0 + v*t - 0.5*g*t^2
/// </summary>
private void CalculateAndSetTrajectory(Vector2 startPos, Vector2 velocity, float gravity)
{
Vector3[] points = new Vector3[trajectoryPoints];
for (int i = 0; i < trajectoryPoints; i++)
{
float time = i * timeStep;
// Kinematic equations
float x = startPos.x + velocity.x * time;
float y = startPos.y + velocity.y * time - 0.5f * gravity * time * time;
points[i] = new Vector3(x, y, 0);
// Stop at ground level
if (y <= groundLevel)
{
// Fill remaining points at ground level
for (int j = i; j < trajectoryPoints; j++)
{
float tGround = j * timeStep;
float xGround = startPos.x + velocity.x * tGround;
points[j] = new Vector3(xGround, groundLevel, 0);
}
break;
}
}
_lineRenderer.positionCount = trajectoryPoints;
_lineRenderer.SetPositions(points);
}
#endregion
#region Configuration
/// <summary>
/// Set the number of trajectory points (for performance tuning)
/// </summary>
public void SetTrajectoryPoints(int points)
{
trajectoryPoints = Mathf.Max(5, points);
if (_lineRenderer != null)
{
_lineRenderer.positionCount = trajectoryPoints;
}
}
/// <summary>
/// Set the time step between points
/// </summary>
public void SetTimeStep(float step)
{
timeStep = Mathf.Max(0.01f, step);
}
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b86a4cd82d4a47de9d1e4d97ffd01f5e
timeCreated: 1764857542

View File

@@ -5,6 +5,7 @@ using AppleHills.Core.Settings;
using Core.Lifecycle;
using Core.Settings;
using Input;
using Minigames.Airplane.Settings;
using Minigames.FortFight.Core;
using UnityEngine;
@@ -175,6 +176,7 @@ namespace Core
var birdPooperSettings = SettingsProvider.Instance.LoadSettingsSynchronous<BirdPooperSettings>();
var statueDressupSettings = SettingsProvider.Instance.LoadSettingsSynchronous<StatueDressupSettings>();
var fortFightSettings = SettingsProvider.Instance.LoadSettingsSynchronous<FortFightSettings>();
var airplaneSettings = SettingsProvider.Instance.LoadSettingsSynchronous<AirplaneSettings>();
// Register settings with service locator
@@ -258,10 +260,20 @@ namespace Core
Debug.LogError("Failed to load FortFightSettings");
}
if (airplaneSettings != null)
{
ServiceLocator.Register<IAirplaneSettings>(airplaneSettings);
Logging.Debug("AirplaneSettings registered successfully");
}
else
{
Debug.LogError("Failed to load AirplaneSettings");
}
// Log success
_settingsLoaded = playerSettings != null && interactionSettings != null && minigameSettings != null
&& cardSystemSettings != null && birdPooperSettings != null && statueDressupSettings != null
&& fortFightSettings != null;
&& fortFightSettings != null && sortingGameSettings != null && airplaneSettings != null;
if (_settingsLoaded)
{
Logging.Debug("All settings loaded and registered with ServiceLocator");

View File

@@ -219,6 +219,9 @@ namespace AppleHills.Core.Settings
/// </summary>
public interface IFortFightSettings
{
// Slingshot Configuration
Common.Input.SlingshotConfig SlingshotSettings { get; }
// Block configurations
System.Collections.Generic.List<Minigames.FortFight.Settings.BlockMaterialConfig> MaterialConfigs { get; }
System.Collections.Generic.List<Minigames.FortFight.Settings.BlockSizeConfig> SizeConfigs { get; }
@@ -248,12 +251,6 @@ namespace AppleHills.Core.Settings
int FortBlockLayer { get; } // Layer index for fort blocks
int ProjectileLayer { get; } // Layer index for projectiles
// Slingshot Settings
float BaseLaunchForce { get; } // Base launch force multiplier
float MinForceMultiplier { get; } // Minimum force required to launch (0-1)
float MaxForceMultiplier { get; } // Maximum force cap (0-2, usually 1)
float TrajectoryLockDuration { get; } // How long to show trajectory after launch
// Projectile Abilities
float VacuumSlideSpeed { get; } // Constant velocity for vacuum sliding (m/s)
int VacuumDestroyBlockCount { get; } // Blocks to destroy while sliding
@@ -279,4 +276,47 @@ namespace AppleHills.Core.Settings
Minigames.FortFight.Settings.BlockMaterialConfig GetMaterialConfig(Minigames.FortFight.Data.BlockMaterial material);
Minigames.FortFight.Settings.BlockSizeConfig GetSizeConfig(Minigames.FortFight.Data.BlockSize size);
}
/// <summary>
/// Interface for Airplane minigame settings
/// </summary>
public interface IAirplaneSettings
{
// Airplane Types - Get configuration by type
Minigames.Airplane.Data.AirplaneTypeConfig GetAirplaneConfig(Minigames.Airplane.Data.AirplaneAbilityType type);
Minigames.Airplane.Data.JetAbilityConfig JetAbilityConfig { get; }
Minigames.Airplane.Data.BobbingAbilityConfig BobbingAbilityConfig { get; }
Minigames.Airplane.Data.DropAbilityConfig DropAbilityConfig { get; }
Minigames.Airplane.Data.AirplaneAbilityType DefaultAirplaneType { get; }
// Slingshot Configuration
Common.Input.SlingshotConfig SlingshotSettings { get; }
// Flight Settings
float AirplaneMass { get; }
float MaxFlightTime { get; }
// Timing
float IntroDuration { get; }
float PersonIntroDuration { get; }
float EvaluationDuration { get; }
// Spawn System
float DynamicSpawnThreshold { get; }
float TargetMinDistance { get; }
float TargetMaxDistance { get; }
float ObjectSpawnMinInterval { get; }
float ObjectSpawnMaxInterval { get; }
float PositiveNegativeRatio { get; } // 0-1, where 1 = all positive, 0 = all negative
float SpawnDistanceAhead { get; }
float GroundSpawnInterval { get; }
// Ground Snapping
int GroundLayer { get; }
float MaxGroundRaycastDistance { get; }
float DefaultObjectYOffset { get; }
// Debug
bool ShowDebugLogs { get; }
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4cdcfc21e5ec473dafc45f1ae16624b2
timeCreated: 1764851234

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 71a8e50c7218456c96ceb54cd1140918
timeCreated: 1764975940

View File

@@ -0,0 +1,69 @@
using AppleHills.Core.Settings;
using Core;
using Minigames.Airplane.Data;
namespace Minigames.Airplane.Abilities
{
/// <summary>
/// Factory for creating airplane abilities from settings configuration.
/// </summary>
public static class AbilityFactory
{
/// <summary>
/// Create an ability instance based on type and settings.
/// </summary>
public static BaseAirplaneAbility CreateAbility(AirplaneAbilityType type, IAirplaneSettings settings)
{
if (settings == null)
{
Logging.Error("[AbilityFactory] Settings is null!");
return null;
}
return type switch
{
AirplaneAbilityType.Jet => CreateJetAbility(settings),
AirplaneAbilityType.Bobbing => CreateBobbingAbility(settings),
AirplaneAbilityType.Drop => CreateDropAbility(settings),
_ => null
};
}
private static JetAbility CreateJetAbility(IAirplaneSettings settings)
{
var config = settings.JetAbilityConfig;
return new JetAbility(
config.abilityName,
config.abilityIcon,
config.cooldownDuration,
config.jetSpeed,
config.jetAngle
);
}
private static BobbingAbility CreateBobbingAbility(IAirplaneSettings settings)
{
var config = settings.BobbingAbilityConfig;
return new BobbingAbility(
config.abilityName,
config.abilityIcon,
config.cooldownDuration,
config.bobForce
);
}
private static DropAbility CreateDropAbility(IAirplaneSettings settings)
{
var config = settings.DropAbilityConfig;
return new DropAbility(
config.abilityName,
config.abilityIcon,
config.cooldownDuration,
config.dropForce,
config.dropDistance,
config.zeroHorizontalVelocity
);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6668ddc48c30428f98d780700e93cab5
timeCreated: 1764977809

View File

@@ -0,0 +1,232 @@
using System;
using Core;
using UnityEngine;
namespace Minigames.Airplane.Abilities
{
/// <summary>
/// Abstract base class for airplane special abilities.
/// Each ability defines its own execution logic, input handling, and cooldown.
/// Subclasses override Execute() to implement specific ability behavior.
/// Created from settings configuration at runtime.
/// </summary>
[System.Serializable]
public abstract class BaseAirplaneAbility
{
#region Configuration
protected readonly string abilityName;
protected readonly Sprite abilityIcon;
protected readonly float cooldownDuration;
protected readonly bool canReuse;
protected bool showDebugLogs;
#endregion
#region Constructor
/// <summary>
/// Base constructor for abilities. Called by subclasses.
/// </summary>
protected BaseAirplaneAbility(string name, Sprite icon, float cooldown, bool reusable = true)
{
abilityName = name;
abilityIcon = icon;
cooldownDuration = cooldown;
canReuse = reusable;
showDebugLogs = false;
}
#endregion
#region Properties
public string AbilityName => abilityName;
public Sprite AbilityIcon => abilityIcon;
public float CooldownDuration => cooldownDuration;
public bool CanReuse => canReuse;
#endregion
#region State (Runtime)
protected Core.AirplaneController currentAirplane;
protected bool isActive;
protected bool isOnCooldown;
protected float cooldownTimer;
public bool IsActive => isActive;
public bool IsOnCooldown => isOnCooldown;
public float CooldownRemaining => cooldownTimer;
public bool CanActivate => !isOnCooldown && !isActive && currentAirplane != null && currentAirplane.IsFlying;
#endregion
#region Events
public event Action<BaseAirplaneAbility> OnAbilityActivated;
public event Action<BaseAirplaneAbility> OnAbilityDeactivated;
public event Action<float, float> OnCooldownChanged; // (remaining, total)
#endregion
#region Lifecycle
/// <summary>
/// Initialize ability with airplane reference.
/// Called when airplane is spawned.
/// </summary>
public virtual void Initialize(Core.AirplaneController airplane)
{
currentAirplane = airplane;
isActive = false;
isOnCooldown = false;
cooldownTimer = 0f;
if (showDebugLogs)
{
Logging.Debug($"[{abilityName}] Initialized with airplane");
}
}
/// <summary>
/// Update cooldown timer. Called every frame by ability manager.
/// </summary>
public virtual void UpdateCooldown(float deltaTime)
{
if (isOnCooldown)
{
cooldownTimer -= deltaTime;
if (cooldownTimer <= 0f)
{
cooldownTimer = 0f;
isOnCooldown = false;
if (showDebugLogs)
{
Logging.Debug($"[{abilityName}] Cooldown complete");
}
}
OnCooldownChanged?.Invoke(cooldownTimer, cooldownDuration);
}
}
/// <summary>
/// Cleanup when airplane is destroyed or flight ends.
/// </summary>
public virtual void Cleanup()
{
if (isActive)
{
Deactivate();
}
currentAirplane = null;
isActive = false;
isOnCooldown = false;
cooldownTimer = 0f;
if (showDebugLogs)
{
Logging.Debug($"[{abilityName}] Cleaned up");
}
}
#endregion
#region Abstract Methods (Must Override)
/// <summary>
/// Execute the ability effect.
/// Override to implement specific ability behavior.
/// </summary>
public abstract void Execute();
/// <summary>
/// Stop the ability effect (for sustained abilities).
/// Override if ability can be deactivated.
/// </summary>
public virtual void Deactivate()
{
if (!isActive) return;
isActive = false;
OnAbilityDeactivated?.Invoke(this);
if (showDebugLogs)
{
Logging.Debug($"[{abilityName}] Deactivated");
}
}
#endregion
#region Protected Helpers
/// <summary>
/// Start ability activation (called by subclasses).
/// </summary>
protected virtual void StartActivation()
{
if (!CanActivate)
{
if (showDebugLogs)
{
Logging.Warning($"[{abilityName}] Cannot activate - IsOnCooldown: {isOnCooldown}, IsActive: {isActive}, CanFly: {currentAirplane?.IsFlying}");
}
return;
}
isActive = true;
OnAbilityActivated?.Invoke(this);
if (showDebugLogs)
{
Logging.Debug($"[{abilityName}] Activated");
}
}
/// <summary>
/// Start cooldown timer (called by subclasses after execution).
/// </summary>
protected virtual void StartCooldown()
{
isOnCooldown = true;
cooldownTimer = cooldownDuration;
OnCooldownChanged?.Invoke(cooldownTimer, cooldownDuration);
if (showDebugLogs)
{
Logging.Debug($"[{abilityName}] Cooldown started: {cooldownDuration}s");
}
}
/// <summary>
/// Check if airplane reference is valid.
/// </summary>
protected bool ValidateAirplane()
{
if (currentAirplane == null)
{
Logging.Warning($"[{abilityName}] Cannot execute - airplane reference is null!");
return false;
}
if (!currentAirplane.IsFlying)
{
if (showDebugLogs)
{
Logging.Debug($"[{abilityName}] Cannot execute - airplane is not flying!");
}
return false;
}
return true;
}
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9b5ef9d7a9ce48ddb98de1e974e1d496
timeCreated: 1764975940

View File

@@ -0,0 +1,63 @@
using Core;
using UnityEngine;
namespace Minigames.Airplane.Abilities
{
/// <summary>
/// Bobbing Plane Ability: Tap to jump upward and forward.
/// Instant ability - activates once, then cooldown.
/// Applies diagonal impulse (forward + upward) to maintain airborne momentum.
/// Configuration loaded from settings at runtime.
/// </summary>
public class BobbingAbility : BaseAirplaneAbility
{
#region Configuration
private readonly Vector2 bobForce;
#endregion
#region Constructor
/// <summary>
/// Create bobbing ability with configuration from settings.
/// </summary>
public BobbingAbility(string name, Sprite icon, float cooldown, Vector2 force)
: base(name, icon, cooldown)
{
bobForce = force;
}
#endregion
#region Override Methods
public override void Execute()
{
if (!ValidateAirplane()) return;
if (!CanActivate) return;
StartActivation();
var rb = currentAirplane.GetComponent<Rigidbody2D>();
if (rb != null)
{
// Apply configured forward and upward impulse
// X = forward momentum, Y = upward lift
rb.AddForce(bobForce, ForceMode2D.Impulse);
if (showDebugLogs)
{
Logging.Debug($"[BobbingAbility] Executed - Force: {bobForce} (forward: {bobForce.x:F1}, upward: {bobForce.y:F1})");
}
}
// Instant ability - deactivate immediately and start cooldown
base.Deactivate();
StartCooldown();
}
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: cc60dfa311424a7a9f2fdfe19eda8639
timeCreated: 1764975962

View File

@@ -0,0 +1,140 @@
using System.Collections;
using Core;
using UnityEngine;
namespace Minigames.Airplane.Abilities
{
/// <summary>
/// Drop Plane Ability: Swipe down to drop straight down.
/// Sustained ability - drops for fixed duration/distance.
/// Good for precision strikes on targets.
/// Configuration loaded from settings at runtime.
/// </summary>
public class DropAbility : BaseAirplaneAbility
{
#region Configuration
private readonly float dropForce;
private readonly float dropDistance;
private readonly bool zeroHorizontalVelocity;
#endregion
#region Constructor
/// <summary>
/// Create drop ability with configuration from settings.
/// </summary>
public DropAbility(string name, Sprite icon, float cooldown, float force, float distance, bool zeroHorizontal = true)
: base(name, icon, cooldown)
{
dropForce = force;
dropDistance = distance;
zeroHorizontalVelocity = zeroHorizontal;
}
#endregion
#region State
private float originalXVelocity;
private Vector3 dropStartPosition;
private Coroutine dropCoroutine;
#endregion
#region Override Methods
public override void Execute()
{
if (!ValidateAirplane()) return;
if (!CanActivate) return;
StartActivation();
var rb = currentAirplane.GetComponent<Rigidbody2D>();
if (rb != null)
{
// Store original velocity
originalXVelocity = rb.linearVelocity.x;
// Zero horizontal velocity if configured
if (zeroHorizontalVelocity)
{
rb.linearVelocity = new Vector2(0f, rb.linearVelocity.y);
}
// Apply strong downward force
rb.AddForce(Vector2.down * dropForce, ForceMode2D.Impulse);
// Track drop distance
dropStartPosition = currentAirplane.transform.position;
// Start monitoring drop distance
dropCoroutine = currentAirplane.StartCoroutine(MonitorDropDistance());
}
if (showDebugLogs)
{
Logging.Debug($"[DropAbility] Activated - Force: {dropForce}, Distance: {dropDistance}");
}
}
public override void Deactivate()
{
if (!isActive) return;
// Stop monitoring
if (dropCoroutine != null && currentAirplane != null)
{
currentAirplane.StopCoroutine(dropCoroutine);
dropCoroutine = null;
}
// Restore horizontal velocity (optional)
if (currentAirplane != null)
{
var rb = currentAirplane.GetComponent<Rigidbody2D>();
if (rb != null && zeroHorizontalVelocity)
{
Vector2 currentVel = rb.linearVelocity;
rb.linearVelocity = new Vector2(originalXVelocity * 0.5f, currentVel.y); // Resume at reduced speed
}
}
base.Deactivate();
// Start cooldown
StartCooldown();
if (showDebugLogs)
{
Logging.Debug("[DropAbility] Deactivated, cooldown started");
}
}
#endregion
#region Drop Monitoring
private IEnumerator MonitorDropDistance()
{
while (isActive && currentAirplane != null)
{
float distanceDropped = Mathf.Abs(dropStartPosition.y - currentAirplane.transform.position.y);
if (distanceDropped >= dropDistance)
{
// Drop distance reached - deactivate
Deactivate();
yield break;
}
yield return null;
}
}
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3b79dff7e24b4167af7631351242d500
timeCreated: 1764975977

View File

@@ -0,0 +1,104 @@
using Core;
using UnityEngine;
namespace Minigames.Airplane.Abilities
{
/// <summary>
/// Jet Plane Ability: Hold to fly straight without gravity.
/// Sustained ability - active while button held, deactivates on release.
/// </summary>
public class JetAbility : BaseAirplaneAbility
{
#region Configuration
private readonly float jetSpeed;
private readonly float jetAngle;
#endregion
#region Constructor
/// <summary>
/// Create jet ability with configuration from settings.
/// </summary>
public JetAbility(string name, Sprite icon, float cooldown, float speed, float angle)
: base(name, icon, cooldown)
{
jetSpeed = speed;
jetAngle = angle;
}
#endregion
#region State
private float originalGravityScale;
private bool originalRotateToVelocity;
#endregion
#region Override Methods
public override void Execute()
{
if (!ValidateAirplane()) return;
if (!CanActivate) return;
StartActivation();
// Store original physics values
var rb = currentAirplane.GetComponent<Rigidbody2D>();
if (rb != null)
{
originalGravityScale = rb.gravityScale;
// Disable gravity
rb.gravityScale = 0f;
// Set constant velocity in forward direction
Vector2 direction = Quaternion.Euler(0, 0, jetAngle) * Vector2.right;
rb.linearVelocity = direction.normalized * jetSpeed;
}
// Disable rotation to velocity (maintain straight angle)
originalRotateToVelocity = currentAirplane.RotateToVelocity;
currentAirplane.RotateToVelocity = false;
if (showDebugLogs)
{
Logging.Debug($"[JetAbility] Activated - Speed: {jetSpeed}, Angle: {jetAngle}");
}
}
public override void Deactivate()
{
if (!isActive) return;
// Restore original physics
if (currentAirplane != null)
{
var rb = currentAirplane.GetComponent<Rigidbody2D>();
if (rb != null)
{
rb.gravityScale = originalGravityScale;
}
// Restore rotation behavior
currentAirplane.RotateToVelocity = originalRotateToVelocity;
}
base.Deactivate();
// Start cooldown after deactivation
StartCooldown();
if (showDebugLogs)
{
Logging.Debug("[JetAbility] Deactivated, cooldown started");
}
}
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1175e6da9b23482c8ca74e18b35a82e4
timeCreated: 1764975953

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 48e6932cbd9645bfac8add678e705033
timeCreated: 1764851249

View File

@@ -0,0 +1,120 @@
using Common.Camera;
using Core;
using Minigames.Airplane.Data;
using Unity.Cinemachine;
using UnityEngine;
namespace Minigames.Airplane.Core
{
/// <summary>
/// Manages camera states for the airplane minigame.
/// Handles transitions between Intro, NextPerson, Aiming, and Flight cameras.
/// Flight camera includes follow functionality for tracking airplanes.
/// </summary>
public class AirplaneCameraManager : CameraStateManager<AirplaneCameraState>
{
#region Singleton
private static AirplaneCameraManager _instance;
public static AirplaneCameraManager Instance => _instance;
#endregion
#region Lifecycle
internal override void OnManagedAwake()
{
// Base class handles InitializeCameraMap() and ValidateCameras()
base.OnManagedAwake();
// Set singleton
if (_instance != null && _instance != this)
{
Logging.Warning("[AirplaneCameraManager] Multiple instances detected! Destroying duplicate.");
Destroy(gameObject);
return;
}
_instance = this;
}
internal override void OnManagedDestroy()
{
base.OnManagedDestroy();
if (_instance == this)
{
_instance = null;
}
}
#endregion
#region Validation
protected override void ValidateCameras()
{
// Base class validates all enum states have cameras assigned
base.ValidateCameras();
// Additional validation: Check if flight camera has follow component
var flightCamera = GetCamera(AirplaneCameraState.Flight);
if (flightCamera != null)
{
var followComponent = flightCamera.GetComponent<CinemachineFollow>();
if (followComponent == null)
{
Logging.Warning("[AirplaneCameraManager] Flight camera missing CinemachineFollow component!");
}
}
}
#endregion
#region Flight Camera Follow
/// <summary>
/// Start following an airplane with the flight camera
/// </summary>
public void StartFollowingAirplane(Transform airplaneTransform)
{
var flightCamera = GetCamera(AirplaneCameraState.Flight);
if (flightCamera == null)
{
Logging.Warning("[AirplaneCameraManager] Cannot follow airplane - flight camera not assigned!");
return;
}
if (airplaneTransform == null)
{
Logging.Warning("[AirplaneCameraManager] Cannot follow null airplane transform!");
return;
}
// Set the follow target on the flight camera
flightCamera.Target.TrackingTarget = airplaneTransform;
// Switch to flight camera
SwitchToState(AirplaneCameraState.Flight);
if (showDebugLogs) Logging.Debug($"[AirplaneCameraManager] Now following airplane: {airplaneTransform.gameObject.name}");
}
/// <summary>
/// Stop following the airplane and clear the target
/// </summary>
public void StopFollowingAirplane()
{
var flightCamera = GetCamera(AirplaneCameraState.Flight);
if (flightCamera == null) return;
// Clear the follow target
flightCamera.Target.TrackingTarget = null;
if (showDebugLogs) Logging.Debug("[AirplaneCameraManager] Stopped following airplane");
}
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 34b856742e12475793b85a0a3019d67b
timeCreated: 1764851249

View File

@@ -0,0 +1,385 @@
using System;
using System.Collections;
using Core;
using Core.Lifecycle;
using Minigames.Airplane.Abilities;
using Minigames.Airplane.Data;
using UnityEngine;
namespace Minigames.Airplane.Core
{
/// <summary>
/// Controls airplane movement using physics-based flight.
/// Uses dynamic Rigidbody2D with impulse force for smooth, natural motion.
/// Follows an arc trajectory based on launch parameters and gravity.
/// </summary>
[RequireComponent(typeof(Rigidbody2D), typeof(Collider2D))]
public class AirplaneController : ManagedBehaviour
{
#region Events
/// <summary>
/// Fired when airplane is launched. Parameters: (AirplaneController airplane)
/// </summary>
public event Action<AirplaneController> OnLaunched;
/// <summary>
/// Fired when airplane lands/stops. Parameters: (AirplaneController airplane)
/// </summary>
public event Action<AirplaneController> OnLanded;
/// <summary>
/// Fired when airplane hits a target. Parameters: (AirplaneController airplane, string targetName)
/// </summary>
public event Action<AirplaneController, string> OnTargetHit;
/// <summary>
/// Fired when airplane times out. Parameters: (AirplaneController airplane)
/// </summary>
public event Action<AirplaneController> OnTimeout;
#endregion
#region Inspector Properties
[Header("Flight Settings")]
[Tooltip("Gravity multiplier for arc calculation")]
[SerializeField] private float gravity = 9.81f;
[Header("Debug")]
[SerializeField] private bool showDebugLogs = false;
#endregion
#region State
private Rigidbody2D rb2D;
private Collider2D airplaneCollider;
private bool isFlying = false;
private float flightTimer = 0f;
private string lastHitTarget = null;
// Runtime values loaded from settings
private float mass;
private float maxFlightTime;
// Ability system
private BaseAirplaneAbility currentAbility;
public bool IsFlying => isFlying;
public Vector2 CurrentVelocity => rb2D != null ? rb2D.linearVelocity : Vector2.zero;
public string LastHitTarget => lastHitTarget;
public BaseAirplaneAbility CurrentAbility => currentAbility;
public bool RotateToVelocity { get; set; } = true; // Made public for ability access
#endregion
#region Lifecycle
internal override void OnManagedAwake()
{
base.OnManagedAwake();
// Load settings
var settings = GameManager.GetSettingsObject<AppleHills.Core.Settings.IAirplaneSettings>();
if (settings != null)
{
mass = settings.AirplaneMass;
maxFlightTime = settings.MaxFlightTime;
}
else
{
Logging.Warning("[AirplaneController] AirplaneSettings not found, using defaults!");
mass = 1f;
maxFlightTime = 10f;
}
// Cache components
rb2D = GetComponent<Rigidbody2D>();
airplaneCollider = GetComponent<Collider2D>();
// Configure Rigidbody2D for physics-based movement
if (rb2D != null)
{
rb2D.bodyType = RigidbodyType2D.Dynamic;
rb2D.mass = mass;
rb2D.gravityScale = 1f; // Use Unity's gravity
rb2D.collisionDetectionMode = CollisionDetectionMode2D.Continuous;
}
// Configure Collider2D as trigger
if (airplaneCollider != null)
{
airplaneCollider.isTrigger = true;
}
}
#endregion
#region Launch
/// <summary>
/// Launch the airplane with physics impulse force
/// </summary>
public void Launch(Vector2 direction, float force)
{
if (isFlying)
{
Logging.Warning($"[AirplaneController] {gameObject.name} already flying!");
return;
}
if (rb2D == null)
{
Logging.Error("[AirplaneController] Cannot launch - Rigidbody2D is null!");
return;
}
isFlying = true;
flightTimer = 0f;
lastHitTarget = null;
// Apply impulse force - Unity physics handles the rest
Vector2 impulse = direction.normalized * force;
rb2D.AddForce(impulse, ForceMode2D.Impulse);
if (showDebugLogs)
{
float expectedSpeed = force / mass;
Logging.Debug($"[AirplaneController] Launched - Force: {force:F2}, Mass: {mass:F2}, " +
$"Expected Speed: {expectedSpeed:F2}, Direction: {direction}");
}
OnLaunched?.Invoke(this);
// Start flight monitoring (timeout and rotation)
StartCoroutine(FlightMonitorCoroutine());
}
#endregion
#region Flight Monitoring
/// <summary>
/// Monitor airplane flight for rotation and timeout.
/// Physics movement is handled automatically by Unity.
/// </summary>
private IEnumerator FlightMonitorCoroutine()
{
while (isFlying)
{
// Rotate to face velocity direction (visual only)
if (RotateToVelocity && rb2D != null && rb2D.linearVelocity.magnitude > 0.1f)
{
float angle = Mathf.Atan2(rb2D.linearVelocity.y, rb2D.linearVelocity.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(0, 0, angle);
}
// Update ability cooldown
if (currentAbility != null)
{
currentAbility.UpdateCooldown(Time.deltaTime);
}
// Update flight timer
flightTimer += Time.deltaTime;
// Check for timeout
if (flightTimer >= maxFlightTime)
{
if (showDebugLogs) Logging.Debug("[AirplaneController] Flight timeout reached");
HandleTimeout();
yield break;
}
// Check if airplane has gone off screen
if (transform.position.y < -10f)
{
if (showDebugLogs) Logging.Debug("[AirplaneController] Airplane went off screen");
HandleLanding();
yield break;
}
yield return null; // Update every frame, not just fixed update
}
}
#endregion
#region Collision Detection
/// <summary>
/// Detect trigger collisions with targets
/// </summary>
private void OnTriggerEnter2D(Collider2D other)
{
if (!isFlying) return;
// Check if it's a target
var target = other.GetComponent<Minigames.Airplane.Targets.AirplaneTarget>();
if (target != null)
{
lastHitTarget = target.TargetName;
if (showDebugLogs) Logging.Debug($"[AirplaneController] Hit target: {lastHitTarget}");
OnTargetHit?.Invoke(this, lastHitTarget);
// Land after hitting target
HandleLanding();
}
}
#endregion
#region Landing and Timeout
/// <summary>
/// Handle airplane landing
/// </summary>
private void HandleLanding()
{
if (!isFlying) return;
isFlying = false;
if (rb2D != null)
{
rb2D.linearVelocity = Vector2.zero;
rb2D.angularVelocity = 0f;
}
if (showDebugLogs) Logging.Debug("[AirplaneController] Airplane landed");
OnLanded?.Invoke(this);
}
/// <summary>
/// Handle airplane timeout
/// </summary>
private void HandleTimeout()
{
if (!isFlying) return;
isFlying = false;
if (rb2D != null)
{
rb2D.linearVelocity = Vector2.zero;
rb2D.angularVelocity = 0f;
}
if (showDebugLogs) Logging.Debug("[AirplaneController] Airplane timed out");
OnTimeout?.Invoke(this);
}
/// <summary>
/// Public method to force stop the airplane
/// </summary>
public void ForceStop()
{
HandleLanding();
}
#endregion
#region Ability System
/// <summary>
/// Initialize airplane with ability type from settings.
/// Called before launch to setup airplane properties.
/// </summary>
public void Initialize(AirplaneAbilityType abilityType)
{
// Get settings
var settings = GameManager.GetSettingsObject<AppleHills.Core.Settings.IAirplaneSettings>();
if (settings == null)
{
Logging.Error("[AirplaneController] Cannot initialize - settings not found!");
return;
}
// Get airplane config
var config = settings.GetAirplaneConfig(abilityType);
// Create ability from settings
currentAbility = Abilities.AbilityFactory.CreateAbility(abilityType, settings);
if (currentAbility != null)
{
currentAbility.Initialize(this);
}
// Apply physics overrides
if (rb2D != null)
{
if (config.overrideMass)
{
rb2D.mass = config.mass;
mass = config.mass;
}
if (config.overrideGravityScale)
rb2D.gravityScale = config.gravityScale;
if (config.overrideDrag)
rb2D.linearDamping = config.drag;
}
if (showDebugLogs)
{
Logging.Debug($"[AirplaneController] Initialized with type: {config.displayName}");
}
}
/// <summary>
/// Activate the airplane's special ability.
/// Called by UI button or input system.
/// </summary>
public void ActivateAbility()
{
if (currentAbility != null && currentAbility.CanActivate)
{
currentAbility.Execute();
}
else if (showDebugLogs)
{
Logging.Debug("[AirplaneController] Cannot activate ability - not ready or no ability assigned");
}
}
/// <summary>
/// Deactivate the airplane's special ability (for sustained abilities).
/// Called when releasing hold button.
/// </summary>
public void DeactivateAbility()
{
if (currentAbility != null && currentAbility.IsActive)
{
currentAbility.Deactivate();
}
}
#endregion
#region Cleanup
internal override void OnManagedDestroy()
{
base.OnManagedDestroy();
// Cleanup ability
if (currentAbility != null)
{
currentAbility.Cleanup();
currentAbility = null;
}
// Stop any coroutines
StopAllCoroutines();
}
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0cdaac23e969495d8c0deeaf236c259e
timeCreated: 1764851277

View File

@@ -0,0 +1,757 @@
using System;
using System.Collections;
using Core;
using Core.Lifecycle;
using Minigames.Airplane.Data;
using UnityEngine;
namespace Minigames.Airplane.Core
{
/// <summary>
/// Main game manager for the airplane minigame.
/// Orchestrates game flow through state machine with distinct phases:
/// Intro -> NextPerson -> Aiming -> Flying -> Evaluating -> (repeat or GameOver)
/// </summary>
public class AirplaneGameManager : ManagedBehaviour
{
#region Singleton
private static AirplaneGameManager _instance;
public static AirplaneGameManager Instance => _instance;
#endregion
#region Inspector References
[Header("Core Systems")]
[SerializeField] private PersonQueue personQueue;
[SerializeField] private AirplaneCameraManager cameraManager;
[SerializeField] private AirplaneLaunchController launchController;
[SerializeField] private AirplaneTargetValidator targetValidator;
[SerializeField] private AirplaneSpawnManager spawnManager;
[Header("Airplane Type Selection")]
[SerializeField] private UI.AirplaneSelectionUI selectionUI;
[SerializeField] private UI.AirplaneAbilityButton abilityButton;
[Header("Debug")]
[SerializeField] private bool showDebugLogs = true;
#endregion
#region Events
/// <summary>
/// Fired when game state changes. Parameters: (AirplaneGameState oldState, AirplaneGameState newState)
/// </summary>
public event Action<AirplaneGameState, AirplaneGameState> OnStateChanged;
/// <summary>
/// Fired when a person starts their turn. Parameters: (Person person)
/// </summary>
public event Action<Person> OnPersonStartTurn;
/// <summary>
/// Fired when a person finishes their turn. Parameters: (Person person, bool success)
/// </summary>
public event Action<Person, bool> OnPersonFinishTurn;
/// <summary>
/// Fired when game completes
/// </summary>
public event Action OnGameComplete;
#endregion
#region State
private AirplaneGameState _currentState = AirplaneGameState.AirplaneSelection;
private Person _currentPerson;
private Person _previousPerson;
private AirplaneController _currentAirplane;
private bool _lastShotHit;
private int _successCount;
private int _failCount;
private int _totalTurns;
private AirplaneAbilityType _selectedAirplaneType;
public AirplaneGameState CurrentState => _currentState;
public Person CurrentPerson => _currentPerson;
public int SuccessCount => _successCount;
public int FailCount => _failCount;
#endregion
#region Lifecycle
internal override void OnManagedAwake()
{
base.OnManagedAwake();
// Set singleton
if (_instance != null && _instance != this)
{
Logging.Warning("[AirplaneGameManager] Multiple instances detected! Destroying duplicate.");
Destroy(gameObject);
return;
}
_instance = this;
// Validate references
ValidateReferences();
}
internal override void OnManagedStart()
{
base.OnManagedStart();
// Subscribe to events
if (launchController != null)
{
launchController.OnAirplaneLaunched += HandleAirplaneLaunched;
}
if (targetValidator != null)
{
targetValidator.OnCorrectTargetHit += HandleCorrectTargetHit;
targetValidator.OnWrongTargetHit += HandleWrongTargetHit;
targetValidator.OnMissedAllTargets += HandleMissedTargets;
}
// Start the game
StartGame();
}
internal override void OnManagedDestroy()
{
base.OnManagedDestroy();
// Unsubscribe from events
if (launchController != null)
{
launchController.OnAirplaneLaunched -= HandleAirplaneLaunched;
}
if (targetValidator != null)
{
targetValidator.OnCorrectTargetHit -= HandleCorrectTargetHit;
targetValidator.OnWrongTargetHit -= HandleWrongTargetHit;
targetValidator.OnMissedAllTargets -= HandleMissedTargets;
}
if (_instance == this)
{
_instance = null;
}
}
#endregion
#region Validation
private void ValidateReferences()
{
if (personQueue == null)
{
Logging.Error("[AirplaneGameManager] PersonQueue not assigned!");
}
if (cameraManager == null)
{
Logging.Error("[AirplaneGameManager] AirplaneCameraManager not assigned!");
}
if (launchController == null)
{
Logging.Error("[AirplaneGameManager] AirplaneLaunchController not assigned!");
}
if (targetValidator == null)
{
Logging.Error("[AirplaneGameManager] AirplaneTargetValidator not assigned!");
}
if (spawnManager == null)
{
Logging.Error("[AirplaneGameManager] AirplaneSpawnManager not assigned!");
}
// Validate airplane selection system
if (selectionUI == null)
{
Logging.Warning("[AirplaneGameManager] ⚠️ SelectionUI not assigned! Player will not be able to choose airplane type.");
Logging.Warning("[AirplaneGameManager] → Assign AirplaneSelectionUI GameObject in Inspector under 'Airplane Type Selection'");
}
if (abilityButton == null)
{
Logging.Warning("[AirplaneGameManager] ⚠️ AbilityButton not assigned! Player will not be able to use abilities.");
Logging.Warning("[AirplaneGameManager] → Assign AirplaneAbilityButton GameObject in Inspector under 'Airplane Type Selection'");
}
}
#endregion
#region State Management
private void ChangeState(AirplaneGameState newState)
{
AirplaneGameState oldState = _currentState;
_currentState = newState;
if (showDebugLogs) Logging.Debug($"[AirplaneGameManager] State: {oldState} -> {newState}");
OnStateChanged?.Invoke(oldState, newState);
}
#endregion
#region Game Flow
/// <summary>
/// Start the game - begins with intro sequence
/// </summary>
public void StartGame()
{
if (showDebugLogs) Logging.Debug("[AirplaneGameManager] ===== GAME STARTING =====");
// Start with intro camera blend, THEN show selection UI
StartCoroutine(IntroSequence());
}
/// <summary>
/// Airplane selection sequence: show selection UI, wait for player choice
/// Called AFTER intro camera blend
/// </summary>
private IEnumerator AirplaneSelectionSequence()
{
ChangeState(AirplaneGameState.AirplaneSelection);
if (showDebugLogs) Logging.Debug("[AirplaneGameManager] === AIRPLANE SELECTION STARTING ===");
// Show selection UI
if (selectionUI != null)
{
if (showDebugLogs)
{
Logging.Debug($"[AirplaneGameManager] SelectionUI found! GameObject: {selectionUI.gameObject.name}, Active: {selectionUI.gameObject.activeSelf}");
}
selectionUI.Show();
if (showDebugLogs)
{
Logging.Debug($"[AirplaneGameManager] Called selectionUI.Show(). GameObject now active: {selectionUI.gameObject.activeSelf}");
}
// Wait for player to select and confirm
yield return new WaitUntil(() => selectionUI.HasSelectedType);
_selectedAirplaneType = selectionUI.GetSelectedType();
selectionUI.Hide();
if (showDebugLogs)
{
Logging.Debug($"[AirplaneGameManager] Selected airplane: {_selectedAirplaneType}");
}
}
else
{
Logging.Warning("[AirplaneGameManager] ⚠️ selectionUI is NULL! Cannot show selection UI. Check Inspector.");
Logging.Warning("[AirplaneGameManager] Using default airplane type from settings as fallback.");
// Fallback: use default type from settings
var settings = GameManager.GetSettingsObject<AppleHills.Core.Settings.IAirplaneSettings>();
if (settings != null)
{
_selectedAirplaneType = settings.DefaultAirplaneType;
if (showDebugLogs)
{
Logging.Debug($"[AirplaneGameManager] No selection UI, using default: {_selectedAirplaneType}");
}
}
else
{
_selectedAirplaneType = AirplaneAbilityType.Jet; // Ultimate fallback
}
}
// Continue with hellos after selection
yield return StartCoroutine(IntroHellosSequence());
}
/// <summary>
/// Intro sequence: blend to intro camera, THEN show airplane selection
/// </summary>
private IEnumerator IntroSequence()
{
ChangeState(AirplaneGameState.Intro);
if (showDebugLogs) Logging.Debug("[AirplaneGameManager] Playing intro sequence...");
// 1. Blend to intro camera
if (cameraManager != null)
{
cameraManager.SwitchToState(AirplaneCameraState.Intro);
yield return new WaitForSeconds(0.5f); // Camera blend time
}
if (showDebugLogs) Logging.Debug("[AirplaneGameManager] Intro camera ready. Now showing airplane selection...");
// 2. Show airplane selection UI and wait for player choice
yield return StartCoroutine(AirplaneSelectionSequence());
}
/// <summary>
/// Hellos sequence: all people greet, then blend to aiming camera
/// Called AFTER airplane selection is complete
/// </summary>
private IEnumerator IntroHellosSequence()
{
if (showDebugLogs) Logging.Debug("[AirplaneGameManager] Starting hellos sequence...");
// 1. Iterate over each person and allow them to say their hellos
if (personQueue != null && personQueue.HasMorePeople())
{
if (showDebugLogs) Logging.Debug("[AirplaneGameManager] Introducing all people...");
// Get all people from queue without removing them
var allPeople = personQueue.GetAllPeople();
foreach (var person in allPeople)
{
if (person != null)
{
// Wait for each person's greeting to complete
yield return StartCoroutine(person.OnHello());
}
}
if (showDebugLogs) Logging.Debug("[AirplaneGameManager] All introductions complete");
}
// 2. Blend to aiming camera (first person's turn will start)
if (cameraManager != null)
{
cameraManager.SwitchToState(AirplaneCameraState.Aiming);
yield return new WaitForSeconds(0.5f); // Camera blend time
}
if (showDebugLogs) Logging.Debug("[AirplaneGameManager] Intro complete");
// Move to first person's turn
StartCoroutine(SetupNextPerson());
}
/// <summary>
/// Setup the next person's turn
/// </summary>
private IEnumerator SetupNextPerson()
{
// Check if there are more people
if (personQueue == null || !personQueue.HasMorePeople())
{
if (showDebugLogs) Logging.Debug("[AirplaneGameManager] No more people, ending game");
StartCoroutine(GameOver());
yield break;
}
ChangeState(AirplaneGameState.NextPerson);
// If this is NOT the first turn, handle post-shot reaction
if (_currentPerson != null)
{
// Switch to next person camera for reaction/transition
if (cameraManager != null)
{
cameraManager.SwitchToState(AirplaneCameraState.NextPerson);
// Wait for camera blend to complete before cleanup and reaction
yield return new WaitForSeconds(0.5f); // Camera blend time
}
// NOW cleanup spawned objects after camera has blended (camera shows scene before cleanup)
if (spawnManager != null)
{
if (_lastShotHit)
{
// Success: Full cleanup - destroy all spawned objects and target
spawnManager.CleanupSpawnedObjects();
if (showDebugLogs)
{
Logging.Debug("[AirplaneGameManager] Cleaned up spawned objects after successful shot");
}
}
else
{
// Failure: Keep spawned objects for retry, just reset tracking state
spawnManager.ResetForRetry();
if (showDebugLogs)
{
Logging.Debug("[AirplaneGameManager] Kept spawned objects for retry after miss");
}
}
}
// Handle the previous person's reaction (celebrate/disappointment), removal (if hit), and shuffle
yield return StartCoroutine(personQueue.HandlePostShotReaction(_lastShotHit));
}
// Get the next person (now at front of queue after potential removal)
_previousPerson = _currentPerson;
_currentPerson = personQueue.PopNextPerson();
_totalTurns++;
if (_currentPerson == null)
{
Logging.Error("[AirplaneGameManager] Failed to get next person!");
yield break;
}
// Check if this is a NEW person (different from previous) or a retry (same person)
bool isNewPerson = _previousPerson != _currentPerson;
if (showDebugLogs)
{
string turnType = isNewPerson ? "NEW PERSON" : "RETRY";
Logging.Debug($"[AirplaneGameManager] === Turn {_totalTurns}: {_currentPerson.PersonName} ({turnType}) ===" +
$"\n Target: {_currentPerson.TargetName}");
}
OnPersonStartTurn?.Invoke(_currentPerson);
// Only introduce if this is a NEW person
if (isNewPerson && _previousPerson != null)
{
// Switching to a new person (after success) - they say hello
yield return StartCoroutine(personQueue.IntroduceNextPerson());
}
else if (_previousPerson == null)
{
// First turn - they already said hello during intro, just brief camera pause
if (cameraManager != null)
{
cameraManager.SwitchToState(AirplaneCameraState.NextPerson);
yield return new WaitForSeconds(0.5f);
}
}
// else: Same person retry (after failure) - skip introduction, go straight to aiming
// Initialize spawn manager for this person's target
if (spawnManager != null)
{
// Pass retry flag: true if same person, false if new person
bool isRetry = !isNewPerson;
spawnManager.InitializeForGame(_currentPerson.TargetName, isRetry);
}
// Queue done - continue game flow
if (targetValidator != null)
{
targetValidator.SetExpectedTarget(_currentPerson.TargetName);
}
// Enter aiming state
EnterAimingState();
}
/// <summary>
/// Enter aiming state - player can aim and launch
/// </summary>
private void EnterAimingState()
{
ChangeState(AirplaneGameState.Aiming);
if (showDebugLogs) Logging.Debug("[AirplaneGameManager] Ready to aim and launch!");
// Switch to aiming camera
if (cameraManager != null)
{
cameraManager.SwitchToState(AirplaneCameraState.Aiming);
}
// Spawn airplane at slingshot with selected type
if (launchController != null && _selectedAirplaneType != AirplaneAbilityType.None)
{
launchController.SetAirplaneType(_selectedAirplaneType);
if (showDebugLogs)
{
Logging.Debug($"[AirplaneGameManager] Spawned airplane at slingshot: {_selectedAirplaneType}");
}
}
// Show target UI
if (spawnManager != null)
{
spawnManager.ShowTargetUI();
}
// Enable launch controller
if (launchController != null)
{
launchController.Enable();
}
}
#endregion
#region Event Handlers
/// <summary>
/// Handle airplane launched event
/// </summary>
private void HandleAirplaneLaunched(AirplaneController airplane)
{
if (showDebugLogs) Logging.Debug("[AirplaneGameManager] Airplane launched!");
_currentAirplane = airplane;
// Disable launch controller
if (launchController != null)
{
launchController.Disable();
}
ChangeState(AirplaneGameState.Flying);
// Show ability button if airplane has an ability
if (abilityButton != null && airplane.CurrentAbility != null)
{
abilityButton.Setup(airplane, airplane.CurrentAbility);
if (showDebugLogs)
{
Logging.Debug($"[AirplaneGameManager] Ability button shown: {airplane.CurrentAbility.AbilityName}");
}
}
// Start following airplane with camera
if (cameraManager != null)
{
cameraManager.StartFollowingAirplane(airplane.transform);
}
// Start spawn manager tracking
if (spawnManager != null)
{
spawnManager.StartTracking(airplane.transform);
}
// Subscribe to airplane events
airplane.OnTargetHit += HandleAirplaneHitTarget;
airplane.OnLanded += HandleAirplaneLanded;
airplane.OnTimeout += HandleAirplaneTimeout;
}
/// <summary>
/// Handle airplane hitting a target
/// </summary>
private void HandleAirplaneHitTarget(AirplaneController airplane, string targetName)
{
if (showDebugLogs) Logging.Debug($"[AirplaneGameManager] Airplane hit target: {targetName}");
// Validate the hit
if (targetValidator != null)
{
targetValidator.ValidateHit(targetName);
}
}
/// <summary>
/// Handle airplane landing
/// </summary>
private void HandleAirplaneLanded(AirplaneController airplane)
{
if (showDebugLogs) Logging.Debug("[AirplaneGameManager] Airplane landed");
// If no target was hit, count as miss
if (targetValidator != null && !targetValidator.HasValidated)
{
targetValidator.HandleMiss();
}
// Evaluate result
StartCoroutine(EvaluateResult());
}
/// <summary>
/// Handle airplane timeout
/// </summary>
private void HandleAirplaneTimeout(AirplaneController airplane)
{
if (showDebugLogs) Logging.Debug("[AirplaneGameManager] Airplane timed out");
// Count as miss
if (targetValidator != null && !targetValidator.HasValidated)
{
targetValidator.HandleMiss();
}
// Evaluate result
StartCoroutine(EvaluateResult());
}
/// <summary>
/// Handle correct target hit
/// </summary>
private void HandleCorrectTargetHit(string targetName)
{
_lastShotHit = true;
_successCount++;
// Hide target UI immediately on successful hit
if (spawnManager != null)
{
spawnManager.HideTargetUI();
}
if (showDebugLogs) Logging.Debug($"[AirplaneGameManager] ✓ SUCCESS! Hit correct target: {targetName}");
}
/// <summary>
/// Handle wrong target hit
/// </summary>
private void HandleWrongTargetHit(string expectedTarget, string actualTarget)
{
_lastShotHit = false;
_failCount++;
if (showDebugLogs) Logging.Debug($"[AirplaneGameManager] ✗ FAIL! Expected: {expectedTarget}, Hit: {actualTarget}");
}
/// <summary>
/// Handle missed all targets
/// </summary>
private void HandleMissedTargets()
{
_lastShotHit = false;
_failCount++;
if (showDebugLogs) Logging.Debug("[AirplaneGameManager] ✗ MISS! Didn't hit any target");
}
#endregion
#region Evaluation and Cleanup
/// <summary>
/// Evaluate the result of the turn
/// </summary>
private IEnumerator EvaluateResult()
{
ChangeState(AirplaneGameState.Evaluating);
// Hide ability button
if (abilityButton != null)
{
abilityButton.Hide();
if (showDebugLogs)
{
Logging.Debug("[AirplaneGameManager] Ability button hidden");
}
}
// Stop following airplane
if (cameraManager != null)
{
cameraManager.StopFollowingAirplane();
}
// Stop spawn manager tracking
if (spawnManager != null)
{
spawnManager.StopTracking();
}
// Determine success/failure
bool success = targetValidator != null &&
targetValidator.HasValidated &&
_currentAirplane != null &&
!string.IsNullOrEmpty(_currentAirplane.LastHitTarget) &&
targetValidator.IsExpectedTarget(_currentAirplane.LastHitTarget);
if (showDebugLogs)
{
Logging.Debug($"[AirplaneGameManager] Turn result: {(success ? "SUCCESS" : "FAILURE")}" +
$"\n Score: {_successCount} / {_totalTurns}");
}
OnPersonFinishTurn?.Invoke(_currentPerson, success);
// Store success state for later use
_lastShotHit = success;
// Wait for evaluation display (stub)
yield return new WaitForSeconds(1f);
// Clean up airplane
if (_currentAirplane != null)
{
Destroy(_currentAirplane.gameObject);
_currentAirplane = null;
}
// Clear launch controller reference
if (launchController != null)
{
launchController.ClearActiveAirplane();
}
// NOTE: Spawned objects cleanup moved to SetupNextPerson() to happen AFTER camera blend
// This ensures camera shows the scene before cleanup and person reaction
// Move to next person
StartCoroutine(SetupNextPerson());
}
/// <summary>
/// Game over - no more people
/// </summary>
private IEnumerator GameOver()
{
ChangeState(AirplaneGameState.GameOver);
if (showDebugLogs)
{
Logging.Debug($"[AirplaneGameManager] ===== GAME OVER =====" +
$"\n Total Turns: {_totalTurns}" +
$"\n Success: {_successCount}" +
$"\n Failures: {_failCount}" +
$"\n Success Rate: {(_totalTurns > 0 ? (_successCount * 100f / _totalTurns) : 0):F1}%");
}
OnGameComplete?.Invoke();
// Stub: Show game over UI
yield return new WaitForSeconds(2f);
if (showDebugLogs) Logging.Debug("[AirplaneGameManager] Game complete");
}
#endregion
#region Public Query Methods
/// <summary>
/// Get current game statistics
/// </summary>
public (int total, int success, int fail) GetStatistics()
{
return (_totalTurns, _successCount, _failCount);
}
/// <summary>
/// Check if game is active
/// </summary>
public bool IsGameActive()
{
return _currentState != AirplaneGameState.Intro && _currentState != AirplaneGameState.GameOver;
}
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: fd2c6d27dee546479b16d0dfd8c3b2ee
timeCreated: 1764851399

View File

@@ -0,0 +1,244 @@
using System;
using AppleHills.Core.Settings;
using Common.Input;
using Core;
using Minigames.Airplane.Data;
using UnityEngine;
namespace Minigames.Airplane.Core
{
/// <summary>
/// Launch controller for the airplane minigame.
/// Extends DragLaunchController with airplane-specific behavior.
/// Spawns and launches airplanes on release.
/// </summary>
public class AirplaneLaunchController : DragLaunchController
{
#region Events
/// <summary>
/// Fired when airplane is launched. Parameters: (AirplaneController airplane)
/// </summary>
public event Action<AirplaneController> OnAirplaneLaunched;
#endregion
#region Settings
protected override SlingshotConfig GetSlingshotConfig()
{
return GameManager.GetSettingsObject<IAirplaneSettings>()?.SlingshotSettings;
}
protected override GameObject GetProjectilePrefab()
{
return airplanePrefab;
}
protected override float GetProjectileMass()
{
var settings = GameManager.GetSettingsObject<IAirplaneSettings>();
if (settings == null)
{
if (showDebugLogs)
Logging.Warning("[AirplaneLaunchController] AirplaneSettings not found!");
return 1f; // Default fallback
}
// Read from AirplaneSettings - same mass that AirplaneController uses
return settings.AirplaneMass;
}
#endregion
#region Inspector Properties
[Header("Airplane Setup")]
[Tooltip("Airplane prefab to spawn")]
[SerializeField] private GameObject airplanePrefab;
// Note: Trajectory preview is handled by base DragLaunchController class
// It will auto-find TrajectoryPreview component on this GameObject
#endregion
#region State
private AirplaneController _activeAirplane;
private AirplaneAbilityType _selectedAirplaneType;
public AirplaneController ActiveAirplane => _activeAirplane;
#endregion
#region Lifecycle
internal override void OnManagedAwake()
{
base.OnManagedAwake();
// Validate airplane prefab
if (airplanePrefab == null)
{
Logging.Error("[AirplaneLaunchController] Airplane prefab not assigned!");
}
else
{
// Verify airplane has AirplaneController
if (airplanePrefab.GetComponent<AirplaneController>() == null)
{
Logging.Error("[AirplaneLaunchController] Airplane prefab missing AirplaneController component!");
}
}
// Base class handles trajectory preview setup
}
#endregion
#region Override Methods
public override void Enable()
{
// Clear any trajectory from previous turn
if (trajectoryPreview != null)
{
trajectoryPreview.ForceHide();
}
base.Enable();
}
#endregion
#region Visual Feedback
// Base class handles trajectory preview via TrajectoryPreview component
// No custom visual feedback needed for airplane - using default implementation
#endregion
#region Airplane Type System
/// <summary>
/// Set the airplane type and spawn it at slingshot (before aiming).
/// </summary>
public void SetAirplaneType(Data.AirplaneAbilityType abilityType)
{
_selectedAirplaneType = abilityType;
SpawnAirplaneAtSlingshot();
}
/// <summary>
/// Spawn airplane at slingshot anchor (pre-launch).
/// </summary>
private void SpawnAirplaneAtSlingshot()
{
// Clear existing
if (_activeAirplane != null)
{
Destroy(_activeAirplane.gameObject);
_activeAirplane = null;
}
// Get settings and airplane config
var settings = GameManager.GetSettingsObject<AppleHills.Core.Settings.IAirplaneSettings>();
if (settings == null)
{
Logging.Error("[AirplaneLaunchController] Cannot spawn - settings not found!");
return;
}
var config = settings.GetAirplaneConfig(_selectedAirplaneType);
GameObject prefab = config.prefab ?? airplanePrefab;
if (prefab == null)
{
Logging.Error("[AirplaneLaunchController] No airplane prefab available!");
return;
}
// Instantiate at launch anchor
GameObject airplaneObj = Instantiate(prefab, launchAnchor.position, Quaternion.identity);
_activeAirplane = airplaneObj.GetComponent<AirplaneController>();
if (_activeAirplane == null)
{
Logging.Error("[AirplaneLaunchController] Spawned airplane missing AirplaneController!");
Destroy(airplaneObj);
return;
}
// Initialize with ability type
_activeAirplane.Initialize(_selectedAirplaneType);
// Set kinematic until launch
var rb = _activeAirplane.GetComponent<Rigidbody2D>();
if (rb != null)
{
rb.bodyType = RigidbodyType2D.Kinematic;
}
if (showDebugLogs)
{
Logging.Debug($"[AirplaneLaunchController] Spawned airplane at slingshot: {config.displayName}");
}
}
#endregion
#region Launch
protected override void PerformLaunch(Vector2 direction, float force)
{
if (_activeAirplane == null)
{
Logging.Error("[AirplaneLaunchController] No airplane to launch! Call SetAirplaneType first.");
return;
}
// Set dynamic before launch
var rb = _activeAirplane.GetComponent<Rigidbody2D>();
if (rb != null)
{
rb.bodyType = RigidbodyType2D.Dynamic;
}
// Launch the airplane
_activeAirplane.Launch(direction, force);
// Trajectory preview is automatically hidden by base class
if (showDebugLogs)
{
Logging.Debug($"[AirplaneLaunchController] Launched airplane with force {force:F2}, direction {direction}");
}
// Fire event
OnAirplaneLaunched?.Invoke(_activeAirplane);
}
#endregion
#region Public Methods
/// <summary>
/// Get reference to the currently active airplane (if any)
/// </summary>
public AirplaneController GetActiveAirplane()
{
return _activeAirplane;
}
/// <summary>
/// Clear reference to active airplane (called after airplane is destroyed)
/// </summary>
public void ClearActiveAirplane()
{
_activeAirplane = null;
}
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a819923cb68240d494bdcf6d5ecf6b9b
timeCreated: 1764851349

View File

@@ -0,0 +1,843 @@
using System;
using System.Collections.Generic;
using AppleHills.Core.Settings;
using Core;
using Core.Lifecycle;
using Minigames.Airplane.UI;
using UnityEngine;
using Random = UnityEngine.Random;
namespace Minigames.Airplane.Core
{
/// <summary>
/// Manages dynamic spawning of targets, positive/negative objects, and ground tiles
/// as the airplane moves through the level.
/// </summary>
public class AirplaneSpawnManager : ManagedBehaviour
{
#region Serialized Data Classes
[Serializable]
public class TargetPrefabEntry
{
[Tooltip("Unique key to identify this target")]
public string targetKey;
[Tooltip("Prefab to spawn for this target")]
public GameObject prefab;
}
#endregion
#region Inspector References
[Header("Prefab References")]
[Tooltip("Dictionary of target prefabs (key = target name)")]
[SerializeField] private TargetPrefabEntry[] targetPrefabs;
[Tooltip("Array of positive object prefabs")]
[SerializeField] private GameObject[] positiveObjectPrefabs;
[Tooltip("Array of negative object prefabs")]
[SerializeField] private GameObject[] negativeObjectPrefabs;
[Tooltip("Array of ground tile prefabs")]
[SerializeField] private GameObject[] groundTilePrefabs;
[Header("UI")]
[Tooltip("Target display UI component")]
[SerializeField] private TargetDisplayUI targetDisplayUI;
[Header("Launch Reference")]
[Tooltip("Launch controller (provides launch anchor position for distance calculation)")]
[SerializeField] private AirplaneLaunchController launchController;
[Header("Spawn Parents")]
[Tooltip("Parent transform for spawned objects (optional, for organization)")]
[SerializeField] private Transform spawnedObjectsParent;
[Tooltip("Parent transform for ground tiles (optional)")]
[SerializeField] private Transform groundTilesParent;
[Header("Ground Settings")]
[Tooltip("Y position at which to spawn ground tiles")]
[SerializeField] private float groundSpawnY = -18f;
[Header("Debug")]
[SerializeField] private bool showDebugLogs;
#endregion
#region State
// Target info
private string _currentTargetKey;
private float _targetDistance;
private Vector3 _targetSpawnPosition;
private Sprite _targetIconSprite;
private GameObject _spawnedTarget;
private GameObject _targetPrefabToSpawn;
private bool _hasSpawnedTarget;
// Plane tracking
private Transform _planeTransform;
private bool _isSpawningActive;
private bool _hasPassedThreshold;
// Spawning timers
private float _nextObjectSpawnTime;
private float _nextGroundSpawnX;
// Spawn statistics (for weighted ratio adjustment)
private int _positiveSpawnCount;
private int _negativeSpawnCount;
// Adaptive spawn distance (persistent across retries)
private float _furthestReachedX;
private bool _isRetryAttempt;
// Cached dictionaries
private Dictionary<string, GameObject> _targetPrefabDict;
private IAirplaneSettings _settings;
#endregion
#region Lifecycle
internal override void OnManagedAwake()
{
base.OnManagedAwake();
// Build target dictionary
BuildTargetDictionary();
// Get settings
_settings = GameManager.GetSettingsObject<IAirplaneSettings>();
// Validate references
ValidateReferences();
}
private void Update()
{
if (!_isSpawningActive || _planeTransform == null) return;
float planeX = _planeTransform.position.x;
// Track furthest X position reached
if (planeX > _furthestReachedX)
{
_furthestReachedX = planeX;
}
// Check if target should be spawned (when plane gets within spawn distance)
if (!_hasSpawnedTarget && _targetPrefabToSpawn != null)
{
float distanceToTarget = _targetSpawnPosition.x - planeX;
if (distanceToTarget <= _settings.SpawnDistanceAhead)
{
SpawnTarget();
_hasSpawnedTarget = true;
if (showDebugLogs)
{
Logging.Debug($"[SpawnManager] Target spawned at distance {distanceToTarget:F2} from plane");
}
}
}
// Check if plane has crossed threshold
if (!_hasPassedThreshold && planeX >= _settings.DynamicSpawnThreshold)
{
_hasPassedThreshold = true;
InitializeDynamicSpawning();
if (showDebugLogs)
{
Logging.Debug($"[SpawnManager] Plane crossed threshold at X={planeX:F2}");
}
}
// If past threshold, handle spawning (only if we're going further than before)
if (_hasPassedThreshold)
{
// Only spawn new content if plane is beyond previous furthest point (for retries)
bool shouldSpawnNewContent = !_isRetryAttempt || planeX > (_furthestReachedX - _settings.SpawnDistanceAhead);
if (shouldSpawnNewContent)
{
// Spawn objects at intervals
if (Time.time >= _nextObjectSpawnTime)
{
SpawnRandomObject();
ScheduleNextObjectSpawn();
}
// Spawn ground tiles ahead of plane
float groundSpawnTargetX = planeX + GetGroundSpawnAheadDistance();
while (_nextGroundSpawnX < groundSpawnTargetX)
{
SpawnGroundTile();
_nextGroundSpawnX += _settings.GroundSpawnInterval;
}
}
}
}
#endregion
#region Public API
/// <summary>
/// Initialize the spawn system for a new game.
/// Determines target spawn position and sets up UI, but doesn't spawn target yet.
/// Target will spawn when plane gets within spawn distance.
/// </summary>
/// <param name="targetKey">Key of the target to spawn</param>
/// <param name="isRetry">True if this is a retry attempt (keeps existing spawned objects and target position)</param>
public void InitializeForGame(string targetKey, bool isRetry = false)
{
_currentTargetKey = targetKey;
_isSpawningActive = false;
_hasPassedThreshold = false;
_isRetryAttempt = isRetry;
// Only reset target and spawn state if NOT a retry
if (!isRetry)
{
_hasSpawnedTarget = false;
_positiveSpawnCount = 0;
_negativeSpawnCount = 0;
_furthestReachedX = 0f;
// Determine NEW target spawn distance
_targetDistance = Random.Range((float)_settings.TargetMinDistance, (float)_settings.TargetMaxDistance);
_targetSpawnPosition = new Vector3(_targetDistance, 0f, 0f);
if (showDebugLogs)
{
Logging.Debug($"[SpawnManager] Initialized NEW turn for target '{targetKey}' at distance {_targetDistance:F2}");
}
}
else
{
// Retry: Keep existing target position and spawned objects
if (showDebugLogs)
{
Logging.Debug($"[SpawnManager] Initialized RETRY for target '{targetKey}' at distance {_targetDistance:F2}, furthest reached: {_furthestReachedX:F2}");
}
}
// Find target prefab and extract icon WITHOUT spawning
if (!_targetPrefabDict.TryGetValue(_currentTargetKey, out _targetPrefabToSpawn))
{
Logging.Error($"[SpawnManager] Target prefab not found for key '{_currentTargetKey}'!");
return;
}
// Extract icon from prefab (doesn't need to be instantiated)
ExtractTargetIconFromPrefab(_targetPrefabToSpawn);
// Setup target display UI (but don't show yet - will show when entering aiming state)
SetupTargetUI();
}
/// <summary>
/// Start tracking the airplane and enable spawning.
/// </summary>
/// <param name="planeTransform">Transform of the airplane</param>
public void StartTracking(Transform planeTransform)
{
_planeTransform = planeTransform;
_isSpawningActive = true;
// Initialize ground spawning position ahead of plane
_nextGroundSpawnX = _planeTransform.position.x + GetGroundSpawnAheadDistance();
// Start UI tracking with calculated target position
if (targetDisplayUI != null)
{
targetDisplayUI.StartTracking(planeTransform);
if (showDebugLogs)
{
Logging.Debug("[SpawnManager] UI tracking started, distance updates will show");
}
}
if (showDebugLogs)
{
Logging.Debug("[SpawnManager] Started tracking airplane");
}
}
/// <summary>
/// Stop spawning and tracking.
/// </summary>
public void StopTracking()
{
_isSpawningActive = false;
_planeTransform = null;
// Stop UI tracking
if (targetDisplayUI != null)
{
targetDisplayUI.StopTracking();
}
if (showDebugLogs)
{
Logging.Debug("[SpawnManager] Stopped tracking");
}
}
/// <summary>
/// Show the target display UI.
/// Call when entering aiming state.
/// </summary>
public void ShowTargetUI()
{
if (targetDisplayUI != null)
{
// Update distance and show UI (refreshes distance from launch point if plane not launched yet)
targetDisplayUI.UpdateAndShow();
if (showDebugLogs)
{
Logging.Debug("[SpawnManager] Target UI shown with updated distance");
}
}
}
/// <summary>
/// Hide the target display UI.
/// Call when target is successfully hit.
/// </summary>
public void HideTargetUI()
{
if (targetDisplayUI != null)
{
targetDisplayUI.Hide();
if (showDebugLogs)
{
Logging.Debug("[SpawnManager] Target UI hidden");
}
}
}
/// <summary>
/// Clean up all spawned objects (call on successful shot or game restart).
/// Destroys all spawned content including target, objects, and ground tiles.
/// </summary>
public void CleanupSpawnedObjects()
{
if (spawnedObjectsParent != null)
{
foreach (Transform child in spawnedObjectsParent)
{
Destroy(child.gameObject);
}
}
if (groundTilesParent != null)
{
foreach (Transform child in groundTilesParent)
{
Destroy(child.gameObject);
}
}
if (_spawnedTarget != null)
{
Destroy(_spawnedTarget);
_spawnedTarget = null;
}
// Reset all spawn state
_hasSpawnedTarget = false;
_hasPassedThreshold = false;
_furthestReachedX = 0f;
_positiveSpawnCount = 0;
_negativeSpawnCount = 0;
if (showDebugLogs)
{
Logging.Debug("[SpawnManager] Full cleanup completed (success or game restart)");
}
}
/// <summary>
/// Reset tracking state for retry attempt (keeps spawned objects).
/// Call this when player fails and will retry the same shot.
/// </summary>
public void ResetForRetry()
{
// Don't destroy anything - keep all spawned objects and target
// Just reset the tracking state so spawning can continue if plane goes further
if (showDebugLogs)
{
Logging.Debug($"[SpawnManager] Reset for retry (keeping spawned objects, furthest reached: {_furthestReachedX:F2})");
}
}
/// <summary>
/// Get target information for external use.
/// </summary>
public (Vector3 position, float distance, Sprite icon) GetTargetInfo()
{
return (_targetSpawnPosition, _targetDistance, _targetIconSprite);
}
#endregion
#region Initialization
/// <summary>
/// Build dictionary from serialized target prefab array.
/// </summary>
private void BuildTargetDictionary()
{
_targetPrefabDict = new Dictionary<string, GameObject>();
if (targetPrefabs == null || targetPrefabs.Length == 0)
{
Logging.Warning("[SpawnManager] No target prefabs assigned!");
return;
}
foreach (var entry in targetPrefabs)
{
if (string.IsNullOrEmpty(entry.targetKey))
{
Logging.Warning("[SpawnManager] Target entry has empty key!");
continue;
}
if (entry.prefab == null)
{
Logging.Warning($"[SpawnManager] Target entry '{entry.targetKey}' has no prefab assigned!");
continue;
}
if (_targetPrefabDict.ContainsKey(entry.targetKey))
{
Logging.Warning($"[SpawnManager] Duplicate target key '{entry.targetKey}'!");
continue;
}
_targetPrefabDict[entry.targetKey] = entry.prefab;
}
if (showDebugLogs)
{
Logging.Debug($"[SpawnManager] Built target dictionary with {_targetPrefabDict.Count} entries");
}
}
/// <summary>
/// Validate all required references.
/// </summary>
private void ValidateReferences()
{
if (_settings == null)
{
Logging.Error("[SpawnManager] Could not load IAirplaneSettings!");
}
if (positiveObjectPrefabs == null || positiveObjectPrefabs.Length == 0)
{
Logging.Warning("[SpawnManager] No positive object prefabs assigned!");
}
if (negativeObjectPrefabs == null || negativeObjectPrefabs.Length == 0)
{
Logging.Warning("[SpawnManager] No negative object prefabs assigned!");
}
if (groundTilePrefabs == null || groundTilePrefabs.Length == 0)
{
Logging.Warning("[SpawnManager] No ground tile prefabs assigned!");
}
if (targetDisplayUI == null)
{
Logging.Warning("[SpawnManager] Target display UI not assigned!");
}
if (launchController == null)
{
Logging.Warning("[SpawnManager] Launch controller not assigned! Distance calculation will use world origin.");
}
}
#endregion
#region Target Spawning
/// <summary>
/// Spawn the target at the predetermined position.
/// </summary>
private void SpawnTarget()
{
if (!_targetPrefabDict.TryGetValue(_currentTargetKey, out GameObject targetPrefab))
{
Logging.Error($"[SpawnManager] Target prefab not found for key '{_currentTargetKey}'!");
return;
}
// Spawn target at initial position
_spawnedTarget = Instantiate(targetPrefab, _targetSpawnPosition, Quaternion.identity);
if (spawnedObjectsParent != null)
{
_spawnedTarget.transform.SetParent(spawnedObjectsParent);
}
// Snap target to ground
SnapObjectToGround(_spawnedTarget, _targetSpawnPosition.x);
// Update target spawn position to actual snapped position
_targetSpawnPosition = _spawnedTarget.transform.position;
// Extract sprite for UI icon
ExtractTargetIcon(_spawnedTarget);
if (showDebugLogs)
{
Logging.Debug($"[SpawnManager] Spawned target '{_currentTargetKey}' at {_targetSpawnPosition}");
}
}
/// <summary>
/// Extract sprite from target prefab for UI display (without instantiation).
/// Finds first SpriteRenderer in prefab or children.
/// </summary>
private void ExtractTargetIconFromPrefab(GameObject prefab)
{
// Try to find SpriteRenderer in prefab or children
SpriteRenderer spriteRenderer = prefab.GetComponentInChildren<SpriteRenderer>();
if (spriteRenderer != null && spriteRenderer.sprite != null)
{
_targetIconSprite = spriteRenderer.sprite;
if (showDebugLogs)
{
Logging.Debug($"[SpawnManager] Extracted target icon from prefab: {_targetIconSprite.name}");
}
}
else
{
Logging.Warning($"[SpawnManager] Could not find SpriteRenderer in target prefab '{_currentTargetKey}'!");
}
}
/// <summary>
/// Extract sprite from target for UI display.
/// Finds first SpriteRenderer in target or children.
/// </summary>
private void ExtractTargetIcon(GameObject targetObject)
{
// Try to find SpriteRenderer in target or children
SpriteRenderer spriteRenderer = targetObject.GetComponentInChildren<SpriteRenderer>();
if (spriteRenderer != null && spriteRenderer.sprite != null)
{
_targetIconSprite = spriteRenderer.sprite;
if (showDebugLogs)
{
Logging.Debug($"[SpawnManager] Extracted target icon: {_targetIconSprite.name}");
}
}
else
{
Logging.Warning($"[SpawnManager] Could not find SpriteRenderer in target '{_currentTargetKey}'!");
}
}
/// <summary>
/// Setup the target display UI with icon and position.
/// </summary>
private void SetupTargetUI()
{
if (targetDisplayUI != null && _targetIconSprite != null)
{
// Get launch anchor from launch controller
Transform launchPoint = GetLaunchAnchor();
targetDisplayUI.Setup(_targetIconSprite, _targetSpawnPosition, launchPoint);
}
}
/// <summary>
/// Get launch anchor transform from the launch controller.
/// </summary>
private Transform GetLaunchAnchor()
{
return launchController != null ?
// Access the public launchAnchor field from DragLaunchController
launchController.GetLaunchAnchorTransform() : null;
}
#endregion
#region Dynamic Spawning
/// <summary>
/// Initialize dynamic spawning when threshold is crossed.
/// </summary>
private void InitializeDynamicSpawning()
{
ScheduleNextObjectSpawn();
if (showDebugLogs)
{
Logging.Debug("[SpawnManager] Dynamic spawning initialized");
}
}
/// <summary>
/// Get the distance ahead to spawn ground (2x object spawn distance).
/// </summary>
private float GetGroundSpawnAheadDistance()
{
return _settings.SpawnDistanceAhead * 2f;
}
/// <summary>
/// Schedule the next object spawn based on random interval.
/// </summary>
private void ScheduleNextObjectSpawn()
{
float interval = Random.Range((float)_settings.ObjectSpawnMinInterval, (float)_settings.ObjectSpawnMaxInterval);
_nextObjectSpawnTime = Time.time + interval;
}
/// <summary>
/// Spawn a random positive or negative object.
/// Uses weighted randomness to maintain target ratio.
/// Avoids spawning near target position to prevent obscuring it.
/// </summary>
private void SpawnRandomObject()
{
if (_planeTransform == null) return;
// Calculate spawn X position ahead of plane
float spawnX = _planeTransform.position.x + _settings.SpawnDistanceAhead;
// Check if spawn position is too close to target (avoid obscuring it)
float distanceToTarget = Mathf.Abs(spawnX - _targetSpawnPosition.x);
float targetClearanceZone = 10f; // Don't spawn within 10 units of target
if (distanceToTarget < targetClearanceZone)
{
// Too close to target, skip this spawn
if (showDebugLogs)
{
Logging.Debug($"[SpawnManager] Skipped object spawn at X={spawnX:F2} (too close to target at X={_targetSpawnPosition.x:F2})");
}
return;
}
// Determine if spawning positive or negative based on weighted ratio
bool spawnPositive = ShouldSpawnPositive();
GameObject prefabToSpawn = null;
if (spawnPositive)
{
if (positiveObjectPrefabs != null && positiveObjectPrefabs.Length > 0)
{
prefabToSpawn = positiveObjectPrefabs[UnityEngine.Random.Range(0, positiveObjectPrefabs.Length)];
_positiveSpawnCount++;
}
}
else
{
if (negativeObjectPrefabs != null && negativeObjectPrefabs.Length > 0)
{
prefabToSpawn = negativeObjectPrefabs[UnityEngine.Random.Range(0, negativeObjectPrefabs.Length)];
_negativeSpawnCount++;
}
}
if (prefabToSpawn == null) return;
// Spawn object at temporary position
Vector3 tempPosition = new Vector3(spawnX, 0f, 0f);
GameObject spawnedObject = Instantiate(prefabToSpawn, tempPosition, Quaternion.identity);
if (spawnedObjectsParent != null)
{
spawnedObject.transform.SetParent(spawnedObjectsParent);
}
// Snap to ground
SnapObjectToGround(spawnedObject, spawnX);
if (showDebugLogs)
{
Logging.Debug($"[SpawnManager] Spawned {(spawnPositive ? "positive" : "negative")} object at {spawnedObject.transform.position}");
}
}
/// <summary>
/// Determine if next spawn should be positive based on weighted ratio.
/// Adjusts to maintain target positive/negative ratio.
/// </summary>
private bool ShouldSpawnPositive()
{
int totalSpawned = _positiveSpawnCount + _negativeSpawnCount;
// First few spawns - use pure random based on ratio
if (totalSpawned < 5)
{
return UnityEngine.Random.value <= _settings.PositiveNegativeRatio;
}
// Calculate current ratio
float currentRatio = totalSpawned > 0 ? (float)_positiveSpawnCount / totalSpawned : 0.5f;
float targetRatio = _settings.PositiveNegativeRatio;
// If we're below target ratio, heavily favor positive
// If we're above target ratio, heavily favor negative
float adjustedProbability;
if (currentRatio < targetRatio)
{
// Need more positive - increase probability
adjustedProbability = Mathf.Lerp(targetRatio, 1f, (targetRatio - currentRatio) * 2f);
}
else
{
// Need more negative - decrease probability
adjustedProbability = Mathf.Lerp(0f, targetRatio, 1f - (currentRatio - targetRatio) * 2f);
}
return UnityEngine.Random.value <= adjustedProbability;
}
/// <summary>
/// Spawn a ground tile at the next ground spawn position.
/// </summary>
private void SpawnGroundTile()
{
if (groundTilePrefabs == null || groundTilePrefabs.Length == 0) return;
// Pick random ground tile
GameObject tilePrefab = groundTilePrefabs[Random.Range(0, groundTilePrefabs.Length)];
// Calculate spawn position using configured Y
Vector3 spawnPosition = new Vector3(_nextGroundSpawnX, groundSpawnY, 0f);
// Spawn tile
GameObject spawnedTile = Instantiate(tilePrefab, spawnPosition, Quaternion.identity);
if (groundTilesParent != null)
{
spawnedTile.transform.SetParent(groundTilesParent);
}
if (showDebugLogs)
{
Logging.Debug($"[SpawnManager] Spawned ground tile at ({_nextGroundSpawnX:F2}, {groundSpawnY:F2})");
}
}
#endregion
#region Ground Snapping
/// <summary>
/// Snap an object to the ground using raycast.
/// Positions object so its bottom bounds touch the ground.
/// </summary>
/// <param name="obj">Object to snap to ground</param>
/// <param name="xPosition">X position to raycast from</param>
private void SnapObjectToGround(GameObject obj, float xPosition)
{
if (obj == null) return;
// Start raycast from high Y position
Vector2 rayOrigin = new Vector2(xPosition, 0.0f);
// Raycast downward to find ground (convert layer to layer mask)
int layerMask = 1 << _settings.GroundLayer;
RaycastHit2D hit = Physics2D.Raycast(
rayOrigin,
Vector2.down,
_settings.MaxGroundRaycastDistance,
layerMask
);
float targetY;
if (hit.collider != null)
{
// Found ground - calculate Y position
float groundY = hit.point.y;
// Get object bounds
Bounds bounds = GetObjectBounds(obj);
float boundsBottomOffset = bounds.extents.y; // Half height
// Position object so bottom touches ground
targetY = groundY + boundsBottomOffset;
if (showDebugLogs)
{
Logging.Debug($"[SpawnManager] Snapped object to ground at Y={targetY:F2} (ground at {groundY:F2})");
}
}
else
{
// No ground found - use default offset
targetY = _settings.DefaultObjectYOffset;
Logging.Warning($"[SpawnManager] No ground found at X={xPosition}, using default Y={targetY}");
}
// Apply position
Vector3 newPosition = obj.transform.position;
newPosition.y = targetY;
obj.transform.position = newPosition;
}
/// <summary>
/// Get the bounds of an object from its Renderer or Collider.
/// </summary>
private Bounds GetObjectBounds(GameObject obj)
{
// Try Renderer first
Renderer objRenderer = obj.GetComponentInChildren<Renderer>();
if (objRenderer != null)
{
return objRenderer.bounds;
}
// Try Collider2D
Collider2D objCollider2D = obj.GetComponentInChildren<Collider2D>();
if (objCollider2D != null)
{
return objCollider2D.bounds;
}
// Try Collider3D
Collider objCollider3D = obj.GetComponentInChildren<Collider>();
if (objCollider3D != null)
{
return objCollider3D.bounds;
}
// Fallback - create minimal bounds
Logging.Warning($"[SpawnManager] No Renderer or Collider found on {obj.name}, using default bounds");
return new Bounds(obj.transform.position, Vector3.one);
}
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 70f14ee4b04b46b793ec2652fd2ca7b9
timeCreated: 1764943526

View File

@@ -0,0 +1,186 @@
using System;
using Core;
using Core.Lifecycle;
using UnityEngine;
namespace Minigames.Airplane.Core
{
/// <summary>
/// Validates whether the airplane hit the correct target.
/// Singleton for easy access throughout the minigame.
/// </summary>
public class AirplaneTargetValidator : ManagedBehaviour
{
#region Singleton
private static AirplaneTargetValidator _instance;
public static AirplaneTargetValidator Instance => _instance;
#endregion
#region Events
/// <summary>
/// Fired when correct target is hit. Parameters: (string targetName)
/// </summary>
public event Action<string> OnCorrectTargetHit;
/// <summary>
/// Fired when wrong target is hit. Parameters: (string expectedTarget, string actualTarget)
/// </summary>
public event Action<string, string> OnWrongTargetHit;
/// <summary>
/// Fired when no target is hit
/// </summary>
public event Action OnMissedAllTargets;
#endregion
#region State
private string _expectedTargetName = null;
private bool _hasValidatedCurrentShot = false;
public string ExpectedTargetName => _expectedTargetName;
#endregion
#region Configuration
[Header("Debug")]
[SerializeField] private bool showDebugLogs = false;
#endregion
#region Lifecycle
internal override void OnManagedAwake()
{
base.OnManagedAwake();
// Set singleton
if (_instance != null && _instance != this)
{
Logging.Warning("[AirplaneTargetValidator] Multiple instances detected! Destroying duplicate.");
Destroy(gameObject);
return;
}
_instance = this;
}
internal override void OnManagedDestroy()
{
base.OnManagedDestroy();
if (_instance == this)
{
_instance = null;
}
}
#endregion
#region Target Setting
/// <summary>
/// Set the expected target for the current shot
/// </summary>
public void SetExpectedTarget(string targetName)
{
_expectedTargetName = targetName;
_hasValidatedCurrentShot = false;
if (showDebugLogs) Logging.Debug($"[AirplaneTargetValidator] Expected target set to: {targetName}");
}
/// <summary>
/// Clear the expected target
/// </summary>
public void ClearExpectedTarget()
{
_expectedTargetName = null;
_hasValidatedCurrentShot = false;
if (showDebugLogs) Logging.Debug("[AirplaneTargetValidator] Expected target cleared");
}
#endregion
#region Validation
/// <summary>
/// Validate if the hit target matches the expected target
/// </summary>
public bool ValidateHit(string hitTargetName)
{
// Prevent multiple validations for the same shot
if (_hasValidatedCurrentShot)
{
if (showDebugLogs) Logging.Debug("[AirplaneTargetValidator] Already validated this shot");
return false;
}
_hasValidatedCurrentShot = true;
if (string.IsNullOrEmpty(_expectedTargetName))
{
Logging.Warning("[AirplaneTargetValidator] No expected target set!");
return false;
}
bool isCorrect = string.Equals(hitTargetName, _expectedTargetName, StringComparison.OrdinalIgnoreCase);
if (isCorrect)
{
if (showDebugLogs) Logging.Debug($"[AirplaneTargetValidator] ✓ Correct! Hit target: {hitTargetName}");
OnCorrectTargetHit?.Invoke(hitTargetName);
}
else
{
if (showDebugLogs) Logging.Debug($"[AirplaneTargetValidator] ✗ Wrong! Expected: {_expectedTargetName}, Hit: {hitTargetName}");
OnWrongTargetHit?.Invoke(_expectedTargetName, hitTargetName);
}
return isCorrect;
}
/// <summary>
/// Handle case where airplane didn't hit any target
/// </summary>
public void HandleMiss()
{
// Prevent multiple validations for the same shot
if (_hasValidatedCurrentShot)
{
return;
}
_hasValidatedCurrentShot = true;
if (showDebugLogs) Logging.Debug($"[AirplaneTargetValidator] ✗ Missed! Expected target: {_expectedTargetName}");
OnMissedAllTargets?.Invoke();
}
#endregion
#region Query Methods
/// <summary>
/// Check if a target name matches the expected target
/// </summary>
public bool IsExpectedTarget(string targetName)
{
return string.Equals(targetName, _expectedTargetName, StringComparison.OrdinalIgnoreCase);
}
/// <summary>
/// Check if validation has been done for current shot
/// </summary>
public bool HasValidated => _hasValidatedCurrentShot;
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3cf7815b220240e090fb5cba4fc7414f
timeCreated: 1764851309

View File

@@ -0,0 +1,184 @@
using System.Collections;
using Core;
using Core.Lifecycle;
using TMPro;
using UnityEngine;
namespace Minigames.Airplane.Core
{
/// <summary>
/// Represents a person participating in the airplane minigame.
/// Holds data (name, target) and provides awaitable callbacks for game events.
/// </summary>
public class Person : ManagedBehaviour
{
#region Inspector Data
[Header("Person Data")]
[Tooltip("Name of this person")]
[SerializeField] private string personName = "Unknown";
[Tooltip("Target name they need to hit")]
[SerializeField] private string targetName = "Unknown";
[Header("Visual (Placeholder)")]
[Tooltip("TextMeshPro text for debug/placeholder animations")]
[SerializeField] private TextMeshPro debugText;
[Header("Debug")]
[SerializeField] private bool showDebugLogs = false;
#endregion
#region Properties
public string PersonName => personName;
public string TargetName => targetName;
public int TurnNumber { get; set; }
public Transform PersonTransform => transform;
#endregion
#region Internal
// Tracks the currently running debug hide coroutine so we can cancel overlaps.
private Coroutine _activeDebugCoroutine;
#endregion
#region Event Callbacks (Awaitable via Coroutines)
/// <summary>
/// Called when this person is first shown (game start or their turn).
/// Awaitable - game flow waits for this to complete.
/// </summary>
public IEnumerator OnHello()
{
if (showDebugLogs)
Logging.Debug($"[Person] {personName}: Hello! I need to hit {targetName}!");
// Show debug text with hello message
yield return PrintDebugText($"Hello! I need to hit {targetName}!");
if (showDebugLogs)
Logging.Debug($"[Person] {personName}: Ready to aim!");
}
/// <summary>
/// Called when this person successfully hit their target.
/// Awaitable - game flow waits for celebration to complete.
/// </summary>
public IEnumerator OnTargetHit()
{
if (showDebugLogs)
Logging.Debug($"[Person] {personName}: Yes! I hit {targetName}!");
// Show debug text with hit message
yield return PrintDebugText($"Yay — hit {targetName}!");
if (showDebugLogs)
Logging.Debug($"[Person] {personName}: That was awesome!");
}
/// <summary>
/// Called when this person missed their target.
/// Awaitable - game flow waits for reaction to complete.
/// </summary>
public IEnumerator OnTargetMissed()
{
if (showDebugLogs)
Logging.Debug($"[Person] {personName}: Oh no, I missed {targetName}...");
// Show debug text with miss message
yield return PrintDebugText($"Missed {targetName}...");
if (showDebugLogs)
Logging.Debug($"[Person] {personName}: I'll try better next time.");
}
/// <summary>
/// Shows debug text, waits, then hides it. Cancels any previous debug display.
/// Awaitable so callers can yield return this coroutine.
/// </summary>
public IEnumerator PrintDebugText(string inputText, float duration = 0.5f)
{
if (debugText != null)
{
// Cancel any active hide coroutine to avoid overlap
if (_activeDebugCoroutine != null)
{
StopCoroutine(_activeDebugCoroutine);
_activeDebugCoroutine = null;
}
debugText.text = inputText;
debugText.gameObject.SetActive(true);
// Start a coroutine to hide after delay and yield it so this method is awaitable
_activeDebugCoroutine = StartCoroutine(HideAfterDelay(duration));
yield return _activeDebugCoroutine;
_activeDebugCoroutine = null;
}
else
{
// No visual, still allow callers to wait the same duration
yield return new WaitForSeconds(duration);
}
}
private IEnumerator HideAfterDelay(float duration)
{
yield return new WaitForSeconds(duration);
if (debugText != null)
{
debugText.gameObject.SetActive(false);
}
}
#endregion
#region Validation
internal override void OnManagedAwake()
{
base.OnManagedAwake();
// Hide debug text on start
if (debugText != null)
{
debugText.gameObject.SetActive(false);
}
if (string.IsNullOrEmpty(personName))
{
Logging.Warning($"[Person] Person on {gameObject.name} has no name assigned!");
}
if (string.IsNullOrEmpty(targetName))
{
Logging.Warning($"[Person] Person '{personName}' has no target assigned!");
}
}
#endregion
#region Editor Helpers
#if UNITY_EDITOR
private void OnValidate()
{
// Auto-set person name from GameObject name if empty
if (string.IsNullOrEmpty(personName) && gameObject != null)
{
personName = gameObject.name;
}
}
#endif
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: dcd6c4e7afe141399878a768cf6bfa24
timeCreated: 1764938205

View File

@@ -0,0 +1,352 @@
using System.Collections;
using System.Collections.Generic;
using Core;
using Core.Lifecycle;
using UnityEngine;
namespace Minigames.Airplane.Core
{
/// <summary>
/// Manages the queue of people waiting to launch airplanes.
/// Controls person transitions, reactions, and shuffle animations.
/// Provides awaitable coroutines for game flow integration.
/// </summary>
public class PersonQueue : ManagedBehaviour
{
#region Inspector Properties
[Header("Person Setup")]
[Tooltip("List of people in the queue (order matters - index 0 goes first)")]
[SerializeField] private List<Person> peopleInQueue = new List<Person>();
[Header("Shuffle Settings")]
[Tooltip("Duration of shuffle transition between people")]
[SerializeField] private float shuffleDuration = 0.5f;
[Tooltip("Distance to move people during shuffle")]
[SerializeField] private float shuffleDistance = 2f;
[Header("Debug")]
[SerializeField] private bool showDebugLogs = false;
#endregion
#region State
private int _currentTurnNumber = 1;
private int _initialPeopleCount;
public int TotalPeople => _initialPeopleCount;
public int RemainingPeople => peopleInQueue.Count;
#endregion
#region Lifecycle
internal override void OnManagedAwake()
{
base.OnManagedAwake();
_initialPeopleCount = peopleInQueue.Count;
ValidateQueue();
}
internal override void OnManagedStart()
{
base.OnManagedStart();
if (showDebugLogs)
{
Logging.Debug($"[PersonQueue] Initialized with {TotalPeople} people");
foreach (var person in peopleInQueue)
{
Logging.Debug($" - {person.PersonName} -> Target: {person.TargetName}");
}
}
}
#endregion
#region Validation
/// <summary>
/// Validate the queue setup
/// </summary>
private void ValidateQueue()
{
if (peopleInQueue.Count == 0)
{
Logging.Warning("[PersonQueue] No people in queue! Add Person components in the inspector.");
return;
}
// Check for null references and validate data
for (int i = 0; i < peopleInQueue.Count; i++)
{
var person = peopleInQueue[i];
if (person == null)
{
Logging.Error($"[PersonQueue] Person at index {i} is null!");
continue;
}
if (string.IsNullOrEmpty(person.PersonName))
{
Logging.Warning($"[PersonQueue] Person at index {i} has no name!");
}
if (string.IsNullOrEmpty(person.TargetName))
{
Logging.Warning($"[PersonQueue] Person '{person.PersonName}' at index {i} has no target assigned!");
}
}
}
#endregion
#region Queue Management
/// <summary>
/// Check if there are more people in the queue
/// </summary>
public bool HasMorePeople()
{
return peopleInQueue.Count > 0;
}
/// <summary>
/// Get the next person without removing them from the queue
/// </summary>
public Person PeekNextPerson()
{
if (peopleInQueue.Count == 0)
{
if (showDebugLogs) Logging.Debug("[PersonQueue] Queue is empty!");
return null;
}
return peopleInQueue[0];
}
/// <summary>
/// Pop the next person from the queue (does not remove until after their turn)
/// </summary>
public Person PopNextPerson()
{
if (peopleInQueue.Count == 0)
{
if (showDebugLogs) Logging.Debug("[PersonQueue] Queue is empty!");
return null;
}
// Get first person (don't remove yet - happens after their turn)
Person nextPerson = peopleInQueue[0];
// Assign turn number
nextPerson.TurnNumber = _currentTurnNumber;
_currentTurnNumber++;
if (showDebugLogs)
{
Logging.Debug($"[PersonQueue] Next person: {nextPerson.PersonName} (Turn {nextPerson.TurnNumber}), " +
$"Remaining: {RemainingPeople}");
}
return nextPerson;
}
/// <summary>
/// Get all people in the queue (for intro sequence). Returns a copy of the list.
/// </summary>
public List<Person> GetAllPeople()
{
return new List<Person>(peopleInQueue);
}
/// <summary>
/// Remove the current person from the queue after their turn.
/// Destroys the person's GameObject.
/// </summary>
public void RemoveCurrentPerson()
{
if (peopleInQueue.Count == 0) return;
Person removedPerson = peopleInQueue[0];
peopleInQueue.RemoveAt(0);
if (showDebugLogs)
{
Logging.Debug($"[PersonQueue] Removed {removedPerson.PersonName} from queue. " +
$"Remaining: {RemainingPeople}");
}
// Destroy the person's GameObject
if (removedPerson != null && removedPerson.gameObject != null)
{
Destroy(removedPerson.gameObject);
if (showDebugLogs)
{
Logging.Debug($"[PersonQueue] Destroyed GameObject for {removedPerson.PersonName}");
}
}
}
#endregion
#region Transition Control
/// <summary>
/// Show first person at game start.
/// Awaitable - game flow waits for introduction to complete.
/// </summary>
public IEnumerator ShowFirstPerson(Person person)
{
if (showDebugLogs) Logging.Debug($"[PersonQueue] Showing first person: {person.PersonName}");
// Call person's hello sequence
yield return person.OnHello();
if (showDebugLogs) Logging.Debug("[PersonQueue] First person introduction complete");
}
/// <summary>
/// Handle post-shot reaction for current person (who just shot).
/// If successful: celebrate, remove from queue, shuffle remaining people.
/// If failed: show disappointment, stay in queue.
/// Awaitable - game flow waits for reactions and animations to complete.
/// </summary>
public IEnumerator HandlePostShotReaction(bool targetHit)
{
if (peopleInQueue.Count == 0)
{
Logging.Warning("[PersonQueue] HandlePostShotReaction called but queue is empty!");
yield break;
}
// Person at index 0 is the one who just shot
Person currentPerson = peopleInQueue[0];
if (showDebugLogs)
Logging.Debug($"[PersonQueue] Post-shot reaction for {currentPerson.PersonName} (Hit: {targetHit})");
// Call person's reaction based on result
if (targetHit)
{
// Success reaction
yield return StartCoroutine(currentPerson.OnTargetHit());
if (showDebugLogs) Logging.Debug("[PersonQueue] Success! Removing person and shuffling queue...");
// Remember the first person's position BEFORE removing them
Vector3 firstPersonPosition = currentPerson.PersonTransform.position;
// Remove successful person from queue (they're no longer in peopleInQueue)
RemoveCurrentPerson();
// Shuffle remaining people forward to fill the first person's spot
yield return StartCoroutine(ShuffleToPosition(firstPersonPosition));
}
else
{
// Failure reaction
yield return StartCoroutine(currentPerson.OnTargetMissed());
if (showDebugLogs) Logging.Debug("[PersonQueue] Failed - person stays in queue");
// On failure, don't remove or shuffle, person gets another turn
}
if (showDebugLogs) Logging.Debug("[PersonQueue] Post-shot reaction complete");
}
/// <summary>
/// Introduce the next person (at front of queue) for their turn.
/// Awaitable - game flow waits for introduction to complete.
/// </summary>
public IEnumerator IntroduceNextPerson()
{
if (peopleInQueue.Count == 0)
{
Logging.Warning("[PersonQueue] IntroduceNextPerson called but queue is empty!");
yield break;
}
Person nextPerson = peopleInQueue[0];
if (showDebugLogs) Logging.Debug($"[PersonQueue] Introducing next person: {nextPerson.PersonName}");
// Call person's hello sequence
yield return StartCoroutine(nextPerson.OnHello());
if (showDebugLogs) Logging.Debug("[PersonQueue] Introduction complete");
}
/// <summary>
/// Shuffle remaining people forward to fill the first person's spot.
/// The next person (now at index 0) moves to the first person's position.
/// All other people move forward proportionally.
/// Only tweens X position to prevent characters with foot pivots from floating.
/// </summary>
private IEnumerator ShuffleToPosition(Vector3 firstPersonPosition)
{
if (peopleInQueue.Count == 0)
{
yield break; // No one left to shuffle
}
if (showDebugLogs) Logging.Debug($"[PersonQueue] Shuffling {peopleInQueue.Count} people forward to first position");
// Store starting X positions and calculate target X positions
List<float> startXPositions = new List<float>();
List<float> targetXPositions = new List<float>();
for (int i = 0; i < peopleInQueue.Count; i++)
{
Person person = peopleInQueue[i];
startXPositions.Add(person.PersonTransform.position.x);
if (i == 0)
{
// Next person (index 0) moves to first person's X position
targetXPositions.Add(firstPersonPosition.x);
}
else
{
// Everyone else moves to the X position of the person ahead of them
targetXPositions.Add(peopleInQueue[i - 1].PersonTransform.position.x);
}
}
// Animate shuffle (only X axis)
float elapsed = 0f;
while (elapsed < shuffleDuration)
{
elapsed += Time.deltaTime;
float t = elapsed / shuffleDuration;
// Smoothly lerp each person's X position only (preserve Y and Z)
for (int i = 0; i < peopleInQueue.Count; i++)
{
float newX = Mathf.Lerp(startXPositions[i], targetXPositions[i], t);
Vector3 currentPos = peopleInQueue[i].PersonTransform.position;
peopleInQueue[i].PersonTransform.position = new Vector3(newX, currentPos.y, currentPos.z);
}
yield return null;
}
// Ensure final X positions are exact (preserve Y and Z)
for (int i = 0; i < peopleInQueue.Count; i++)
{
Vector3 currentPos = peopleInQueue[i].PersonTransform.position;
peopleInQueue[i].PersonTransform.position = new Vector3(targetXPositions[i], currentPos.y, currentPos.z);
}
if (showDebugLogs) Logging.Debug("[PersonQueue] Shuffle complete");
}
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 77964ec3bd5848a6b947ed4ac9b0ee3f
timeCreated: 1764851326

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4d58653664484f58be14ab8089e22ce3
timeCreated: 1764851234

View File

@@ -0,0 +1,108 @@
using UnityEngine;
namespace Minigames.Airplane.Data
{
/// <summary>
/// Configuration for Jet Plane ability.
/// </summary>
[System.Serializable]
public class JetAbilityConfig
{
[Header("Jet Ability")]
[Tooltip("Display name")]
public string abilityName = "Jet Boost";
[Tooltip("Icon for ability button")]
public Sprite abilityIcon;
[Tooltip("Cooldown duration in seconds")]
public float cooldownDuration = 5f;
[Tooltip("Speed while ability is active")]
public float jetSpeed = 15f;
[Tooltip("Direction angle (0 = right, 90 = up)")]
public float jetAngle = 0f;
}
/// <summary>
/// Configuration for Bobbing Plane ability.
/// </summary>
[System.Serializable]
public class BobbingAbilityConfig
{
[Header("Bobbing Ability")]
[Tooltip("Display name")]
public string abilityName = "Air Hop";
[Tooltip("Icon for ability button")]
public Sprite abilityIcon;
[Tooltip("Cooldown duration in seconds")]
public float cooldownDuration = 3f;
[Tooltip("Force applied on activation (X = forward, Y = upward)")]
public Vector2 bobForce = new Vector2(7f, 10f);
}
/// <summary>
/// Configuration for Drop Plane ability.
/// </summary>
[System.Serializable]
public class DropAbilityConfig
{
[Header("Drop Ability")]
[Tooltip("Display name")]
public string abilityName = "Dive Bomb";
[Tooltip("Icon for ability button")]
public Sprite abilityIcon;
[Tooltip("Cooldown duration in seconds")]
public float cooldownDuration = 4f;
[Tooltip("Downward force applied")]
public float dropForce = 20f;
[Tooltip("Distance to drop before returning to normal flight")]
public float dropDistance = 5f;
[Tooltip("Should horizontal velocity be zeroed during drop?")]
public bool zeroHorizontalVelocity = true;
}
/// <summary>
/// Configuration for an airplane type with visual and physics properties.
/// </summary>
[System.Serializable]
public class AirplaneTypeConfig
{
[Header("Identity")]
[Tooltip("Display name for UI")]
public string displayName = "Airplane";
[Tooltip("Airplane prefab")]
public GameObject prefab;
[Tooltip("Preview sprite for selection UI")]
public Sprite previewSprite;
[Header("Ability")]
[Tooltip("Which ability this airplane uses")]
public AirplaneAbilityType abilityType = AirplaneAbilityType.Jet;
[Header("Physics Overrides (Optional)")]
[Tooltip("Override default mass")]
public bool overrideMass;
public float mass = 1f;
[Tooltip("Override default gravity scale")]
public bool overrideGravityScale;
public float gravityScale = 1f;
[Tooltip("Override default drag")]
public bool overrideDrag;
public float drag = 0f;
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 57bed242caa44ef5bbcd33348d5c908f
timeCreated: 1764977731

View File

@@ -0,0 +1,14 @@
namespace Minigames.Airplane.Data
{
/// <summary>
/// Types of special abilities available for airplanes.
/// </summary>
public enum AirplaneAbilityType
{
None,
Jet, // Hold to fly straight without gravity
Bobbing, // Tap to jump upward, reduces speed
Drop // Swipe down to drop straight down
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 944943da845c403b8b43aeab3c9ef696
timeCreated: 1764975919

View File

@@ -0,0 +1,14 @@
namespace Minigames.Airplane.Data
{
/// <summary>
/// Camera states for the airplane minigame
/// </summary>
public enum AirplaneCameraState
{
Intro, // Intro sequence camera
NextPerson, // Camera focusing on the next person
Aiming, // Camera for aiming the airplane
Flight // Camera following the airplane in flight
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f5b6a3623e7040be9dfeac6ee8e195cf
timeCreated: 1764851235

View File

@@ -0,0 +1,17 @@
namespace Minigames.Airplane.Data
{
/// <summary>
/// Game states for the airplane minigame
/// </summary>
public enum AirplaneGameState
{
AirplaneSelection, // Player selecting airplane type
Intro, // Intro sequence
NextPerson, // Introducing the next person
Aiming, // Player is aiming the airplane
Flying, // Airplane is in flight
Evaluating, // Evaluating the result of the flight
GameOver // All people have had their turn
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 59636bd1dbca4575b431820510da201f
timeCreated: 1764851235

View File

@@ -0,0 +1,52 @@
using UnityEngine;
namespace Minigames.Airplane.Data
{
/// <summary>
/// Data for a person participating in the airplane minigame.
/// Contains their name, target assignment, and scene reference.
/// </summary>
[System.Serializable]
public class PersonData
{
[Tooltip("Name of the person")]
public string personName;
[Tooltip("Target name they need to hit")]
public string targetName;
[Tooltip("Transform reference to the person in the scene")]
public Transform personTransform;
[Tooltip("Turn number (assigned at runtime)")]
public int turnNumber;
/// <summary>
/// Constructor for creating person data
/// </summary>
public PersonData(string name, string target, Transform transform, int turn = 0)
{
personName = name;
targetName = target;
personTransform = transform;
turnNumber = turn;
}
/// <summary>
/// Default constructor for serialization
/// </summary>
public PersonData()
{
personName = "Unknown";
targetName = "Unknown";
personTransform = null;
turnNumber = 0;
}
public override string ToString()
{
return $"Person: {personName}, Target: {targetName}, Turn: {turnNumber}";
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b9a03de5cfa64dadaf6c53b8f3935d3e
timeCreated: 1764851235

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e00ca01a87d64f7c83128cb731225039
timeCreated: 1765135354

View File

@@ -0,0 +1,123 @@
using UnityEngine;
namespace Minigames.Airplane.Interactive
{
/// <summary>
/// Bounces airplanes on collision with configurable bounce multiplier.
/// Can be used for trampolines, bounce pads, or elastic surfaces.
/// </summary>
[RequireComponent(typeof(Collider2D))]
public class AirplaneBouncySurface : MonoBehaviour
{
[Header("Bounce Configuration")]
[SerializeField] private float bounceMultiplier = 1.5f;
[SerializeField] private Vector2 bounceDirection = Vector2.up;
[SerializeField] private bool useReflection = true;
[Header("Optional Modifiers")]
[SerializeField] private float minBounceVelocity = 2f;
[SerializeField] private float maxBounceVelocity = 20f;
[Header("Visual Feedback (Optional)")]
[SerializeField] private Animator bounceAnimator;
[SerializeField] private string bounceTrigger = "Bounce";
[SerializeField] private AudioSource bounceSound;
[Header("Debug")]
[SerializeField] private bool showDebugLogs;
private void Awake()
{
// Ensure collider is trigger
var collider = GetComponent<Collider2D>();
if (collider != null)
{
collider.isTrigger = true;
}
}
private void OnTriggerEnter2D(Collider2D other)
{
// Check if it's an airplane
var airplane = other.GetComponent<Core.AirplaneController>();
if (airplane == null || !airplane.IsFlying) return;
var rb = other.GetComponent<Rigidbody2D>();
if (rb == null) return;
// Calculate bounce velocity
Vector2 newVelocity;
if (useReflection)
{
// Reflect velocity around bounce direction (normal)
Vector2 normal = bounceDirection.normalized;
newVelocity = Vector2.Reflect(rb.linearVelocity, normal) * bounceMultiplier;
}
else
{
// Direct bounce in specified direction
float speed = rb.linearVelocity.magnitude * bounceMultiplier;
newVelocity = bounceDirection.normalized * speed;
}
// Clamp velocity
float magnitude = newVelocity.magnitude;
if (magnitude < minBounceVelocity)
{
newVelocity = newVelocity.normalized * minBounceVelocity;
}
else if (magnitude > maxBounceVelocity)
{
newVelocity = newVelocity.normalized * maxBounceVelocity;
}
// Apply bounce
rb.linearVelocity = newVelocity;
// Visual/audio feedback
PlayBounceEffects();
if (showDebugLogs)
{
Debug.Log($"[AirplaneBouncySurface] Bounced {other.name}: velocity={newVelocity}");
}
}
private void PlayBounceEffects()
{
// Trigger animation
if (bounceAnimator != null && !string.IsNullOrEmpty(bounceTrigger))
{
bounceAnimator.SetTrigger(bounceTrigger);
}
// Play sound
if (bounceSound != null)
{
bounceSound.Play();
}
}
private void OnDrawGizmos()
{
// Visualize bounce direction in editor
Gizmos.color = Color.cyan;
var collider = GetComponent<Collider2D>();
if (collider != null)
{
Vector3 center = collider.bounds.center;
Vector3 direction = bounceDirection.normalized;
// Draw arrow showing bounce direction
Gizmos.DrawRay(center, direction * 2f);
Gizmos.DrawWireSphere(center + direction * 2f, 0.3f);
// Draw surface bounds
Gizmos.DrawWireCube(collider.bounds.center, collider.bounds.size);
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6f1ff69bae8e49188f439a8e5cdb7dfc
timeCreated: 1765135371

View File

@@ -0,0 +1,148 @@
using UnityEngine;
namespace Minigames.Airplane.Interactive
{
/// <summary>
/// Gravity well that pulls airplanes toward its center.
/// Creates challenging "danger zones" that players must avoid or escape from.
/// </summary>
[RequireComponent(typeof(Collider2D))]
public class AirplaneGravityWell : MonoBehaviour
{
[Header("Gravity Configuration")]
[SerializeField] private float pullStrength = 5f;
[SerializeField] private bool useInverseSquare = false;
[SerializeField] private float minPullDistance = 0.5f;
[Header("Optional Modifiers")]
[SerializeField] private float maxPullForce = 15f;
[SerializeField] private AnimationCurve pullFalloff = AnimationCurve.Linear(0, 1, 1, 0);
[Header("Visual Feedback (Optional)")]
[SerializeField] private ParticleSystem gravityParticles;
[SerializeField] private SpriteRenderer centerSprite;
[SerializeField] private float rotationSpeed = 90f;
[Header("Debug")]
[SerializeField] private bool showDebugLogs;
[SerializeField] private bool drawDebugLines = true;
private Vector2 centerPosition;
private void Awake()
{
// Ensure collider is trigger
var collider = GetComponent<Collider2D>();
if (collider != null)
{
collider.isTrigger = true;
}
centerPosition = transform.position;
}
private void Update()
{
// Rotate center visual if present
if (centerSprite != null)
{
centerSprite.transform.Rotate(0, 0, rotationSpeed * Time.deltaTime);
}
}
private void OnTriggerStay2D(Collider2D other)
{
// Check if it's an airplane
var airplane = other.GetComponent<Core.AirplaneController>();
if (airplane == null || !airplane.IsFlying) return;
var rb = other.GetComponent<Rigidbody2D>();
if (rb == null) return;
// Calculate direction and distance to center
Vector2 airplanePos = rb.position;
Vector2 toCenter = centerPosition - airplanePos;
float distance = toCenter.magnitude;
// Prevent division by zero
if (distance < minPullDistance)
{
distance = minPullDistance;
}
// Calculate pull force
float forceMagnitude;
if (useInverseSquare)
{
// Realistic gravity-like force (inverse square law)
forceMagnitude = pullStrength / (distance * distance);
}
else
{
// Linear falloff based on distance
var collider = GetComponent<Collider2D>();
float maxDistance = collider != null ? collider.bounds.extents.magnitude : 5f;
float normalizedDistance = Mathf.Clamp01(distance / maxDistance);
float falloff = pullFalloff.Evaluate(1f - normalizedDistance);
forceMagnitude = pullStrength * falloff;
}
// Clamp force
forceMagnitude = Mathf.Min(forceMagnitude, maxPullForce);
// Apply force toward center
Vector2 pullForce = toCenter.normalized * forceMagnitude;
rb.AddForce(pullForce, ForceMode2D.Force);
if (showDebugLogs && Time.frameCount % 30 == 0) // Log every 30 frames
{
Debug.Log($"[AirplaneGravityWell] Pulling {other.name}: force={forceMagnitude:F2}, distance={distance:F2}");
}
}
private void OnDrawGizmos()
{
// Visualize gravity well in editor
Gizmos.color = new Color(1f, 0f, 1f, 0.3f); // Magenta transparent
var collider = GetComponent<Collider2D>();
if (collider != null)
{
// Draw zone bounds
Gizmos.DrawWireSphere(collider.bounds.center, collider.bounds.extents.magnitude);
// Draw center point
Gizmos.color = Color.magenta;
Gizmos.DrawWireSphere(transform.position, 0.5f);
// Draw pull strength indicator
Gizmos.DrawRay(transform.position, Vector3.up * pullStrength * 0.2f);
}
}
private void OnDrawGizmosSelected()
{
if (!drawDebugLines) return;
// Draw pull force visualization at multiple points
var collider = GetComponent<Collider2D>();
if (collider == null) return;
float radius = collider.bounds.extents.magnitude;
int samples = 8;
for (int i = 0; i < samples; i++)
{
float angle = (i / (float)samples) * 360f * Mathf.Deg2Rad;
Vector2 offset = new Vector2(Mathf.Cos(angle), Mathf.Sin(angle)) * radius;
Vector3 samplePoint = transform.position + (Vector3)offset;
Vector3 direction = (transform.position - samplePoint).normalized;
Gizmos.color = Color.yellow;
Gizmos.DrawLine(samplePoint, samplePoint + direction * 2f);
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f6c5008f2782416095c5b3f5092843a9
timeCreated: 1765135424

View File

@@ -0,0 +1,122 @@
using UnityEngine;
namespace Minigames.Airplane.Interactive
{
/// <summary>
/// Speed boost ring that increases airplane velocity when passed through.
/// Can be used as collectible power-ups or checkpoint rings.
/// </summary>
[RequireComponent(typeof(Collider2D))]
public class AirplaneSpeedRing : MonoBehaviour
{
[Header("Boost Configuration")]
[SerializeField] private float velocityMultiplier = 1.5f;
[SerializeField] private float boostDuration = 1f;
[SerializeField] private bool oneTimeUse = true;
[Header("Optional Constraints")]
[SerializeField] private float minResultSpeed = 5f;
[SerializeField] private float maxResultSpeed = 25f;
[Header("Visual Feedback")]
[SerializeField] private GameObject ringVisual;
[SerializeField] private ParticleSystem collectEffect;
[SerializeField] private AudioSource collectSound;
[Header("Debug")]
[SerializeField] private bool showDebugLogs;
private bool hasBeenUsed;
private void Awake()
{
// Ensure collider is trigger
var collider = GetComponent<Collider2D>();
if (collider != null)
{
collider.isTrigger = true;
}
}
private void OnTriggerEnter2D(Collider2D other)
{
// Check if already used
if (oneTimeUse && hasBeenUsed) return;
// Check if it's an airplane
var airplane = other.GetComponent<Core.AirplaneController>();
if (airplane == null || !airplane.IsFlying) return;
var rb = other.GetComponent<Rigidbody2D>();
if (rb == null) return;
// Apply speed boost
Vector2 boostedVelocity = rb.linearVelocity * velocityMultiplier;
// Clamp to constraints
float speed = boostedVelocity.magnitude;
if (speed < minResultSpeed)
{
boostedVelocity = boostedVelocity.normalized * minResultSpeed;
}
else if (speed > maxResultSpeed)
{
boostedVelocity = boostedVelocity.normalized * maxResultSpeed;
}
rb.linearVelocity = boostedVelocity;
// Mark as used
hasBeenUsed = true;
// Trigger effects
PlayCollectEffects();
if (showDebugLogs)
{
Debug.Log($"[AirplaneSpeedRing] Boosted {other.name}: velocity={boostedVelocity.magnitude:F1}");
}
// Hide or destroy ring
if (oneTimeUse)
{
if (ringVisual != null)
{
ringVisual.SetActive(false);
}
else
{
Destroy(gameObject, collectEffect != null ? collectEffect.main.duration : 0.5f);
}
}
}
private void PlayCollectEffects()
{
// Play particle effect
if (collectEffect != null)
{
collectEffect.Play();
}
// Play sound
if (collectSound != null)
{
collectSound.Play();
}
}
private void OnDrawGizmos()
{
// Visualize ring in editor
Gizmos.color = hasBeenUsed ? Color.gray : Color.yellow;
var collider = GetComponent<Collider2D>();
if (collider != null)
{
Gizmos.DrawWireSphere(collider.bounds.center, collider.bounds.extents.magnitude);
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 30fadeee96664cf28e3e2e562c99db26
timeCreated: 1765135387

View File

@@ -0,0 +1,107 @@
using UnityEngine;
namespace Minigames.Airplane.Interactive
{
/// <summary>
/// Turbulence zone that applies random chaotic forces to airplanes.
/// Creates unpredictable movement, adding challenge to navigation.
/// </summary>
[RequireComponent(typeof(Collider2D))]
public class AirplaneTurbulenceZone : MonoBehaviour
{
[Header("Turbulence Configuration")]
[SerializeField] private float turbulenceStrength = 3f;
[SerializeField] private float changeFrequency = 0.1f;
[Header("Optional Modifiers")]
[SerializeField] private bool preventUpwardForce = false;
[SerializeField] private float maxTotalForce = 10f;
[Header("Visual Feedback (Optional)")]
[SerializeField] private ParticleSystem turbulenceParticles;
[Header("Debug")]
[SerializeField] private bool showDebugLogs;
private float nextChangeTime;
private Vector2 currentTurbulenceDirection;
private void Awake()
{
// Ensure collider is trigger
var collider = GetComponent<Collider2D>();
if (collider != null)
{
collider.isTrigger = true;
}
// Initialize random direction
UpdateTurbulenceDirection();
}
private void Update()
{
// Change turbulence direction periodically
if (Time.time >= nextChangeTime)
{
UpdateTurbulenceDirection();
nextChangeTime = Time.time + changeFrequency;
}
}
private void UpdateTurbulenceDirection()
{
currentTurbulenceDirection = Random.insideUnitCircle.normalized;
// Prevent upward force if configured
if (preventUpwardForce && currentTurbulenceDirection.y > 0)
{
currentTurbulenceDirection.y = -currentTurbulenceDirection.y;
}
}
private void OnTriggerStay2D(Collider2D other)
{
// Check if it's an airplane
var airplane = other.GetComponent<Core.AirplaneController>();
if (airplane == null || !airplane.IsFlying) return;
var rb = other.GetComponent<Rigidbody2D>();
if (rb == null) return;
// Apply turbulence force
Vector2 turbulenceForce = currentTurbulenceDirection * turbulenceStrength;
// Clamp total force
if (turbulenceForce.magnitude > maxTotalForce)
{
turbulenceForce = turbulenceForce.normalized * maxTotalForce;
}
rb.AddForce(turbulenceForce, ForceMode2D.Force);
if (showDebugLogs && Time.frameCount % 30 == 0) // Log every 30 frames to avoid spam
{
Debug.Log($"[AirplaneTurbulenceZone] Applied turbulence: {turbulenceForce} to {other.name}");
}
}
private void OnDrawGizmos()
{
// Visualize turbulence zone in editor
Gizmos.color = new Color(1f, 0.5f, 0f, 0.3f); // Orange transparent
var collider = GetComponent<Collider2D>();
if (collider != null)
{
Gizmos.DrawCube(collider.bounds.center, collider.bounds.size);
// Draw current direction
Gizmos.color = Color.red;
Vector3 center = collider.bounds.center;
Gizmos.DrawRay(center, (Vector3)currentTurbulenceDirection * 2f);
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ae20630c0dc74174ae4d851d97d101c0
timeCreated: 1765135403

Some files were not shown because too many files have changed in this diff Show More