public override void OnUpdate() { foreach (PowerupData powerup in powerups) { if (powerup.item.IsJustPressed()) { if (selected == powerup) { if (PlayerData.Instance.Coins >= powerup.price && powerup.GetCount() < 9) { powerup.Buy(); PlayerData.Instance.Coins -= powerup.price; PlayerData.Instance.Save(); UpdateMessage(); } } else { Select(powerup); } break; } } if (backButton.IsJustPressed() || Input.GetKeyDown(KeyCode.Escape)) { CoinsCounter.Instance.AnimateOut(); MenuManager.Instance.SetPage(MenuManager.Instance.shopPage); } }
public override void OnUpdate() { if (musicItem.IsJustPressed()) { musicCheckbox.enabled = !musicCheckbox.enabled; PlayerData.Instance.option_music = musicCheckbox.enabled; MenuManager.Instance.GetComponent <AudioSource>().enabled = musicCheckbox.enabled; } else if (soundItem.IsJustPressed()) { PlayerData.Instance.option_sound = !PlayerData.Instance.option_sound; soundCheckbox.enabled = PlayerData.Instance.option_sound; } else if (accelerometerItem.enabled && accelerometerItem.IsJustPressed()) { PlayerData.Instance.option_accelerometer = !PlayerData.Instance.option_accelerometer; accelerometerCheckbox.enabled = PlayerData.Instance.option_accelerometer; } else if (statsItem.IsJustPressed()) { ((StatsPage)MenuManager.Instance.statsPage).UpdateStats(); MenuManager.Instance.SetPage(MenuManager.Instance.statsPage); } else if (backButton.IsJustPressed() || Input.GetKeyDown(KeyCode.Escape)) { PlayerData.Instance.Save(); MenuManager.Instance.SetPage(MenuManager.Instance.mainPage, true, false); } }
public override void OnUpdate() { foreach (BabyInShop baby in babies) { if (baby.GetMenuItem().IsJustPressed()) { if (currentBaby == baby) { //Buy if (currentBaby.GetBaby().IsUnlocked() && !currentBaby.GetBaby().IsBought() && PlayerData.Instance.Coins >= currentBaby.Price) { PlayerData.Instance.BuyBaby((int)currentBaby.GetBaby().baby, currentBaby.Price); currentBaby.ShowPrice(false); currentBaby.SetShadowed(false); currentBaby.GetBaby().Idle(); currentBaby.message.enabled = true; HiddenMessageText.enabled = false; SetMessage(null); } } else { Select(baby); } } } if (backButton.IsJustPressed() || Input.GetKeyDown(KeyCode.Escape)) { CoinsCounter.Instance.AnimateOut(); MenuManager.Instance.SetPage(MenuManager.Instance.shopPage); } }
public override void OnUpdate() { if (backButton.IsJustPressed() || Input.GetKeyDown(KeyCode.Escape)) { MenuManager.Instance.SetPage(MenuManager.Instance.optionsPage); } }
void Update() { switch (state) { case eState.OUT: break; case eState.DROPPED: { float fPerc = GetStateTime() / 0.3f; transform.position = src + (dest - src) * fPerc; float scale = (0.6f - Mathf.Sin(fPerc * Mathf.PI) * 0.4f); transform.localScale = Vector3.one * scale; if (fPerc >= 1.0f) { if (living) { living.Reset(); living.enabled = true; } SetState(eState.IDLE); menuItem.enabled = true; } break; } case eState.IDLE: if (menuItem.IsJustPressed()) { Collected(); } else if (GetStateTime() > 2.0f) { Discarded(); } break; case eState.COLLECTED: { float fPerc = GetStateTime() / 0.3f; transform.position = src + (dest - src) * fPerc; float scale = (0.6f - fPerc * 0.4f); transform.localScale = Vector3.one * scale; if (fPerc >= 1.0f) { Score.Instance.PrizeCollected(coins); ToPool(); } break; } } }
public void CheckGameplayInput() { if (FeederGloves.IsJustPressed()) { //Gameplay_Normal.FeederGlovesPressed(); FeederGloves.gameObject.SetActive(false); } if (BoletTime.menuItem.IsJustPressed()) { //Gameplay_Normal.BoletTimePressed(); PlayerData.Instance.powerup_boletTime -= 1; PlayerData.Instance.Save(); BoletTime.gameObject.SetActive(false); } }
public override void OnUpdate() { foreach (UpgradeData upgrade in upgrades) { if (upgrade.item.IsJustPressed()) { if (selected == upgrade && selected.CanBuy()) { if (PlayerData.Instance.Coins >= selected.price) { selected.Buy(); UpdateMessage(); //Update all the visuals (because of prerequisites) foreach (UpgradeData upgradeVis in upgrades) { if (!upgradeVis.IsBought() && upgradeVis.prerequisite) { upgradeVis.UpdateVisual(); } } PlayerData.Instance.Coins -= selected.price; PlayerData.Instance.Save(); } } else { Select(upgrade); } return; } } /* * if(InputManager.Instance.IsTouch) * { * Select(upgrades[0]); * } */ if (backButton.IsJustPressed() || Input.GetKeyDown(KeyCode.Escape)) { CoinsCounter.Instance.AnimateOut(); MenuManager.Instance.SetPage(MenuManager.Instance.shopPage); } }
void Update() { if (ResumeButton.IsJustPressed()) { Pause(false); } else if (ExitButton.IsJustPressed()) { Pause(false); Gameplay_Normal.Instance.ExitFromPause(); LevelManager.Instance.ExitFromPause(); Rainbow.Instance.SetValue(0); } else { return; } }
void Update() { if (PauseManager.Instance.IsPaused()) { return; } if (Input.GetKeyDown(KeyCode.Escape)) { Application.Quit(); } if (PauseButton.IsJustPressed()) { PauseManager.Instance.Pause(true); } //Update current state stateTime += Time.deltaTime; SendMessage("Update_" + state.ToString()); }
public override void OnUpdate() { if (babies.IsJustPressed()) { CoinsCounter.Instance.AnimateOut(); MenuManager.Instance.SetPage(MenuManager.Instance.babiesPage); } else if (upgrades.IsJustPressed()) { CoinsCounter.Instance.AnimateOut(); MenuManager.Instance.SetPage(MenuManager.Instance.upgradesPage); } else if (powerups.IsJustPressed()) { CoinsCounter.Instance.AnimateOut(); MenuManager.Instance.SetPage(MenuManager.Instance.powerupsPage); } else if (backButton.IsJustPressed() || Input.GetKeyDown(KeyCode.Escape)) { CoinsCounter.Instance.AnimateOut(); MenuManager.Instance.SetPage(MenuManager.Instance.mainPage, true, false); } }
public override void OnUpdate () { if(PlayPressed) { if(IsAnimationFinished()) { Application.LoadLevel("Level"); } return; } if (Input.GetKeyDown(KeyCode.Escape)) { Application.Quit(); } if(playButton.IsJustPressed()) { Animate("StartGame"); MenuManager.Instance.MusicFadeOut(); PlayPressed = true; } else if(optionsButton.IsJustPressed()) { MenuManager.Instance.SetPage(MenuManager.Instance.optionsPage, false, true); } else if(shopButton.IsJustPressed()) { CoinsCounter.Instance.gameObject.SetActive(true); MenuManager.Instance.SetPage(MenuManager.Instance.shopPage, false, true); } else if(pedestalButton.IsJustPressed()) { MenuManager.Instance.SetPage(MenuManager.Instance.museumPage, false, true); } }