Exemplo n.º 1
0
    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();
        }
    }
Exemplo n.º 2
0
    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;
        }
    }
Exemplo n.º 3
0
 public CandyInfo(CandyType type)
 {
     Id    = (int)type;
     Name  = type.ToString();
     Image = $"img/{type.ToString().ToLower()}.png";
 }
Exemplo n.º 4
0
 public override void Print()
 {
     base.Print();
     Console.WriteLine(CandyType.ToString().ToLower() + " " + Name + " Weight: " + Weight + " Calories: " + Calories + " Sugar: " + Sugar);
 }