Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void DestroyBubble(GameObject bubble, bool fishCaught, bool popNoise)
- {
- if(bubble.transform.childCount > 0)
- {
- fishInsideBubble = bubble.transform.GetChild(0).gameObject;
- if (fishCaught)
- {
- fishInsideBubble.GetComponent<FishSwim>().isCaught = true;
- MainGlobals.lives--;
- PlayerLives.loseLife = true;
- }
- else
- {
- fishInsideBubble.GetComponent<Rigidbody2D>().isKinematic = false;
- fishInsideBubble.GetComponent<CircleCollider2D>().enabled = true;
- ParticleSystem pS = fishInsideBubble.GetComponentInChildren<ParticleSystem>();
- ParticleSystem.EmissionModule eM = pS.emission;
- pS.Play();
- eM.enabled = true;
- pSource.PlayOneShot(pSound[1], 0.5F);
- MainGlobals.fishScore++;
- }
- }
- if (popNoise)
- {
- pSource.PlayOneShot(pSound[0], 1.0F);
- }
- bubble.transform.DetachChildren();
- Destroy(bubble);
- pop.transform.position = bubble.transform.position;
- pSys.Play();
- }
Advertisement
Add Comment
Please, Sign In to add comment