Update Project
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using UnityEngine;
|
||||
using Zenject;
|
||||
using FlappyBird.Core;
|
||||
|
||||
namespace FlappyBird.Gameplay.Pipes
|
||||
{
|
||||
/// <summary>
|
||||
/// Thin MonoBehaviour ticker — the only pipe-related MonoBehaviour in the scene.
|
||||
/// Responsibilities:
|
||||
/// - Forward Update to IPipeSpawner.Tick
|
||||
/// NO spawn logic lives here.
|
||||
/// </summary>
|
||||
public sealed class PipeSpawnerTicker : MonoBehaviour
|
||||
{
|
||||
private IPipeSpawner _spawner;
|
||||
private IGameStateManager _gameStateManager;
|
||||
|
||||
[Inject]
|
||||
private void Construct(IPipeSpawner spawner, IGameStateManager gameStateManager)
|
||||
{
|
||||
_spawner = spawner;
|
||||
_gameStateManager = gameStateManager;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_gameStateManager.CurrentState != GameState.Playing) return;
|
||||
_spawner.Tick(Time.deltaTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user