Implement Fort Fight minigame (#75)

Co-authored-by: Michal Pikulski <michal.a.pikulski@gmail.com>
Reviewed-on: #75
This commit is contained in:
2025-12-04 01:18:29 +00:00
parent bb8d600af2
commit e60d516e7e
127 changed files with 21544 additions and 128 deletions

View File

@@ -5,6 +5,7 @@ using AppleHills.Core.Settings;
using Core.Lifecycle;
using Core.Settings;
using Input;
using Minigames.FortFight.Core;
using UnityEngine;
namespace Core
@@ -173,7 +174,9 @@ namespace Core
var sortingGameSettings = SettingsProvider.Instance.LoadSettingsSynchronous<CardSortingSettings>();
var birdPooperSettings = SettingsProvider.Instance.LoadSettingsSynchronous<BirdPooperSettings>();
var statueDressupSettings = SettingsProvider.Instance.LoadSettingsSynchronous<StatueDressupSettings>();
var fortFightSettings = SettingsProvider.Instance.LoadSettingsSynchronous<FortFightSettings>();
// Register settings with service locator
if (playerSettings != null)
{
@@ -244,10 +247,21 @@ namespace Core
{
Debug.LogError("Failed to load StatueDressupSettings");
}
if (fortFightSettings != null)
{
ServiceLocator.Register<IFortFightSettings>(fortFightSettings);
Logging.Debug("FortFightSettings registered successfully");
}
else
{
Debug.LogError("Failed to load FortFightSettings");
}
// Log success
_settingsLoaded = playerSettings != null && interactionSettings != null && minigameSettings != null
&& cardSystemSettings != null && birdPooperSettings != null && statueDressupSettings != null;
&& cardSystemSettings != null && birdPooperSettings != null && statueDressupSettings != null
&& fortFightSettings != null;
if (_settingsLoaded)
{
Logging.Debug("All settings loaded and registered with ServiceLocator");
@@ -312,5 +326,8 @@ namespace Core
public float PlayerStopDistance => GetSettings<IInteractionSettings>()?.PlayerStopDistance ?? 6.0f;
public float PlayerStopDistanceDirectInteraction => GetSettings<IInteractionSettings>()?.PlayerStopDistanceDirectInteraction ?? 2.0f;
public float DefaultPuzzlePromptRange => GetSettings<IInteractionSettings>()?.DefaultPuzzlePromptRange ?? 3.0f;
// Fort Fight Settings
public float WeakPointExplosionRadius => GetSettings<IFortFightSettings>()?.WeakPointExplosionRadius ?? 2.5f;
}
}

View File

@@ -213,4 +213,66 @@ namespace AppleHills.Core.Settings
string StateSaveKey { get; }
int MaxSavedDecorations { get; }
}
/// <summary>
/// Interface for Fort Fight minigame settings
/// </summary>
public interface IFortFightSettings
{
// Block configurations
System.Collections.Generic.List<Minigames.FortFight.Settings.BlockMaterialConfig> MaterialConfigs { get; }
System.Collections.Generic.List<Minigames.FortFight.Settings.BlockSizeConfig> SizeConfigs { get; }
// Weak point settings
float WeakPointExplosionRadius { get; }
float WeakPointExplosionDamage { get; }
float WeakPointExplosionForce { get; }
// Fort settings
float FortDefeatThreshold { get; }
float PhysicsGravityScale { get; }
// Turn & Projectile timing
float ProjectileSettleDelay { get; } // Time to wait after projectile stops moving before ending turn
float TurnTransitionDelay { get; } // Additional delay during turn transition (wide view camera)
// Physics Settings
float BlockGravityScale { get; } // Gravity scale for fort blocks
float ProjectileGravityScale { get; } // Gravity scale for projectiles
// Physics Layers
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
float VacuumBlockDamage { get; } // Damage dealt to blocks while sliding
int TrashBagPieceCount { get; } // Pieces spawned on trash bag impact
float TrashBagPieceForce { get; } // Force per trash piece
float TrashBagSpreadAngle { get; } // Trash bag spread cone angle
float TrashPieceDamage { get; } // Damage per trash piece on collision
float TrashPieceLifetime { get; } // How long trash pieces persist (seconds)
float CeilingFanActivationDelay { get; } // Delay before tap-to-drop becomes available
float CeilingFanDropDelay { get; } // Pause before ceiling fan starts dropping
float CeilingFanDropSpeed { get; } // Downward velocity when dropping (m/s)
// Projectile Configurations
System.Collections.Generic.IReadOnlyList<Minigames.FortFight.Data.ProjectileConfig> ProjectileConfigs { get; }
Minigames.FortFight.Data.ProjectileConfig GetProjectileConfig(Minigames.FortFight.Data.ProjectileType type);
Minigames.FortFight.Data.ProjectileConfig GetProjectileConfigById(string projectileId);
// Visual settings
Color DamageColorTint { get; }
// Helper methods
Minigames.FortFight.Settings.BlockMaterialConfig GetMaterialConfig(Minigames.FortFight.Data.BlockMaterial material);
Minigames.FortFight.Settings.BlockSizeConfig GetSizeConfig(Minigames.FortFight.Data.BlockSize size);
}
}

View File

@@ -15,12 +15,14 @@ namespace AppleHills
private static GetSettingsValueDelegate getPlayerStopDistanceProvider;
private static GetSettingsValueDelegate getPlayerStopDistanceDirectInteractionProvider;
private static GetSettingsValueDelegate getPuzzlePromptRangeProvider;
private static GetSettingsValueDelegate getWeakPointExplosionRadiusProvider;
// Editor-only method to set up providers - will be called from editor code
public static void SetupEditorProviders(
GetSettingsValueDelegate playerStopDistanceProvider,
GetSettingsValueDelegate playerStopDistanceDirectInteractionProvider,
GetSettingsValueDelegate puzzlePromptRangeProvider)
GetSettingsValueDelegate puzzlePromptRangeProvider,
GetSettingsValueDelegate weakPointExplosionRadiusProvider)
{
#if UNITY_EDITOR
if (!Application.isPlaying)
@@ -28,6 +30,7 @@ namespace AppleHills
getPlayerStopDistanceProvider = playerStopDistanceProvider;
getPlayerStopDistanceDirectInteractionProvider = playerStopDistanceDirectInteractionProvider;
getPuzzlePromptRangeProvider = puzzlePromptRangeProvider;
getWeakPointExplosionRadiusProvider = weakPointExplosionRadiusProvider;
}
#endif
}
@@ -73,6 +76,19 @@ namespace AppleHills
return GameManager.Instance.DefaultPuzzlePromptRange;
}
// Fort Fight Settings
public static float GetWeakPointExplosionRadius()
{
#if UNITY_EDITOR
if (!Application.isPlaying && getWeakPointExplosionRadiusProvider != null)
{
return getWeakPointExplosionRadiusProvider();
}
#endif
return GameManager.Instance.WeakPointExplosionRadius;
}
// Add more methods as needed for other settings
}
}