void CreateMatrix() { for (int i = 0; i < _rows; ++i) { for (int j = 0; j < _columns; ++j) { CandyType newCandyType = RandomGenerator.NextCandy(); while (CheckHorizontal(newCandyType, i, j) || CheckVertical(newCandyType, i, j)) { newCandyType = RandomGenerator.NextCandy(); } _candies[i][j] = ((GameObject)Instantiate(Resources.Load(newCandyType.ToString()), _placeHolders[i][j], Quaternion.identity)).GetComponent <Candy>(); _candies[i][j].gameObject.name = i.ToString() + "_" + j.ToString(); _candies[i][j].transform.parent = transform; } } if (CheckForMatches()) { var candies = GetAllCandies(); foreach (var candy in candies) { Destroy(candy.gameObject); } CreateMatrix(); } }
public void ShowNoti(CandyType type, int count, float gold) { Index++; GameObject txt = _UIPooler.SpawnWithNewParent(NOTI, GameplayUI.transform, GameplayUI.transform.position, Quaternion.identity); TextFadeVFX fade = txt.GetComponent <TextFadeVFX>(); fade.StartVFX("Match " + count + " " + type.ToString() + " Claim" + gold, Index); if (Index == 3) { Index = 0; } }
public CandyInfo(CandyType type) { Id = (int)type; Name = type.ToString(); Image = $"img/{type.ToString().ToLower()}.png"; }
public override void Print() { base.Print(); Console.WriteLine(CandyType.ToString().ToLower() + " " + Name + " Weight: " + Weight + " Calories: " + Calories + " Sugar: " + Sugar); }