public void ChangeFruitLevelTwo(BoardLeveTwo board) { int whatTypeOfFood = Random.Range(0, board.foodSprites.Length); typeOfToken = (FoodCell.TokenType)whatTypeOfFood; foodSprite.sprite = board.foodSprites[whatTypeOfFood]; }
public IEnumerator doSolveFruitTwo(BoardLeveTwo board) { //gets the current size a the sprite being solved. float currentScale = foodSprite.transform.localScale.x; while (currentScale < fruitScaleUpSize) { //wait one frame. yield return(null); //this is how fast the sprite will grow. currentScale += 0.01f; foodSprite.transform.localScale = Vector3.one * currentScale; } //sets the foodBurst particle effect active foodBurst.gameObject.SetActive(true); //sets the new sprite to be normal size foodSprite.transform.localScale = Vector3.one; ChangeFruitLevelTwo(board); //waits for half a second before stoping the particle effect and setting it inactive yield return(new WaitForSeconds(0.5f)); //foodBurst.Stop(); foodBurst.gameObject.SetActive(false); }