public void Spawn(GemTypeSO gemType) { _particle.textureSheetAnimation.RemoveSprite(0); _particle.textureSheetAnimation.AddSprite(gemType.Sprite); this.gameObject.SetActive(true); _particle.Play(); }
public void ExplodeGems(BackToBackCount gemCount) { if (gemCount.HasEnoughHorizontalToMatch()) { // TODO - collect type of gems to use as power foreach (Gem gem in gemCount.horizontalGems) { if (gem.gemTypeSO.GemType != GemType.Empty) { Instantiate(gemExplosion, gem.transform.position, gem.transform.rotation); count++; if (color != gem.gemTypeSO.GemColor) { color = gem.gemTypeSO.GemColor; } } GemTypeSO gemTypeSO = new GemTypeSO(); gemTypeSO.GemType = GemType.Empty; gemTypeSO.GemColor = GemColor.Empty; gem.SetType(gemTypeSO); } } if (gemCount.HasEnoughVerticalToMatch()) { // TODO - collect type of gems to use as power foreach (Gem gem in gemCount.verticalGems) { if (gem.gemTypeSO.GemType != GemType.Empty) { Instantiate(gemExplosion, gem.transform.position, gem.transform.rotation); count++; if (color != gem.gemTypeSO.GemColor) { color = gem.gemTypeSO.GemColor; } } GemTypeSO gemTypeSO = new GemTypeSO(); gemTypeSO.GemType = GemType.Empty; gemTypeSO.GemColor = GemColor.Empty; gem.SetType(gemTypeSO); } } if (count > 0) { PlayerPowerups(count, color); count = 0; } }
public void Setup(GridManager grid, Vector3 initialPosition = default, GemTypeSO gemType = null, GridSlot initialSlot = null) { _gridManager = grid; this.transform.position = initialPosition; this.gameObject.SetActive(true); if (gemType != null) { this.SetGemType(gemType); } if (initialSlot != null) { this.GoToSlot(initialSlot); } }
public void SetGemType(GemTypeSO newType) { _spriteRenderer.sprite = newType.Sprite; this.Type = newType.Type; }
public void SetType(GemTypeSO gemScriptableObject) { gemTypeSO = gemScriptableObject; gameObject.GetComponent <SpriteRenderer>().sprite = gemScriptableObject.Sprite; }
public void SpawnObj(GemTypeSO gemType, Vector3 position) { this.SpawnObj(position).Spawn(gemType); }