装备系统做了很多
This commit is contained in:
@@ -111,6 +111,17 @@ public sealed class PlayerEconomyLedger : MonoBehaviour
|
||||
return payload.coins >= amount;
|
||||
}
|
||||
|
||||
public bool HasEnoughMaterial(long amount)
|
||||
{
|
||||
if (amount <= 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
InitializeIfNeeded();
|
||||
return payload.material >= amount;
|
||||
}
|
||||
|
||||
public void AddCoins(int amount)
|
||||
{
|
||||
if (amount <= 0)
|
||||
@@ -157,6 +168,24 @@ public sealed class PlayerEconomyLedger : MonoBehaviour
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TrySpendMaterial(int amount)
|
||||
{
|
||||
if (amount <= 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
InitializeIfNeeded();
|
||||
if (payload.material < amount)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
payload.material -= amount;
|
||||
SaveNow();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SetCoins(int value)
|
||||
{
|
||||
InitializeIfNeeded();
|
||||
|
||||
Reference in New Issue
Block a user