void SpeedUpReset() { PlayerManager.Instance.ifspeedup = false; LevelGenerater.Instance.speedre(); MPControl.resetMPC(); ifSpeedupreseet = false; }
public void ButtonDown(Transform button) { Debug.Log("i"); print(canClick); if (canClick == false && isFinishMove == false) { return; } Vector3 scale = button.transform.localScale; button.transform.localScale = scale * 0.8f; switch (button.name) { case "MagicButton1": PlayerManager.Instance.ifspeedup = true; LevelGenerater.Instance.SpeedUp(); MPControl.decreaseMPC(0.08f); break; case "TransparencyButton": PlayerManager.Instance.TransPanrecy(); MPControl.decreaseMPC(0.15f); break; } }
public void Restart() { // SaveManager.SetCrystal(Crystals); Crystals = 0; this.gameObject.transform.position = new Vector3(-7f, 1f, this.transform.position.z); HPControl.restart(); MPControl.Reset(); }
void OnTriggerEnter(Collider other) { if (other.tag == "Obstacle") { if (other.name == "diamondpink") { other.GetComponent <Renderer>().enabled = false; other.GetComponent <BoxCollider>().enabled = false; other.GetComponent <AudioSource>().PlayOneShot(diamondsound); other.transform.FindChild("ObParticle").gameObject.GetComponent <ParticleSystem>().Play(); MPControl.increaseMP(0.005f); } else if (other.name == "diamondred") { other.GetComponent <Renderer>().enabled = false; other.GetComponent <BoxCollider>().enabled = false; other.GetComponent <AudioSource>().PlayOneShot(diamondsound); other.transform.FindChild("ObParticle").gameObject.GetComponent <ParticleSystem>().Play(); HPControl.increaseHP(0.015f); } else if (other.name == "redfire" || other.name == "bluefire") { other.GetComponent <Renderer>().enabled = false; other.GetComponent <BoxCollider>().enabled = false; other.GetComponent <AudioSource>().PlayOneShot(fire); if (other.name == "redfire") { other.transform.FindChild("redfire").GetComponent <Renderer>().enabled = false; } else { other.transform.FindChild("bluefire").GetComponent <Renderer>().enabled = false; } other.transform.FindChild("Particle System").gameObject.GetComponent <ParticleSystem>().Play(); if (canheart == true) { StartCoroutine("heart"); } HPControl.decreaseHP(0.05f); } else if (other.name == "crystalpurple" || other.name == "crystalblue" || other.name == "crystalpink") { other.GetComponent <Renderer>().enabled = false; other.GetComponent <BoxCollider>().enabled = false; other.GetComponent <AudioSource>().PlayOneShot(diamondsound); other.transform.FindChild("ObParticle").gameObject.GetComponent <ParticleSystem>().Play(); Crystals += 1; } else if (other.name == "babyghost") { other.transform.FindChild("babyghost").GetComponent <Renderer>().enabled = false; other.GetComponent <BoxCollider>().enabled = false; other.GetComponent <AudioSource>().PlayOneShot(babyghostsound); other.transform.FindChild("Particle System").gameObject.GetComponent <ParticleSystem>().Play(); if (canheart == true) { StartCoroutine("heart"); } HPControl.decreaseHP(0.15f); } else if (other.name == "floatghost") { other.transform.FindChild("floatghost").GetComponent <Renderer>().enabled = false; other.GetComponent <BoxCollider>().enabled = false; other.GetComponent <AudioSource>().PlayOneShot(floatghostsound); other.transform.FindChild("Particle System").gameObject.GetComponent <ParticleSystem>().Play(); if (canheart == true) { StartCoroutine("heart"); } HPControl.decreaseHP(0.3f); } else if (other.name == "sadakom") { if (canheart == true) { StartCoroutine("heart"); } HPControl.decreaseHP(0.5f); } } }
public void ButtonUp(Transform button) { if (canClick == false && isFinishMove == false) { return; } Vector3 scale = button.transform.localScale; button.transform.localScale = scale * 1.25f; switch (button.name) { case "StartButton": SoundManager.Instace.ButtonSound(button.name); StartCoroutine(MoveMenu(button.parent, -22, 0, 1.5f)); if (ifFB) { LevelGenerater.Instance.ReStart(); ifFB = false; } BGMManager.ingame = true; MainGUI.SetActive(true); break; case "MagicButton1": SpeedUpReset(); //PlayerManager.Instance.ifspeedup = false; //LevelGenerater.Instance.speedre(); //MPControl.resetMPC(); break; case "TransparencyButton": PlayerManager.Instance.TransBack(); MPControl.resetMPC(); ifSpeedupreseet = false; break; case "Restart": SoundManager.Instace.ButtonSound(button.name); StartCoroutine(GMoveMenu(FinishMenut.transform, FinishMenut.transform.position.x, 11f, 0.5f)); PlayerManager.Instance.Restart(); LevelGenerater.Instance.ClearMap(); LevelGenerater.Instance.ReStart(); StartCoroutine(StartToPlay()); BGMManager.ingame = true; break; case "MainMenu": SoundManager.Instace.ButtonSound(button.name); StartCoroutine(FinishToMain()); PlayerManager.Instance.Restart(); LevelGenerater.Instance.ClearMap(); MainGUI.SetActive(false); ifFB = true; SaveManager.CreatOrLoad(); DisplayTextM(BestDistanceMainMenu.GetComponent <TextMesh>(), SaveManager.GetBestDistance(), 5); break; case "SubButton": SoundManager.Instace.ButtonSound(button.name); StartCoroutine(GMoveMenu(SubMenu.transform, SubMenu.transform.position.x, 0f, 0.5f)); break; case "SubButtonI": SoundManager.Instace.ButtonSound(button.name); StartCoroutine(GMoveMenu(SubMenu.transform, SubMenu.transform.position.x, -14f, 0.5f)); break; case "quitbutton": Application.Quit(); break; } }