Removed currency ammount

This commit is contained in:
Pasha Bibko
2026-04-28 16:07:09 +01:00
parent 61c3123bf9
commit 631d5691ff
8 changed files with 23 additions and 68 deletions

View File

@@ -1,53 +0,0 @@
using UnityEngine;
using System.Text;
using System;
namespace Fruitomation.Game
{
public enum CurrencyMagnitude
{
Ones,
Thousands,
Millions,
Billions,
Trillions
}
[Serializable] public class CurrencyAmount
{
[SerializeField] private CurrencyMagnitude Magnitude;
[SerializeField] private float Ammount;
public string AsString()
{
StringBuilder builder = new();
builder.Append(
Ammount > 10f
? $"${Ammount:I}"
: $"${Ammount:F1}"
);
switch (Magnitude)
{
case CurrencyMagnitude.Ones:
break;
case CurrencyMagnitude.Thousands:
builder.Append("K");
break;
case CurrencyMagnitude.Millions:
builder.Append("M");
break;
case CurrencyMagnitude.Billions:
builder.Append("B");
break;
case CurrencyMagnitude.Trillions:
builder.Append("T");
break;
default:
throw new ArgumentOutOfRangeException();
}
return builder.ToString();
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 7e9afb637ef14ed4b34fd226298272d5
timeCreated: 1776767993

View File

@@ -21,8 +21,8 @@ namespace Fruitomation.Game.Items
[SerializeField, InspectorReadOnly("Item Type")]
private ItemType InternalItemType = ItemType.None;
[SerializeField, InspectorReadOnly("Item Value")]
private CurrencyAmount InternalItemValue;
[SerializeField, InspectorReadOnly]
private double InternalItemValue;
public ItemType CurrentType
{
@@ -84,6 +84,16 @@ namespace Fruitomation.Game.Items
ItemInfo info = ItemInfoRegistry.Get(CurrentType);
CurrentChild = Instantiate(info.Prefab, transform);
if (info.OverrideCost)
{
InternalItemValue = info.Cost;
}
else
{
InternalItemValue = Mathf.Pow((float)InternalItemValue, 1.1f);
}
CustomBehaviour = info.GetCustomBehaviour();
if (CustomBehaviour is not null)
{
@@ -143,7 +153,6 @@ namespace Fruitomation.Game.Items
{
if (harvest)
{
ItemInfo info = ItemInfoRegistry.Get(CurrentType);
MoneyController.Add(InternalItemValue);
}

View File

@@ -70,8 +70,9 @@ namespace Fruitomation.Game.Items
[SerializeField] private CustomBehaviourType CustomBehaviour;
public bool OverrideCost;
public double Cost;
public GameObject Prefab;
public float BaseItemValue;
public CustomItemBehaviour GetCustomBehaviour()
{