11using Cysharp . Threading . Tasks ;
22
33
4+ public interface IBoostExicuter
5+ {
6+ UniTask Execute ( IBoostItem boostItem ) ;
7+ UniTask Execute ( IItem item , ToolTypes toolTypes ) ;
8+ }
9+
410
5- public class BoostExicuter
11+ public class BoostExicuter : IBoostExicuter
612{
713 private IBoostAction _horisontal ;
814 private IBoostAction _vertical ;
@@ -13,44 +19,46 @@ public class BoostExicuter
1319
1420 private BoardClearer _boardClearer ;
1521
16- public BoostExicuter ( ItemNextStateMover itemRemover , Board board , GoalCellOnBoardFinder goalItemFinder )
22+ public BoostExicuter ( Board board , GoalCellOnBoardFinder goalItemFinder )
1723 {
18- _horisontal = new HorizontalLineRemover ( board , itemRemover , this ) ;
19- _vertical = new VerticalLineRemover ( board , itemRemover , this ) ;
20- _bomb = new BombBoostAction ( board , itemRemover , this ) ;
21- _rainbow = new RainbowBoostAction ( board , itemRemover , this ) ;
22- _rocket = new RocketBoostAction ( board , goalItemFinder , itemRemover , this ) ;
23- _xlines = new XLineRemover ( board , itemRemover , this ) ;
24+ _horisontal = new HorizontalLineRemover ( board , this ) ;
25+ _vertical = new VerticalLineRemover ( board , this ) ;
26+ _bomb = new BombBoostAction ( board , this ) ;
27+ _rainbow = new RainbowBoostAction ( board , this ) ;
28+ _rocket = new RocketBoostAction ( board , goalItemFinder , this ) ;
29+ _xlines = new XLineRemover ( board , this ) ;
2430
2531 _boardClearer = new ( board ) ;
2632 }
2733
28- public async UniTask Execute ( IItem item )
34+ public async UniTask Execute ( IBoostItem boostItem )
2935 {
30- if ( item is IBoostItem boostItem )
36+ if ( boostItem . IsUsed == true )
37+ {
38+ return ;
39+ }
40+
41+ boostItem . IsUsed = true ;
42+
43+ switch ( boostItem . GetBoostType ( ) )
3144 {
32- switch ( boostItem . GetBoostType ( ) )
33- {
34- case BoostTypes . None :
35- break ;
36- case BoostTypes . Bomb :
37- await _bomb . Execute ( boostItem ) ;
38- break ;
39- case BoostTypes . Horizontal :
40- await _horisontal . Execute ( boostItem ) ;
41- break ;
42- case BoostTypes . Vertical :
43- await _vertical . Execute ( boostItem ) ;
44- break ;
45- case BoostTypes . Rainbow :
46- await _rainbow . Execute ( boostItem ) ;
47- break ;
48- case BoostTypes . Rocket :
49- await _rocket . Execute ( boostItem ) ;
50- break ;
51- default :
52- break ;
53- }
45+ case BoostTypes . None :
46+ break ;
47+ case BoostTypes . Bomb :
48+ await _bomb . Execute ( boostItem ) ;
49+ break ;
50+ case BoostTypes . Horizontal :
51+ await _horisontal . Execute ( boostItem ) ;
52+ break ;
53+ case BoostTypes . Vertical :
54+ await _vertical . Execute ( boostItem ) ;
55+ break ;
56+ case BoostTypes . Rainbow :
57+ await _rainbow . Execute ( boostItem ) ;
58+ break ;
59+ case BoostTypes . Rocket :
60+ await _rocket . Execute ( boostItem ) ;
61+ break ;
5462 }
5563
5664 _boardClearer . ClearBordFromDeadItems ( ) ;
0 commit comments