public static void ClearCatcher() { foreach (Catcher snail in CatcherList) { if (snail.LastestHole != null) { MoleSpawner.ReleaseHole(snail.LastestHole); } DestroyObject(snail.gameObject); } CatcherList.Clear(); }
IEnumerator DestroyHole() { IsPop = false; LockOn.SetActive(false); MoleAnimator = GetComponent <Animator> (); GetComponent <AudioSource>().PlayOneShot(hitSound[Random.Range(0, 2)]); MoleAnimator.Play("HoleTouch"); if (type == MoleType.MOLE_RIGHT) { Catcher.BoringCatcher(); //catcher make bored face here GameObject hpObj = GameObject.Instantiate(HPNortify) as GameObject; hpObj.SetActive(true); hpObj.transform.position = this.transform.position; hpObj.GetComponent <HPNotification>().DecreaseLife(1); GlobalGuage.DecreaseLife(); GlobalGuage.BrokeCombo(); } else { GlobalGuage.AddScore(Game1_Leveling.GetTouchMoleScore()); GlobalGuage.AddCombo(); } while ((MoleAnimator != null) && MoleAnimator.GetCurrentAnimatorStateInfo(0).IsName("HolePop")) { yield return(null); } if (MoleAnimator == null) { yield break; } yield return(StartCoroutine(Wait(MoleAnimator.GetCurrentAnimatorStateInfo(0).length))); MoleSpawner.DestroyHole(this); if (!IsLock) { MoleSpawner.ReleaseHole(this); } }
IEnumerator DestroyCountHole() { //calculate score here IsPop = false; GlobalGuage.BrokeCombo(); MoleAnimator = GetComponent <Animator> (); MoleAnimator.Play("HoleDepop"); while ((MoleAnimator != null) && MoleAnimator.GetCurrentAnimatorStateInfo(0).IsName("HolePop")) { yield return(null); } if (MoleAnimator == null) { yield break; } yield return(StartCoroutine(Wait(MoleAnimator.GetCurrentAnimatorStateInfo(0).length))); MoleSpawner.DestroyHole(this); if (!IsLock) { MoleSpawner.ReleaseHole(this); } }
IEnumerator Idle() { idle = true; Animator anim = GetComponent <Animator> (); anim.Play("SnailIdle"); yield return(StartCoroutine(Wait(idleTime))); if (targetHole.IsPop) { idle = false; if (LastestHole != null) { MoleSpawner.ReleaseHole(LastestHole); } LastestHole = targetHole; StartCoroutine("Moveto", targetHole); } else { targetHole = null; StartCoroutine("FindHole"); } }