fix: Standardize healing text display to match damage text formatting.
This commit is contained in:
@@ -7,22 +7,22 @@ namespace Mr.BrickAdventures.Autoloads;
|
|||||||
public partial class FloatingTextManager : Node
|
public partial class FloatingTextManager : Node
|
||||||
{
|
{
|
||||||
[Export] public PackedScene FloatingTextScene { get; set; }
|
[Export] public PackedScene FloatingTextScene { get; set; }
|
||||||
|
|
||||||
[ExportGroup("Colors")]
|
[ExportGroup("Colors")]
|
||||||
[Export] public Color DamageColor { get; set; } = new Color("#b21030"); // Red
|
[Export] public Color DamageColor { get; set; } = new Color("#b21030"); // Red
|
||||||
[Export] public Color HealColor { get; set; } = new Color("#71f341"); // Green
|
[Export] public Color HealColor { get; set; } = new Color("#71f341"); // Green
|
||||||
[Export] public Color CoinColor { get; set; } = new Color("#ebd320"); // Gold
|
[Export] public Color CoinColor { get; set; } = new Color("#ebd320"); // Gold
|
||||||
[Export] public Color MessageColor { get; set; } = new Color("#ffffff"); // White
|
[Export] public Color MessageColor { get; set; } = new Color("#ffffff"); // White
|
||||||
|
|
||||||
public void ShowDamage(float amount, Vector2 position)
|
public void ShowDamage(float amount, Vector2 position)
|
||||||
{
|
{
|
||||||
var text = Mathf.Round(amount * 100f).ToString(CultureInfo.InvariantCulture);
|
var text = Mathf.Round(amount * 100f).ToString(CultureInfo.InvariantCulture);
|
||||||
CreateFloatingText(text, position, DamageColor);
|
CreateFloatingText(text, position, DamageColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowHeal(float amount, Vector2 position)
|
public void ShowHeal(float amount, Vector2 position)
|
||||||
{
|
{
|
||||||
var text = $"+{Mathf.Round(amount)}";
|
var text = $"+{Mathf.Round(amount * 100f).ToString(CultureInfo.InvariantCulture)}";
|
||||||
CreateFloatingText(text, position, HealColor);
|
CreateFloatingText(text, position, HealColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,12 +31,12 @@ public partial class FloatingTextManager : Node
|
|||||||
var text = $"+{amount}";
|
var text = $"+{amount}";
|
||||||
CreateFloatingText(text, position, CoinColor);
|
CreateFloatingText(text, position, CoinColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowMessage(string message, Vector2 position)
|
public void ShowMessage(string message, Vector2 position)
|
||||||
{
|
{
|
||||||
CreateFloatingText(message, position, MessageColor);
|
CreateFloatingText(message, position, MessageColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateFloatingText(string text, Vector2 position, Color color)
|
private void CreateFloatingText(string text, Vector2 position, Color color)
|
||||||
{
|
{
|
||||||
if (FloatingTextScene == null)
|
if (FloatingTextScene == null)
|
||||||
|
|||||||
Reference in New Issue
Block a user