Assign GemSprite to BombPrefab

This commit is contained in:
2025-12-17 00:28:22 +08:00
parent de2de35b1b
commit 9f9bf9a3f5
6 changed files with 136 additions and 26 deletions

View File

@@ -83,11 +83,12 @@ namespace Services {
GemView gemView = this.objectPool.Get(gemType, position, this.gameVariables.dropHeight);
gemView.name = "Gem - " + position.x + ", " + position.y + ' ' + gemType;
GemTypeValues gemValue = GemUtils.GetGemValues(gemType, this.gameVariables.gemsPrefabs);
// If we randomly spawned a bomb, give it a random color group (so it can match by color).
int scoreValue = GemUtils.GetGemValues(gemType, this.gameVariables.gemsPrefabs).scoreValue;
Gem gem = new Gem(gemType, position, scoreValue);
Gem gem = new Gem(gemType, position, gemValue);
gemView.Bind(gem);
gemView.Bind(gem, gemValue);
this.gemPresenters.Add(new GemPresenter(gem, gemView));
SetGem(new Vector2Int(position.x, position.y), gem);
@@ -99,10 +100,11 @@ namespace Services {
GemView gemView = this.objectPool.Get(GemType.Bomb, position, 0);
gemView.name = "Bomb - " + position.x + ", " + position.y + ' ' + GemType.Bomb;
GemTypeValues gemValue = GemUtils.GetGemValues(color, this.gameVariables.gemsPrefabs);
int scoreValue = GemUtils.GetGemValues(color, this.gameVariables.gemsPrefabs).scoreValue;
Gem bombGem = new Gem(GemType.Bomb, position, scoreValue, color);
gemView.Bind(bombGem, isBomb: true);
Gem bombGem = new Gem(GemType.Bomb, position, gemValue, color);
gemView.Bind(bombGem, gemValue, isBomb: true);
this.gemPresenters.Add(new GemPresenter(bombGem, gemView));
SetGem(position, bombGem);