void GameStart() { Game1_Leveling.ResetGame(gController.mainMenu.Item4.IsSelect); // MoleSpawner.ClearHole (); MoleSpawner.GameStart(); Catcher.CreateCatcher(snailCount); }
public void startHole() { MoleAnimator = GetComponent <Animator> (); Debug.Log("HoleStart"); MoleAnimator.Play("HoleStart"); //random Tag SnailLeveling lvl = Game1_Leveling.GetLvling(); float randomTag = Random.Range(0.0f, lvl.RightMoleRate + lvl.WrongMoleRate + lvl.DangerMoleRate); if (randomTag < lvl.RightMoleRate) { type = MoleType.MOLE_RIGHT; MoleTag.SetTagIdx(type); } else if (randomTag > lvl.RightMoleRate + lvl.WrongMoleRate) { //IsDangerMole type = MoleType.MOLE_DANGER; MoleTag.SetTagIdx(type); } else { //wrong mole type = MoleType.MOLE_WRONG; MoleTag.SetTagIdx(type); } StartCoroutine("PopMole"); }
public void ChangeShell(ShellType shell) { SpriteRenderer spr = GetComponent <SpriteRenderer> (); Sprite[] shellSpriteList = Game1_Leveling.GetShellList(); switch (shell) { case ShellType.SHELL_CAN: { spr.sprite = shellSpriteList[0]; } break; case ShellType.SHELL_NORMAL: { spr.sprite = shellSpriteList[1]; } break; case ShellType.SHELL_TEMPLE: { spr.sprite = shellSpriteList[2]; } break; case ShellType.SHELL_SPIKE: { spr.sprite = shellSpriteList[3]; } break; case ShellType.SHELL_WING: { spr.sprite = shellSpriteList[4]; } break; } }
public void setLevel() { SnailLeveling lvl = Game1_Leveling.GetLvling(); speed = lvl.CatcherSpeed / 100.0f; idleTime = lvl.CatcherIdleTime; shell.ChangeShell(Game1_Leveling.GetLvling().Shell); }
public static void BoringCatcher() { Game1_Leveling.PlayScoreSound(false); foreach (Catcher snail in CatcherList) { snail.face.BoredSnail(); } }
// 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(); } } }
IEnumerator PopMole() { MoleAnimator = GetComponent <Animator> (); waitTime = Random.Range(Game1_Leveling.GetLvling().MinWaitTime, Game1_Leveling.GetLvling().MaxWaitTime); yield return(StartCoroutine(Wait(waitTime))); Debug.Log("HolePop"); MoleAnimator.Play("HolePop"); yield return(StartCoroutine(Wait(0.1f))); yield return(StartCoroutine(Wait(MoleAnimator.GetCurrentAnimatorStateInfo(0).length - 0.1f))); Debug.Log("HolePop : Get State Info"); IsPop = true; if (type != MoleType.MOLE_RIGHT) { StartCoroutine("Countdown"); } }
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); } }
// Use this for initialization void Awake() { GameLvlingObject = this; ResetGame(); }