Move Bomb Responsibilities to BombService

This commit is contained in:
2025-12-17 05:47:28 +08:00
parent 9f2ef833b2
commit b3dc2cb4bd
12 changed files with 262 additions and 248 deletions

View File

@@ -14,32 +14,38 @@ namespace Scopes
{
[SerializeField] private GameVariables gameVariables;
[SerializeField] private Transform gemsHolder;
[SerializeField] private Transform backgroundHolder;
protected override void Configure(IContainerBuilder builder)
{
//Register variables
builder.RegisterInstance(this.gameVariables);
builder.RegisterInstance(this.gemsHolder);
//Register component
builder.RegisterComponentInHierarchy<ScoreView>();
builder.Register<IGameBoard>(_ =>
new GameBoard(this.gameVariables.width, this.gameVariables.height),
Lifetime.Scoped);
//Register Services
builder.Register<IMatchService, MatchService>(Lifetime.Scoped);
builder.Register<IScoreService, ScoreService>(Lifetime.Scoped);
builder.Register<IBombService, BombService>(Lifetime.Scoped);
//Register Pool
builder.Register<IObjectPool<GemView>>(_ =>
new ObjectPoolService(this.gameVariables.gemsPrefabs, this.gemsHolder),
Lifetime.Scoped);
builder.Register<IBombService, BombService>(Lifetime.Scoped);
//Presenters
builder.Register<AudioPresenter>(Lifetime.Scoped);
builder.Register<ScorePresenter>(Lifetime.Scoped);
builder.Register<IGameBoardService, GameBoardService>(Lifetime.Scoped).AsImplementedInterfaces();
//Entry Point
builder.RegisterEntryPoint<LevelEntryPoint>();
}
}