33 lines
775 B
C#
33 lines
775 B
C#
using UnityEngine;
|
|
using Code.Gameplay.Player;
|
|
|
|
namespace Code.Gameplay.Management
|
|
{
|
|
public class GameSpeedManager : MonoBehaviour
|
|
{
|
|
[SerializeField] private PlayerController playerController;
|
|
[SerializeField] private float speedMultiplier = 1.2f;
|
|
[SerializeField] private float timeInterval = 10f;
|
|
|
|
private float _timer;
|
|
|
|
private void Update()
|
|
{
|
|
_timer += Time.deltaTime;
|
|
|
|
if (_timer >= timeInterval)
|
|
{
|
|
AccelerateGame();
|
|
_timer = 0;
|
|
}
|
|
}
|
|
|
|
private void AccelerateGame()
|
|
{
|
|
if (playerController)
|
|
{
|
|
playerController.IncreaseSpeed(speedMultiplier);
|
|
}
|
|
}
|
|
}
|
|
} |