Exemple #1
0
        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");
        }
Exemple #2
0
        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);
            }
        }