maint: added livewatch asset

This commit is contained in:
Chris
2025-08-31 18:14:07 -04:00
parent 7f5d95787b
commit ae2371a6fa
385 changed files with 150792 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
using System;
using UnityEngine;
namespace Ingvar.LiveWatch.TowerDefenceDemo
{
public class GameSpeedManager : MonoBehaviour
{
public event Action SpeedChanged;
public SpeedMode CurrentSpeed
{
get => _currentSpeed;
protected set
{
if (_currentSpeed == value)
return;
_currentSpeed = value;
SpeedChanged?.Invoke();
}
}
private SpeedMode _currentSpeed;
public void SetDefaultSpeed()
{
SetGameSpeed(SpeedMode.x1);
}
public void SetGameSpeed(SpeedMode mode)
{
Time.timeScale = mode switch
{
SpeedMode.x1 => 1,
SpeedMode.x2 => 2,
SpeedMode.x4 => 4,
_ => throw new ArgumentOutOfRangeException(nameof(mode), mode, null)
};
CurrentSpeed = mode;
}
}
public enum SpeedMode
{
x1,
x2,
x4
}
}