Files
match3-unity/Assets/Scripts/Services/LevelEntryPoint.cs
2025-12-15 02:34:59 +08:00

31 lines
947 B
C#

using Services.Interfaces;
using UnityEngine;
using VContainer.Unity;
using Views;
namespace Services
{
public class LevelEntryPoint : IStartable
{
private readonly IObjectPool<GemView> gemViewPool;
private readonly IGameBoardService gameBoardService;
private readonly IInputService inputService;
public LevelEntryPoint(IObjectPool<GemView> gemViewPool, IGameBoardService gameBoardService, IInputService inputService)
{
this.gemViewPool = gemViewPool;
this.gameBoardService = gameBoardService;
this.inputService = inputService;
}
public void Start()
{
this.gameBoardService.Setup();
this.inputService.OnSwapRequested += HandleSwapRequest;
}
private void HandleSwapRequest(Vector2Int from, Vector2Int to) {
this.gameBoardService.TrySwap(from, to);
}
}
}