/* * * SpetialClip Hints * * El SC (SpetialClip) 2 = El de cuando aparece despues de cogerlo * El SC 3 = El de cuando coges el objeto * * */ // Start is called before the first frame update void Start() { Available = true; _audioDB = GameObject.FindObjectOfType <AudioDB>(); //_audioSource = GetComponent<AudioSource>(); StartCoroutine(Wait4GetComponents()); }
public void Next() { AudioController.PlaySound(AudioDB.FindClip("click")); index++; //Disable old objs if (objs != null) { foreach (GameObject obj in objs) { obj.SetActive(false); } } if (index < item.actions.Length) { desc.text = item.actions[index].desc; objs = item.actions[index].enableObj; foreach (GameObject obj in item.actions[index].enableObj) { obj.SetActive(true); } if (index == item.actions.Length - 1) { button.text = "Close"; } } else { StopTutorial(); } }
public PlaylistManager(AudioDB.AudioDataContext audioDB) { aDB = audioDB; if (!aDB.DatabaseExists()) { throw new Exception("Database does not exist"); } LoadDefault(); }
public void OnPointerClick(PointerEventData eventData) { if (App.Instance.stats.money >= actualPrice) { App.Instance.stats.money -= actualPrice; AudioController.PlaySound(AudioDB.FindClip("purchase_good")); } else { AudioController.PlaySound(AudioDB.FindClip("purchase_fail")); return; } switch (change) { case "iap": App.Instance.stats.iapUpgrade += (int)value; actualPrice = (int)(price * App.Instance.stats.iapUpgrade * Mathf.PI); break; case "press": App.Instance.stats.pressUpgrade += (int)value; actualPrice = price * App.Instance.stats.pressUpgrade; break; case "hunger": App.Instance.stats.metabolismUpgrades += (int)value; actualPrice = price * App.Instance.stats.metabolismUpgrades; break; case "marketing": App.Instance.stats.marketing += value; actualPrice = (int)Mathf.Pow(price, App.Instance.stats.marketing + 1); break; case "rent": App.Instance.stats.rent -= value; actualPrice = (int)Mathf.Pow(price, App.Instance.stats.rent + 1); break; case "app": App.Instance.stats.appEarnings += value; actualPrice = (int)Mathf.Pow(price, App.Instance.stats.appEarnings + 1); break; case "food": App.Instance.stats.food = Mathf.Clamp(App.Instance.stats.food + value, 0, App.Instance.stats.maxFood); break; } }
public void CreateGame() { bool stop = false; if (string.IsNullOrEmpty(iap.current.name) && business_model.current.name == "Freemium") { stop = true; iapErrorMessage.SetActive(true); } if (string.IsNullOrEmpty(name.text)) { nameErrorMessage.SetActive(true); stop = true; } if (stop) { return; } string _name = name.text; string bm = business_model.current.name; string _iap = iap.current.name; string _scope = scope.current.name; int _price = 0; if (!string.IsNullOrEmpty(price.text)) { int.TryParse(price.text, out _price); } App.Instance.currentGame = new App.Game(_name, _iap, bm, _scope, _price); //goto computer computer.SetActive(true); App.Instance.typing = true; gameObject.SetActive(false); App.Instance.uiManager.shopMenu.SetActive(false); App.Instance.uiManager.gameMenu.SetActive(false); AudioController.PlaySound(AudioDB.FindClip("click")); }
private void Start() { Load(); //Find references uiManager = FindObjectOfType <UIManager>(); spawner = FindObjectOfType <Spawner>(); player = FindObjectOfType <PlayerController>(); shake = FindObjectOfType <ShakeBehavior>(); upgradeDatabase = FindObjectOfType <UpgradeDatabase>(); audioDB = FindObjectOfType <AudioDB>(); musicPlayer = FindObjectOfType <MusicPlayer>(); animations = FindObjectOfType <UIAnimation>(); pool = FindObjectOfType <PoolManager>(); uiManager.SwitchUI(UIManager.UIType.menu, false); streak = new List <Vector3>(); }
public void OpenGameMenu() { AudioController.PlaySound(AudioDB.FindClip("click")); if (App.Instance.tut.CurrentActive == "games_open") { App.Instance.tut.StopTutorial(); } if (App.Instance.tut.CurrentActive == "welcome") { App.Instance.tut.StartTutorial("games_open"); } if (ShopOpen) { shopMenu.SetActive(false); blueButton.text = "Shop"; } if (GameMenuOpen) { gameMenuButton.text = "Games"; } else { gameMenuButton.text = "Back"; } if (App.Instance.typing) { if (string.IsNullOrEmpty(App.Instance.currentGame.name)) { App.Instance.currentGame.progress += ComputerUI.index; } App.Instance.typing = false; computer.SetActive(false); createCoverMenu.SetActive(false); } ChangeGreenButtonText(); gameMenu.SetActive(!GameMenuOpen); }
public static ClipSettings GetClip(string clip) { AudioDB adb = ScriptableObject.CreateInstance <AudioDB>(); adb = (AudioDB)Resources.Load <AudioDB>("AudioDB"); foreach (Clip item in adb.sound) { if (item.name == clip) { SoundClip sc = new SoundClip(clip); return(sc); } } foreach (Clip item in adb.music) { if (item.name == clip) { MusicClip mc = new MusicClip(clip); return(mc); } } Debug.LogWarning("Clip '" + clip + "' not found."); return(null); }
private void Update() { if (App.Instance.typing && index < pressesTillFinished && !App.Instance.tut.Active) { if (Input.anyKeyDown) { if (startTyping.text != "Programming finished!\n<size=50%>go create some art for it!") { startTyping.gameObject.SetActive(false); } if (Input.GetKeyDown(KeyCode.Backspace)) { if (index > 0) { int split = (23 > defaultSplit * App.Instance.stats.pressUpgrade) ? 23 : defaultSplit * App.Instance.stats.pressUpgrade; text.text = text.text.Remove(text.text.Length - split); index--; } } else { float chance = 10 * (10 - App.Instance.stats.ProgrammingLevel) / 10; if (Random.Range(0, 100) <= chance && text.text.Length > 25) { text.text += bugString; } else { text.text += code[index]; index++; App.Instance.stats.programmingProgress++; } inAll++; } //Play audio AudioController.PlaySound(AudioDB.FindClip("computer_click"), false, 0.5f); float preferredHeight = LayoutUtility.GetPreferredHeight(textRect); if (preferredHeight > 1100) { float height = preferredHeight - 1100; textRect.localPosition = new Vector3(0, height, 0); } if (index >= pressesTillFinished) { startTyping.gameObject.SetActive(true); startTyping.text = "Programming finished!\n<size=50%>go create some art for it!"; createArtObj.SetActive(true); App.Instance.currentGame.state = App.Game.State.art; textRect.localPosition = new Vector3(0, 0, 0); App.Instance.typing = false; App.Instance.uiManager.gameMenuButton.text = "Back"; AudioController.PlaySound(AudioDB.FindClip("weekover")); int bugs = Regex.Matches(text.text, bugString, RegexOptions.IgnoreCase).Count; text.text = ""; float quality = (float)((index + 2) - ((bugs + 1) * Mathf.PI)) / (float)(index + 2); App.Instance.currentGame.codeQuality *= quality * App.Instance.stats.ProgrammingLevel; } } } }
public void OnClick() { AudioController.PlaySound(AudioDB.FindClip("click")); App.Instance.coverCreator.UpdateColor(c); }
public void CreateGame() { AudioController.PlaySound(AudioDB.FindClip("click")); if (App.Instance.tut.CurrentActive == "games_open") { App.Instance.tut.StopTutorial(); } if (ShopOpen) { shopMenu.SetActive(false); blueButton.text = "Shop"; } if (GameMenuOpen) { gameMenu.SetActive(false); gameMenuButton.text = "Back"; } if (App.Instance.typing) //Back pressed { Debug.Log("typeing"); if (string.IsNullOrEmpty(App.Instance.currentGame.name)) { if (App.Instance.currentGame.state == App.Game.State.programming) { App.Instance.currentGame.progress += ComputerUI.index; } } App.Instance.typing = false; computer.SetActive(false); } else //Computer open { //greenButton.text = "Back"; if (string.IsNullOrEmpty(App.Instance.currentGame.name)) //No game there yet { createGameMenu.SetActive(true); } else { switch (App.Instance.currentGame.state) { case App.Game.State.programming: Debug.Log("game !null programming"); computer.SetActive(true); createCoverMenu.SetActive(false); midiMenu.SetActive(false); App.Instance.typing = true; break; case App.Game.State.art: Debug.Log("game !null drawing"); computer.SetActive(false); midiMenu.SetActive(false); createCoverMenu.SetActive(true); App.Instance.typing = false; break; case App.Game.State.sound: Debug.Log("game !null drawing"); computer.SetActive(false); createCoverMenu.SetActive(false); midiMenu.SetActive(true); App.Instance.typing = false; break; } } } ChangeGreenButtonText(); }