void OnTriggerEnter(Collider hit) { StarController isStar = hit.GetComponent <StarController>(); if (isStar) { if (lastStar != null && lastStar.theStarType != isStar.theStarType) { Camera.main.GetComponent <CameraController>().DoScreenShake(); GameController.TriggerCometBoost(); constManager.BreakConstellation(); isStar.FadeOutStar(); ChangeColor(GameData.StarType.None); lastStar = null; } else { lastStar = isStar; isStar.StopMovement(); //isStar.starBoing.GetComponent<StarBoingController>().StartGrowing(); isStar.starBoing.gameObject.SetActive(true);//active the star boing StarController isStarStarCont = isStar.GetComponent <StarController>(); isStarStarCont.delayBeforeSecondBoingTimer = isStarStarCont.delayBeforeSecondBoingTimerBase;//start the timer for the 2nd star boing isStar.starData.Position = isStar.transform.position; ChangeColor(isStar.theStarType); constManager.AddStar(isStar.starData); AudioController.Instance.PlaySfx(SoundBank.SoundEffects.StarGood); isStar.DoBoing(); isStar.DoGotHitAnim(); FindAllStarsOfSameTypeAndBoingThem(isStar); } } if (hit.gameObject.tag == cometTag) { //KILL THE WORLD GameController.TriggerEndGame(); //spawn fireworks Instantiate(fireworksPrefab, transform.position, Quaternion.identity); Instantiate(fireworksPrefab, new Vector3(-3, 0, 0), Quaternion.identity); Instantiate(fireworksPrefab, new Vector3(3, 0, 0), Quaternion.identity); Instantiate(fireworksPrefab, new Vector3(0, 0, 0), Quaternion.identity); AudioController.Instance.PlaySfx(SoundBank.SoundEffects.ConstellationBroken); var colliders = gameObject.GetComponents <Collider>(); lastStar = null; canMove = false; constManager.BreakConstellation(); AudioController.Instance.PlaySfx(SoundBank.SoundEffects.ConstellationComplete, (int)SoundBank.SoundEffects.ConstellationBroken); for (int i = 0; i < colliders.Length; i++) { colliders[i].enabled = false; } //gameObject.SetActive(false); } }