Add initial game systems and input handling for player interactions

This commit is contained in:
2025-12-09 22:20:38 +01:00
commit 5e0db113aa
182 changed files with 70557 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
using System;
namespace Core.Systems
{
public class TimeAttackSystem : IDisposable
{
private float _timeRemaining;
private readonly float _penaltyPerDrop;
public TimeAttackSystem(float initialTime, float penaltyPerDrop = 5f)
{
_timeRemaining = initialTime;
_penaltyPerDrop = penaltyPerDrop;
GameEvents.ReportTimeUpdated(_timeRemaining);
GameEvents.PresentDropped += OnPresentDropped;
}
public void Tick(float deltaTime)
{
if (_timeRemaining <= 0) return;
_timeRemaining -= deltaTime;
if (_timeRemaining <= 0)
{
_timeRemaining = 0;
GameEvents.ReportTimeUpdated(0f);
GameEvents.ReportGameOver();
}
else
{
GameEvents.ReportTimeUpdated(_timeRemaining);
}
}
private void OnPresentDropped()
{
if (_timeRemaining > 0)
{
_timeRemaining -= _penaltyPerDrop;
}
}
public void Dispose()
{
GameEvents.PresentDropped -= OnPresentDropped;
}
}
}