public static void CreateCatcher(int number) { GameObject prefab = GlobalGuage.GetCatcherPrefab(); for (int i = 0; i < number; i++) { GameObject snail = (GameObject)GameObject.Instantiate(prefab); Catcher ca = snail.GetComponent <Catcher>(); ca.setLevel(); //set random position CatcherList.Add(ca); } }
// Update is called once per frame void Update() { if (!IsPlay) { return; } GameState gState = GlobalGuage.GetGameState(); if (gState == GameState.GS_PLAY) { if ((RandomHole.Count > 0) && (HoleList.Count < Game1_Leveling.GetLvling().MoleMax)) { ForceSpawn(); } } }
void catchHole() { if (targetHole != null) { if (targetHole.CatchHole()) { if (targetHole.type == MoleType.MOLE_RIGHT) { //Plus Score face.HappySnail(); Game1_Leveling.PlayScoreSound(true); //Gain EXP Game1_Leveling.AddEXP(); setLevel(); GlobalGuage.AddScore(Game1_Leveling.GetCatchMoleScore()); } else if (targetHole.type == MoleType.MOLE_WRONG) { //decrease life face.ShockSnail(); Game1_Leveling.PlayScoreSound(false); GameObject hpObj = GameObject.Instantiate(HPNotify) as GameObject; hpObj.SetActive(true); hpObj.transform.position = this.transform.position; hpObj.GetComponent <HPNotification>().DecreaseLife(1); GlobalGuage.DecreaseLife(); GlobalGuage.BrokeCombo(); } else { //Game Over GameObject hpObj = GameObject.Instantiate(HPNotify) as GameObject; hpObj.transform.position = this.transform.position; hpObj.GetComponent <HPNotification>().DecreaseLife(2); GlobalGuage.DangerMole(); } } targetHole = null; } StartCoroutine("FindHole"); }
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); } }
void Awake() { lgObject = this; }