Cleanup the block HP and material setup
This commit is contained in:
@@ -247,10 +247,6 @@ namespace Core.Settings
|
|||||||
// Slingshot Configuration
|
// Slingshot Configuration
|
||||||
Common.Input.SlingshotConfig SlingshotSettings { get; }
|
Common.Input.SlingshotConfig SlingshotSettings { get; }
|
||||||
|
|
||||||
// Block configurations
|
|
||||||
List<Minigames.FortFight.Settings.BlockMaterialConfig> MaterialConfigs { get; }
|
|
||||||
List<Minigames.FortFight.Settings.BlockSizeConfig> SizeConfigs { get; }
|
|
||||||
|
|
||||||
// AI Difficulty Settings
|
// AI Difficulty Settings
|
||||||
Minigames.FortFight.Data.AIDifficulty DefaultAIDifficulty { get; } // Default difficulty level for AI
|
Minigames.FortFight.Data.AIDifficulty DefaultAIDifficulty { get; } // Default difficulty level for AI
|
||||||
Minigames.FortFight.Data.AIDifficultyData GetAIDifficultyData(Minigames.FortFight.Data.AIDifficulty difficulty);
|
Minigames.FortFight.Data.AIDifficultyData GetAIDifficultyData(Minigames.FortFight.Data.AIDifficulty difficulty);
|
||||||
@@ -297,10 +293,6 @@ namespace Core.Settings
|
|||||||
|
|
||||||
// Visual settings
|
// Visual settings
|
||||||
Color DamageColorTint { get; }
|
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using AppleHills.Core.Settings;
|
|||||||
using Common.Input;
|
using Common.Input;
|
||||||
using Core.Settings;
|
using Core.Settings;
|
||||||
using Minigames.FortFight.Data;
|
using Minigames.FortFight.Data;
|
||||||
using Minigames.FortFight.Settings;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Minigames.FortFight.Core
|
namespace Minigames.FortFight.Core
|
||||||
@@ -29,24 +28,6 @@ namespace Minigames.FortFight.Core
|
|||||||
autoRegisterInput = false // TurnManager handles registration
|
autoRegisterInput = false // TurnManager handles registration
|
||||||
};
|
};
|
||||||
|
|
||||||
[Header("Block Material Configurations")]
|
|
||||||
[Tooltip("HP and mass configurations for each material type")]
|
|
||||||
[SerializeField] private List<BlockMaterialConfig> materialConfigs = new List<BlockMaterialConfig>
|
|
||||||
{
|
|
||||||
new BlockMaterialConfig { material = BlockMaterial.Cardboard, baseHp = 20f, baseMass = 0.5f },
|
|
||||||
new BlockMaterialConfig { material = BlockMaterial.Metal, baseHp = 50f, baseMass = 2f },
|
|
||||||
new BlockMaterialConfig { material = BlockMaterial.Glass, baseHp = 15f, baseMass = 0.8f }
|
|
||||||
};
|
|
||||||
|
|
||||||
[Header("Block Size Configurations")]
|
|
||||||
[Tooltip("HP and mass multipliers for each size type")]
|
|
||||||
[SerializeField] private List<BlockSizeConfig> sizeConfigs = new List<BlockSizeConfig>
|
|
||||||
{
|
|
||||||
new BlockSizeConfig { size = BlockSize.Small, hpMultiplier = 1f, massMultiplier = 0.5f },
|
|
||||||
new BlockSizeConfig { size = BlockSize.Medium, hpMultiplier = 1.5f, massMultiplier = 1f },
|
|
||||||
new BlockSizeConfig { size = BlockSize.Large, hpMultiplier = 2f, massMultiplier = 2f }
|
|
||||||
};
|
|
||||||
|
|
||||||
[Header("AI Difficulty Configurations")]
|
[Header("AI Difficulty Configurations")]
|
||||||
[Tooltip("AI behavior parameters for each difficulty level")]
|
[Tooltip("AI behavior parameters for each difficulty level")]
|
||||||
[SerializeField] private List<AIDifficultyConfig> aiDifficultyConfigs = new List<AIDifficultyConfig>
|
[SerializeField] private List<AIDifficultyConfig> aiDifficultyConfigs = new List<AIDifficultyConfig>
|
||||||
@@ -153,9 +134,6 @@ namespace Minigames.FortFight.Core
|
|||||||
|
|
||||||
public SlingshotConfig SlingshotSettings => slingshotSettings;
|
public SlingshotConfig SlingshotSettings => slingshotSettings;
|
||||||
|
|
||||||
public List<BlockMaterialConfig> MaterialConfigs => materialConfigs;
|
|
||||||
public List<BlockSizeConfig> SizeConfigs => sizeConfigs;
|
|
||||||
|
|
||||||
public AIDifficulty DefaultAIDifficulty => defaultAIDifficulty;
|
public AIDifficulty DefaultAIDifficulty => defaultAIDifficulty;
|
||||||
|
|
||||||
public IReadOnlyList<ProjectileType> AIAllowedProjectiles => aiAllowedProjectiles;
|
public IReadOnlyList<ProjectileType> AIAllowedProjectiles => aiAllowedProjectiles;
|
||||||
@@ -221,16 +199,6 @@ namespace Minigames.FortFight.Core
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockMaterialConfig GetMaterialConfig(BlockMaterial material)
|
|
||||||
{
|
|
||||||
return materialConfigs.FirstOrDefault(c => c.material == material);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockSizeConfig GetSizeConfig(BlockSize size)
|
|
||||||
{
|
|
||||||
return sizeConfigs.FirstOrDefault(c => c.size == size);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get AI difficulty configuration data by difficulty level
|
/// Get AI difficulty configuration data by difficulty level
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -259,26 +227,9 @@ namespace Minigames.FortFight.Core
|
|||||||
{
|
{
|
||||||
config?.Validate();
|
config?.Validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure defeat threshold is between 0 and 1
|
// Ensure defeat threshold is between 0 and 1
|
||||||
fortDefeatThreshold = Mathf.Clamp01(fortDefeatThreshold);
|
fortDefeatThreshold = Mathf.Clamp01(fortDefeatThreshold);
|
||||||
|
|
||||||
// Ensure all materials are configured
|
|
||||||
foreach (BlockMaterial material in System.Enum.GetValues(typeof(BlockMaterial)))
|
|
||||||
{
|
|
||||||
if (!materialConfigs.Any(c => c.material == material))
|
|
||||||
{
|
|
||||||
Debug.LogWarning($"[FortFightSettings] Missing configuration for material: {material}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure all sizes are configured
|
|
||||||
foreach (BlockSize size in System.Enum.GetValues(typeof(BlockSize)))
|
|
||||||
{
|
|
||||||
if (!sizeConfigs.Any(c => c.size == size))
|
|
||||||
{
|
|
||||||
Debug.LogWarning($"[FortFightSettings] Missing configuration for size: {size}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -21,25 +21,6 @@
|
|||||||
GameOver
|
GameOver
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Material types for fort blocks
|
|
||||||
/// </summary>
|
|
||||||
public enum BlockMaterial
|
|
||||||
{
|
|
||||||
Cardboard,
|
|
||||||
Metal,
|
|
||||||
Glass
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Size categories for fort blocks
|
|
||||||
/// </summary>
|
|
||||||
public enum BlockSize
|
|
||||||
{
|
|
||||||
Small,
|
|
||||||
Medium,
|
|
||||||
Large
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Types of projectiles available
|
/// Types of projectiles available
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using Core;
|
|||||||
using Core.Lifecycle;
|
using Core.Lifecycle;
|
||||||
using Core.Settings;
|
using Core.Settings;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Minigames.FortFight.Data;
|
|
||||||
|
|
||||||
namespace Minigames.FortFight.Fort
|
namespace Minigames.FortFight.Fort
|
||||||
{
|
{
|
||||||
@@ -17,11 +16,9 @@ namespace Minigames.FortFight.Fort
|
|||||||
#region Inspector Properties
|
#region Inspector Properties
|
||||||
|
|
||||||
[Header("Block Configuration")]
|
[Header("Block Configuration")]
|
||||||
[SerializeField] private BlockMaterial material = BlockMaterial.Cardboard;
|
|
||||||
[SerializeField] private BlockSize size = BlockSize.Medium;
|
|
||||||
[SerializeField] private bool isWeakPoint = false;
|
[SerializeField] private bool isWeakPoint = false;
|
||||||
|
|
||||||
[Tooltip("Fixed HP value for this block (default: 10)")]
|
[Tooltip("HP value for this block")]
|
||||||
[SerializeField] private float blockHp = 10f;
|
[SerializeField] private float blockHp = 10f;
|
||||||
|
|
||||||
[Header("Weak Point Settings (if applicable)")]
|
[Header("Weak Point Settings (if applicable)")]
|
||||||
@@ -51,8 +48,6 @@ namespace Minigames.FortFight.Fort
|
|||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
public BlockMaterial Material => material;
|
|
||||||
public BlockSize Size => size;
|
|
||||||
public bool IsWeakPoint => isWeakPoint;
|
public bool IsWeakPoint => isWeakPoint;
|
||||||
public float CurrentHp => currentHp;
|
public float CurrentHp => currentHp;
|
||||||
public float MaxHp => maxHp;
|
public float MaxHp => maxHp;
|
||||||
@@ -142,7 +137,7 @@ namespace Minigames.FortFight.Fort
|
|||||||
weakPointVisualIndicator.SetActive(isWeakPoint);
|
weakPointVisualIndicator.SetActive(isWeakPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logging.Debug($"[FortBlock] {gameObject.name} initialized: {material} {size}, HP: {maxHp}");
|
Logging.Debug($"[FortBlock] {gameObject.name} initialized, HP: {maxHp}");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -151,11 +146,9 @@ namespace Minigames.FortFight.Fort
|
|||||||
|
|
||||||
private void CalculateHp()
|
private void CalculateHp()
|
||||||
{
|
{
|
||||||
// Use fixed block HP value (default 10)
|
// Use fixed block HP value from inspector
|
||||||
maxHp = blockHp;
|
maxHp = blockHp;
|
||||||
currentHp = maxHp;
|
currentHp = maxHp;
|
||||||
|
|
||||||
Logging.Debug($"[FortBlock] {gameObject.name} initialized: {material} {size}, HP: {maxHp}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -166,16 +159,9 @@ namespace Minigames.FortFight.Fort
|
|||||||
{
|
{
|
||||||
if (rb2D == null) return;
|
if (rb2D == null) return;
|
||||||
|
|
||||||
// Get material config
|
// Mass is configured directly on the Rigidbody2D component in Unity Inspector
|
||||||
var materialConfig = CachedSettings.GetMaterialConfig(material);
|
// Only set runtime physics properties here
|
||||||
float baseMass = materialConfig?.baseMass ?? 1f;
|
rb2D.gravityScale = CachedSettings.BlockGravityScale;
|
||||||
|
|
||||||
// Get size config
|
|
||||||
var sizeConfig = CachedSettings.GetSizeConfig(size);
|
|
||||||
float sizeMultiplier = sizeConfig?.massMultiplier ?? 1f;
|
|
||||||
|
|
||||||
rb2D.mass = baseMass * sizeMultiplier;
|
|
||||||
rb2D.gravityScale = CachedSettings.PhysicsGravityScale;
|
|
||||||
rb2D.collisionDetectionMode = CollisionDetectionMode2D.Continuous;
|
rb2D.collisionDetectionMode = CollisionDetectionMode2D.Continuous;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,8 +351,8 @@ namespace Minigames.FortFight.Fort
|
|||||||
private void SpawnDestructionEffect()
|
private void SpawnDestructionEffect()
|
||||||
{
|
{
|
||||||
// Placeholder for destruction particles
|
// Placeholder for destruction particles
|
||||||
// TODO: Create material-specific destruction effects
|
// TODO: Create destruction effects
|
||||||
Logging.Debug($"[FortBlock] Spawning destruction effect for {material} block");
|
Logging.Debug($"[FortBlock] Spawning destruction effect");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ namespace Minigames.FortFight.Fort
|
|||||||
|
|
||||||
if (ShowDebugInfo)
|
if (ShowDebugInfo)
|
||||||
{
|
{
|
||||||
Logging.Debug($"[FortController] Registered block: {block.gameObject.name} ({block.Material} {block.Size}, HP: {block.MaxHp})");
|
Logging.Debug($"[FortController] Registered block: {block.gameObject.name} (HP: {block.MaxHp})");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Minigames.FortFight.Data;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Minigames.FortFight.Settings
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Configuration for a specific block material (Cardboard, Metal, Glass).
|
|
||||||
/// </summary>
|
|
||||||
[Serializable]
|
|
||||||
public class BlockMaterialConfig
|
|
||||||
{
|
|
||||||
[Tooltip("The material type this configuration applies to")]
|
|
||||||
public BlockMaterial material;
|
|
||||||
|
|
||||||
[Tooltip("Base HP for this material before size multiplier")]
|
|
||||||
public float baseHp;
|
|
||||||
|
|
||||||
[Tooltip("Base mass for physics simulation before size multiplier")]
|
|
||||||
public float baseMass;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Configuration for a specific block size (Small, Medium, Large).
|
|
||||||
/// </summary>
|
|
||||||
[Serializable]
|
|
||||||
public class BlockSizeConfig
|
|
||||||
{
|
|
||||||
[Tooltip("The size type this configuration applies to")]
|
|
||||||
public BlockSize size;
|
|
||||||
|
|
||||||
[Tooltip("HP multiplier applied to base material HP")]
|
|
||||||
public float hpMultiplier;
|
|
||||||
|
|
||||||
[Tooltip("Mass multiplier applied to base material mass")]
|
|
||||||
public float massMultiplier;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 731e8965ca0149d79420ee0b15a4e94f
|
|
||||||
timeCreated: 1764669813
|
|
||||||
Reference in New Issue
Block a user