Files
max-effort/Code/Core/EventBus.cs

30 lines
1.6 KiB
C#

using System;
using MaxEffort.Code.Data;
namespace MaxEffort.Code.Core;
public static class EventBus
{
public static event Action<float> OnLiftEffortApplied; // Player pressed space
public static event Action OnFocusRelease; // Player stopped to look around
public static event Action<float> OnFocusChanged; // 0.0 to 1.0 (Tunnel Intensity)
public static event Action<bool> OnLiftCompleted; // true = Success, false = Fail
public static event Action<float> OnLiftProgress; // 0.0 to 1.0 (Lift Progress)
public static event Action<float> OnLiftVisualHeight;
public static event Action<float> OnCameraTrauma;
public static event Action<HazardType> OnHazardSpawned;
public static event Action<HazardType> OnHazardResolved;
public static void PublishLiftEffortApplied(float strength) => OnLiftEffortApplied?.Invoke(strength);
public static void PublishFocusChanged(float intensity) => OnFocusChanged?.Invoke(intensity);
public static void PublishLiftCompleted(bool success) => OnLiftCompleted?.Invoke(success);
public static void PublishLiftProgress(float progress) => OnLiftProgress?.Invoke(progress);
public static void PublishFocusRelease() => OnFocusRelease?.Invoke();
public static void PublishHazardSpawned(HazardType type) => OnHazardSpawned?.Invoke(type);
public static void PublishHazardResolved(HazardType type) => OnHazardResolved?.Invoke(type);
public static void PublishLiftVisualHeight(float height) => OnLiftVisualHeight?.Invoke(height);
public static void PublishCameraTrauma(float trauma) => OnCameraTrauma?.Invoke(trauma);
}