Cleanup the block HP and material setup
This commit is contained in:
@@ -3,7 +3,6 @@ using Core;
|
||||
using Core.Lifecycle;
|
||||
using Core.Settings;
|
||||
using UnityEngine;
|
||||
using Minigames.FortFight.Data;
|
||||
|
||||
namespace Minigames.FortFight.Fort
|
||||
{
|
||||
@@ -17,11 +16,9 @@ namespace Minigames.FortFight.Fort
|
||||
#region Inspector Properties
|
||||
|
||||
[Header("Block Configuration")]
|
||||
[SerializeField] private BlockMaterial material = BlockMaterial.Cardboard;
|
||||
[SerializeField] private BlockSize size = BlockSize.Medium;
|
||||
[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;
|
||||
|
||||
[Header("Weak Point Settings (if applicable)")]
|
||||
@@ -51,8 +48,6 @@ namespace Minigames.FortFight.Fort
|
||||
|
||||
#region Properties
|
||||
|
||||
public BlockMaterial Material => material;
|
||||
public BlockSize Size => size;
|
||||
public bool IsWeakPoint => isWeakPoint;
|
||||
public float CurrentHp => currentHp;
|
||||
public float MaxHp => maxHp;
|
||||
@@ -142,7 +137,7 @@ namespace Minigames.FortFight.Fort
|
||||
weakPointVisualIndicator.SetActive(isWeakPoint);
|
||||
}
|
||||
|
||||
Logging.Debug($"[FortBlock] {gameObject.name} initialized: {material} {size}, HP: {maxHp}");
|
||||
Logging.Debug($"[FortBlock] {gameObject.name} initialized, HP: {maxHp}");
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -151,11 +146,9 @@ namespace Minigames.FortFight.Fort
|
||||
|
||||
private void CalculateHp()
|
||||
{
|
||||
// Use fixed block HP value (default 10)
|
||||
// Use fixed block HP value from inspector
|
||||
maxHp = blockHp;
|
||||
currentHp = maxHp;
|
||||
|
||||
Logging.Debug($"[FortBlock] {gameObject.name} initialized: {material} {size}, HP: {maxHp}");
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -166,16 +159,9 @@ namespace Minigames.FortFight.Fort
|
||||
{
|
||||
if (rb2D == null) return;
|
||||
|
||||
// Get material config
|
||||
var materialConfig = CachedSettings.GetMaterialConfig(material);
|
||||
float baseMass = materialConfig?.baseMass ?? 1f;
|
||||
|
||||
// Get size config
|
||||
var sizeConfig = CachedSettings.GetSizeConfig(size);
|
||||
float sizeMultiplier = sizeConfig?.massMultiplier ?? 1f;
|
||||
|
||||
rb2D.mass = baseMass * sizeMultiplier;
|
||||
rb2D.gravityScale = CachedSettings.PhysicsGravityScale;
|
||||
// Mass is configured directly on the Rigidbody2D component in Unity Inspector
|
||||
// Only set runtime physics properties here
|
||||
rb2D.gravityScale = CachedSettings.BlockGravityScale;
|
||||
rb2D.collisionDetectionMode = CollisionDetectionMode2D.Continuous;
|
||||
}
|
||||
|
||||
@@ -365,8 +351,8 @@ namespace Minigames.FortFight.Fort
|
||||
private void SpawnDestructionEffect()
|
||||
{
|
||||
// Placeholder for destruction particles
|
||||
// TODO: Create material-specific destruction effects
|
||||
Logging.Debug($"[FortBlock] Spawning destruction effect for {material} block");
|
||||
// TODO: Create destruction effects
|
||||
Logging.Debug($"[FortBlock] Spawning destruction effect");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace Minigames.FortFight.Fort
|
||||
|
||||
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})");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user