feat(economy): add Bestellsystem mit Lieferzeit
- SupplierService: Bestellungen mit Lieferzeit-Berechnung - OrderTerminal: Spieler-Interaktion zum Aufgeben von Bestellungen - StorageCrateRegistry + StorageCrate.Restock: Server registriert Kisten und füllt sie bei Lieferung wieder auf - GameClock.TotalHours: durchgehende Spielzeit für Lieferzeit-Berechnung - ROADMAP: Bestellsystem-Punkt als erledigt markiert Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using AfterHours.Data;
|
||||
using AfterHours.Economy;
|
||||
using AfterHours.Interaction;
|
||||
using Unity.Netcode;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AfterHours.Shop
|
||||
{
|
||||
/// <summary>
|
||||
/// Backroom-Terminal zum Nachbestellen eines festen Produkts beim
|
||||
/// Großhandel. Produkt/Menge sind pro Instanz im Inspector konfiguriert.
|
||||
/// </summary>
|
||||
public sealed class OrderTerminal : NetworkBehaviour, IInteractable
|
||||
{
|
||||
[SerializeField] private ProductCatalog _catalog;
|
||||
[SerializeField] private int _productId = -1;
|
||||
[SerializeField] private int _orderQuantity = 50;
|
||||
|
||||
public string GetPrompt(ulong clientId)
|
||||
{
|
||||
var product = _catalog.Get(_productId);
|
||||
string name = product != null ? product.DisplayName : "?";
|
||||
float cost = product != null ? product.WholesalePrice * _orderQuantity : 0f;
|
||||
return $"{name} nachbestellen ({_orderQuantity} Stk. — {cost:0.00} €)";
|
||||
}
|
||||
|
||||
/// <summary>Server: löst eine Bestellung beim SupplierService aus.</summary>
|
||||
public void Interact(NetworkObject actor)
|
||||
{
|
||||
if (!IsServer) return;
|
||||
SupplierService.Instance?.PlaceOrder(_productId, _orderQuantity);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user