(Feat) Add build cost
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using UnityEngine;
|
||||
using Ashwild.Audio;
|
||||
using Ashwild.Building;
|
||||
using Ashwild.Harvesting;
|
||||
using Ashwild.Interaction;
|
||||
using Ashwild.Inventory;
|
||||
@@ -135,6 +137,7 @@ namespace Ashwild.Player
|
||||
public static event Action<bool> BuildMenuOpenChanged; // the construction menu opened (true) or closed (false)
|
||||
public static event Action<bool> BuildPlacingChanged; // a build ghost started (true) / stopped (false) being positioned
|
||||
public static event Action<bool> DemolishModeChanged; // the hammer entered (true) / left (false) demolition mode (right-click held)
|
||||
public static event Action<IReadOnlyList<BuildCostView>> BuildCostChanged; // the active build's cost to display near the crosshair (null/empty = clear)
|
||||
|
||||
// ============================================================
|
||||
// Cooking events
|
||||
@@ -305,6 +308,17 @@ namespace Ashwild.Player
|
||||
BuildPlacingChanged?.Invoke(placing);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Publishes the active build's cost lines for the crosshair to render (or a null/empty list to
|
||||
/// clear it). Owner-side only; BuildManager re-raises it live as the inventory changes so the
|
||||
/// affordability colouring stays current while a piece is being positioned.
|
||||
/// </summary>
|
||||
public static void RaiseBuildCostChanged(IReadOnlyList<BuildCostView> cost)
|
||||
{
|
||||
Log(nameof(BuildCostChanged));
|
||||
BuildCostChanged?.Invoke(cost);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Toggles demolition mode (right-click held with the hammer out). Owner-side only; the
|
||||
/// hammer raises it and BuildManager drives the world-facing targeting/destroy from it.
|
||||
|
||||
Reference in New Issue
Block a user