// Update is called once per frame void Update() { if (pollenCounter >= maxPollen) { if (flowerType == Flower.White) { addToScore.Invoke(3); } else { addToScore.Invoke(1); } audioSource.Stop(); player.StopCollect(); //Check if this is the last flower if (GameObject.FindGameObjectsWithTag("Flower").Length == 1) { manager.GetComponent <SpawnFlowers>().SpawnFlowerField(); } EmitPollen(); GameObject.Destroy(this.gameObject); } }
// Update is called once per frame void Update() { if (shakeCounter >= maxShake && inRange) { convertToScore.Invoke(); shakeCounter = 0; lightBeam.SetActive(false); inRange = false; player.StopCollect(); audioSource.Stop(); } }