public static void StartGame() { isStart = true; MessageSystemGameBlock.Speed = speed; MessageSystemGameBlock.BackgroundSpeed = backgroundSpeed; player.SetActive(false); ChangeHeroAfterStart(); OpenMenu.NumberOperation = 2; player.SetActive(true); MessageSystemGameBlock.StartStopWatch(); Generate.Level = MessageSystemGameBlock.LEVEL; if (listAudio.Count != 0) { if (Conecting.Music == 1) { SaveListAudio(); playMusic(); } } else { StopClip(); } MusicButton.DisableMusicButton(); }
IEnumerator MissRoutine(MusicButton musicButton) { // score keeping ButtonMissed(); // MISS text clickResult.gameObject.SetActive(true); clickResult.gameObject.transform.localPosition = musicButton.gameObject.transform.localPosition + (new Vector3(30, 30, 0)); explosion.gameObject.transform.localPosition = musicButton.gameObject.transform.localPosition + (new Vector3(30, 30, 0)); clickResult.gameObject.transform.SetAsLastSibling(); explosion.gameObject.transform.SetAsLastSibling(); clickResult.text = "Miss"; clickResult.color = Color.magenta; // It lerps float startTime = audioSource.time; float totalTime = result_duration; missSound.Play(); float perc = (audioSource.time - startTime) / totalTime; while (perc < 1) { Vector3 currentScale = Vector3.Lerp(new Vector3(0, 0, 0), new Vector3(1.5f, 1.5f, 1), perc); clickResult.gameObject.transform.localScale = currentScale; perc = (audioSource.time - startTime) / totalTime; yield return(null); } yield return(new WaitForSeconds(0.3f)); clickResult.gameObject.SetActive(false); }
// Start is called before the first frame update void Start() { FireballShot = FireBallContainer.GetComponent <AudioSource>(); BackgroundShot = MusicContainer.GetComponent <AudioSource>(); SoundSR = SoundButton.GetComponent <SpriteRenderer>(); MusicSR = MusicButton.GetComponent <SpriteRenderer>(); }
void Start() { soundButton = FindObjectOfType <SoundButton>(); musicButton = FindObjectOfType <MusicButton>(); musicPlayer = FindObjectOfType <MusicPlayer>(); audioSource = musicPlayer.GetComponent <AudioSource>(); audioSource.ignoreListenerPause = true; volume = audioSource.volume; buttonSwitch = GetComponent <AudioSource>(); }
IEnumerator PerfectRoutine(MusicButton musicButton) { explosion.gameObject.SetActive(true); // Score keeping ButtonScoredPerfect(); // Perfect text clickResult.gameObject.SetActive(true); clickResult.gameObject.transform.localPosition = musicButton.gameObject.transform.localPosition + (new Vector3(30, 100, 0)); explosion.gameObject.transform.localPosition = musicButton.gameObject.transform.localPosition + (new Vector3(30, 100, 0)); clickResult.gameObject.transform.SetAsLastSibling(); explosion.gameObject.transform.SetAsLastSibling(); string target = "Perfect!"; // Perfect combo if (currentPerfect > 1) { target += "<color=\"red\">x" + currentPerfect.ToString(); } // Higher the combo, higher the pitch of the sound float newPitch = Mathf.Clamp(1 + (0.06f * (currentPerfect - 1)), 1, 1.8f); perfectSound.pitch = newPitch; clickResult.text = target; clickResult.color = new Color(1, 0, 0.59f); // It also lerps float startTime = audioSource.time; float totalTime = result_duration; perfectSound.Play(); float perc = (audioSource.time - startTime) / totalTime; while (perc < 1) { Vector3 currentScale = Vector3.Lerp(new Vector3(0, 0, 0), new Vector3(1.5f, 1.5f, 1), perc); clickResult.gameObject.transform.localScale = currentScale; explosion.color = Color.Lerp(new Color(1, 1, 1, 0.5f), new Color(1, 1, 1, 1), perc); explosion.gameObject.transform.localScale = Vector3.Lerp(new Vector3(1, 1, 1), new Vector3(1.5f, 1.5f, 1.5f), perc); //explosion.gameObject.transform.localScale = Vector3.Lerp(new Vector3(0, 0, 0), new Vector3(1.5f, 1.5f, 1.5f), perc); perc = (audioSource.time - startTime) / totalTime; yield return(null); } yield return(new WaitForSeconds(0.3f)); explosion.gameObject.SetActive(false); clickResult.gameObject.SetActive(false); }
public void SwitchMusic() { if (PlayerPrefs.GetString("Music") == "Off") { PlayerPrefs.SetString("Music", "On"); MusicButton.GetComponent <Image>().sprite = MusicOnSprite; } else { PlayerPrefs.SetString("Music", "Off"); MusicButton.GetComponent <Image>().sprite = MusicOffSprite; } }
private void MusicButton_Click(object sender, RoutedEventArgs e) { MusicButton button = (MusicButton)sender; if (button.MusicIcon == "\ue76a") { button.MusicIcon = "\ue74f"; } else { button.MusicIcon = "\ue76a"; } }
void Start() { Events.OnSelectSong += OnSelectSong; Events.OnToogleMusicState += OnToogleMusicState; int id = 0; foreach (Song song in songs) { MusicButton newMusicButton = Instantiate(musicButton); newMusicButton.transform.SetParent(container.transform); newMusicButton.transform.localScale = Vector3.one; newMusicButton.Init(id, song); id++; buttons.Add(newMusicButton); } }
public void Update(Matrix2D?Scale = null) { BackRequested = false; if (SoundFxButton.IsPressed(Scale)) { Settings.SoundFX = !Settings.SoundFX; } if (MusicButton.IsPressed(Scale)) { // Settings.Music = !Settings.Music; } if (BackButton.IsPressed(Scale)) { BackRequested = true; } }
void OnSelectSong(Song song, int id) { songID = id; activeSong = song; StartPlaying(); foreach (MusicButton musicButton in buttons) { if (musicButton.id == id) { musicButton.SetState(true); ActiveButton = musicButton; } else { musicButton.SetState(false); } } }
private void Start() { //check if sound and music are on if (PlayerPrefs.GetString("Music") == "Off") { MusicButton.GetComponent <Image>().sprite = MusicOffSprite; } else { MusicButton.GetComponent <Image>().sprite = MusicOnSprite; } if (PlayerPrefs.GetString("Sound") == "Off") { SoundButton.GetComponent <Image>().sprite = SoundOffSprite; } else { SoundButton.GetComponent <Image>().sprite = SoundOnSprite; } }
IEnumerator CoolRoutine(MusicButton musicButton) { explosion.gameObject.SetActive(true); // Score keeping ButtonScoredCool(); // Cool text clickResult.gameObject.SetActive(true); clickResult.gameObject.transform.localPosition = musicButton.gameObject.transform.localPosition + (new Vector3(30, 100, 0)); explosion.gameObject.transform.localPosition = musicButton.gameObject.transform.localPosition + (new Vector3(30, 100, 0)); clickResult.gameObject.transform.SetAsLastSibling(); explosion.gameObject.transform.SetAsLastSibling(); clickResult.text = "Cool!"; clickResult.color = Color.green; // It also lerps float startTime = audioSource.time; float totalTime = result_duration; coolSound.Play(); float perc = (audioSource.time - startTime) / totalTime; while (perc < 1) { Vector3 currentScale = Vector3.Lerp(new Vector3(0, 0, 0), new Vector3(1, 1, 1), perc); clickResult.gameObject.transform.localScale = currentScale; explosion.color = Color.Lerp(new Color(1, 1, 1, 0.5f), new Color(1, 1, 1, 1), perc); explosion.gameObject.transform.localScale = Vector3.Lerp(new Vector3(1, 1, 1), new Vector3(1.5f, 1.5f, 1.5f), perc); //explosion.gameObject.transform.localScale = Vector3.Lerp(new Vector3(0, 0, 0), new Vector3(1.5f, 1.5f, 1.5f), perc); perc = (audioSource.time - startTime) / totalTime; yield return(null); } yield return(new WaitForSeconds(0.3f)); explosion.gameObject.SetActive(false); clickResult.gameObject.SetActive(false); }
void OnMusicButtonClicked() { Debug.Log("Music"); if (!musicButtonClicked) { musicButtonClicked = true; MusicButton.SetNormalColor(activeButtonColor); audioSource.PlayOneShot(backgroundMusic, 0.2f); } else { musicButtonClicked = false; MusicButton.SetNormalColor(inactiveButtonColor); audioSource.Stop(); } }
private void SetMusic() { //编辑器内 先设计好所有按钮 开启则显示 未开启则默认 //存储【名称,是否开启】 GameObject grid = transform.Find("NameButton_Grid").gameObject; for (int i = 0; i < grid.transform.childCount; i++) { GameObject go = grid.transform.GetChild(i).gameObject; MusicButton mb = go.GetComponent <MusicButton>(); mb.uiManager = this; UIButton btn = go.GetComponent <UIButton>(); //btn.isEnabled = musicTable[i]; //if (musicTable[i]) //{ // lb.text = "??????"; //} } }
// called when player cools public void Cool(MusicButton musicButton) { // destroy particle effects if any left foreach (GameObject clone in GameObject.FindGameObjectsWithTag("Clone")) { Destroy(clone); } //set up some shitty particle effect UIParticleSystem flashClone = Instantiate(flashes[1]); flashClone.gameObject.transform.SetParent(this.gameObject.transform); flashClone.gameObject.SetActive(true); flashClone.gameObject.transform.localPosition = musicButton.gameObject.transform.localPosition; flashClone.gameObject.transform.localScale = new Vector3(0.7f, 0.7f, 1); flashClone.gameObject.transform.SetAsLastSibling(); flashClone.gameObject.tag = "Clone"; flashClone.Play(); // Plays button animation StartCoroutine(CoolRoutine(musicButton)); }
public override void LoadContent() { base.LoadContent(); info_bulle = "Your number of moves (min number of moves to succeed)"; position_texte_score = new Vector2(16, 8); design_button = new DesignButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\design"), new Vector2(4 * 32, 0)); fire_button = new FireButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\fire"), new Vector2(5 * 32, 0)); water_button = new WaterButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\water"), new Vector2(6 * 32, 0)); music_button = new MusicButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\music"), new Vector2(8 * 32, 0)); sound_button = new SoundButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\sound"), new Vector2(9 * 32, 0)); refresh_button = new ReloadButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\refresh"), new Vector2(11 * 32, 0)); previous_button = new PreviousButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\previous"), new Vector2(13 * 32, 0)); next_button = new NextButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\next"), new Vector2(14 * 32, 0)); menu_button = new MenuButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\menu"), new Vector2(16 * 32, 0)); MapManager.Instance.LoadContent(); LevelManager.Instance.LoadContent(); Actor.Instance.LoadContent(); InitializeMusic(); }
void turnOnValuablesShop() { ColorsButton.GetComponent <Image>().color = Color.white; ShapesButton.GetComponent <Image>().color = Color.white; PathColorsButton.GetComponent <Image>().color = Color.white; ThemesButton.GetComponent <Image>().color = Color.white; MusicButton.GetComponent <Image>().color = Color.white; MoneyButton.GetComponent <Image>().color = Color.gray; PlayerColorText.GetComponent <Text>().color = Color.black; PlayerShapeText.GetComponent <Text>().color = Color.black; PathColorText.GetComponent <Text>().color = Color.black; ThemeText.GetComponent <Text>().color = Color.black; MusicText.GetComponent <Text>().color = Color.black; MoneyText.GetComponent <Text>().color = Color.white; PlayerColorShop.SetActive(false); PlayerShapeShop.SetActive(false); PathColorShop.SetActive(false); ThemeShop.SetActive(false); TrailShop.SetActive(false); ValuablesShop.SetActive(true); }
// called when player perfects public void Perfect(MusicButton musicButton) { foreach (GameObject clone in GameObject.FindGameObjectsWithTag("Clone")) { Destroy(clone); } // set up more shitty particle effects foreach (UIParticleSystem flash in flashes) { UIParticleSystem flashClone = Instantiate(flash); flashClone.gameObject.transform.SetParent(this.gameObject.transform); flashClone.gameObject.SetActive(true); flashClone.gameObject.transform.localPosition = musicButton.gameObject.transform.localPosition; flashClone.gameObject.transform.localScale = new Vector3(2.5f, 2.5f, 1); flashClone.Speed = 10f; flashClone.gameObject.transform.SetAsLastSibling(); flashClone.gameObject.tag = "Clone"; flashClone.Play(); } // animate StartCoroutine(PerfectRoutine(musicButton)); }
void ChangeMusicSettings() { audioManager.GetComponent <AudioManager>().Play("button"); Color musicColor = MusicButton.GetComponent <Image>().color; if (musicOn) { musicOn = false; audioManager.GetComponent <AudioManager>().StopMusic(); playOrStopMusic.GetComponentInChildren <TMPro.TextMeshProUGUI>().text = "PLAY MUSIC"; musicColor = new Color(musicColor.r, musicColor.g, musicColor.b, 0.33f); musicAlpha = 0.33f; MusicButton.GetComponent <Image>().color = musicColor; } else { musicOn = true; audioManager.GetComponent <AudioManager>().PlayMusic(); playOrStopMusic.GetComponentInChildren <TMPro.TextMeshProUGUI>().text = "STOP MUSIC"; musicColor = new Color(musicColor.r, musicColor.g, musicColor.b, 1f); musicAlpha = 1f; MusicButton.GetComponent <Image>().color = musicColor; } }
void turnOnPlayerShapeShop() { ColorsButton.GetComponent <Image>().color = Color.white; ShapesButton.GetComponent <Image>().color = Color.gray; PathColorsButton.GetComponent <Image>().color = Color.white; ThemesButton.GetComponent <Image>().color = Color.white; MusicButton.GetComponent <Image>().color = Color.white; MoneyButton.GetComponent <Image>().color = Color.green; PlayerColorText.GetComponent <Text>().color = Color.black; PlayerShapeText.GetComponent <Text>().color = Color.white; PathColorText.GetComponent <Text>().color = Color.black; ThemeText.GetComponent <Text>().color = Color.black; MusicText.GetComponent <Text>().color = Color.black; MoneyText.GetComponent <Text>().color = Color.white; PlayerColorShop.SetActive(false); PlayerShapeShop.SetActive(true); PathColorShop.SetActive(false); ThemeShop.SetActive(false); TrailShop.SetActive(false); ValuablesShop.SetActive(false); if (PlayerPrefs.GetInt("PlayerShapeOnce") == 0) { buyPlayerShapeItem(0, "Cube"); PlayerPrefs.SetInt("PlayerShapeOnce", 1); } if (PlayerPrefs.GetInt("CubeShape", 0) == 1) { GameObject.Find("CubeCost").GetComponent <Text>().text = "Cube"; } if (PlayerPrefs.GetInt("SphereShape", 0) == 1) { GameObject.Find("SphereCost").GetComponent <Text>().text = "Sphere"; } if (PlayerPrefs.GetInt("BirdShape", 0) == 1) { GameObject.Find("BirdCost").GetComponent <Text>().text = "Bird"; } if (PlayerPrefs.GetInt("TurtleShape", 0) == 1) { GameObject.Find("TurtleCost").GetComponent <Text>().text = "Turtle"; } if (PlayerPrefs.GetInt("PlaneShape", 0) == 1) { GameObject.Find("PlaneCost").GetComponent <Text>().text = "Fish"; } if (PlayerPrefs.GetInt("XShape", 0) == 1) { GameObject.Find("XCost").GetComponent <Text>().text = "Butterfly"; } if (PlayerPrefs.GetInt("HeadShape", 0) == 1) { GameObject.Find("HeadCost").GetComponent <Text>().text = "Squirrel"; } if (PlayerPrefs.GetInt("BatmanShape", 0) == 1) { GameObject.Find("BatmanCost").GetComponent <Text>().text = "Cylinder"; } GameObject.Find(PlayerPrefs.GetString("WhichPlayerShapeSelected") + "Cost").GetComponent <Text>().text = "Selected"; //selected on start }
IEnumerator ProcessTwitchCommand(string command) { string[] parameters = command.Split(' '); if (Regex.IsMatch(command, @"^\s*play\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)) { yield return(null); if (UtilityImages[0].sprite != Sprites[0]) { yield return("sendtochaterror You are not able to press play at this moment. Command ignored."); yield break; } UtilityButton.OnInteract(); } if (Regex.IsMatch(command, @"^\s*mute\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)) { yield return(null); if (UtilityImages[1].sprite != Sprites[3]) { yield return("sendtochaterror You are not able to mute the module since its already muted. Command ignored."); yield break; } MusicButton.OnInteract(); } if (Regex.IsMatch(command, @"^\s*unmute\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)) { yield return(null); if (UtilityImages[1].sprite != Sprites[4]) { yield return("sendtochaterror You are not able to unmute the module since its already unmuted. Command ignored."); yield break; } MusicButton.OnInteract(); } if (Regex.IsMatch(command, @"^\s*stop\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)) { yield return(null); if (UtilityImages[0].sprite != Sprites[1]) { yield return("sendtochaterror You are not able to press stop at this moment. Command ignored."); yield break; } UtilityButton.OnInteract(); } if (Regex.IsMatch(parameters[0], @"^\s*press\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant) && parameters.Length > 1) { yield return(null); if (parameters.Length != 2) { yield return("sendtochaterror Parameter length invalid. Command ignored."); yield break; } if (PlayTime == false) { yield return("sendtochaterror You are not able to press these buttons at this moment. Command ignored."); yield break; } if (parameters[1].Length == 1) { if (!parameters[1].ToUpper().EqualsAny(RegularAlphabet) || parameters[1].ToUpper() == ShuffledAlphabet[25]) { yield return("sendtochaterror Command being sent does not contain a valid single letter. Command ignored."); yield break; } int Press = Array.IndexOf(ShuffledAlphabet, parameters[1].ToUpper()); yield return("strike"); yield return("solve"); MainButtons[Press].OnInteract(); } else if (parameters[1].Length == 2) { if (!parameters[1][0].ToString().ToUpper().EqualsAny(CoordinatesL) || !parameters[1][1].ToString().EqualsAny(CoordinatesN)) { yield return("sendtochaterror Command being sent is not a valid coordinate. Command ignored."); yield break; } yield return("strike"); yield return("solve"); MainButtons[(Array.IndexOf(CoordinatesN, parameters[1][1].ToString()) * 5) % 25 + Array.IndexOf(CoordinatesL, parameters[1][0].ToString().ToUpper())].OnInteract(); } } }
// called when player misses public void Miss(MusicButton musicButton) { StartCoroutine(MissRoutine(musicButton)); }
void Update() { if (mouseState == MouseState.Cube) { MoveCurrCube(); } else { cursor.transform.position = MouseSpacePosition(cursorZ); } if (Time.time - lastClickTime > clickDelay) { if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1)) { lastClickTime = Time.time; if (mouseState == MouseState.Free) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); // Debug.DrawRay(ray.origin, ray.direction * range, Color.green); RaycastHit hit; if (Physics.Raycast(ray, out hit, range)) { GameObject go = hit.collider.gameObject; if (go != null) { if (go.tag == "Cube") { currCube = go.GetComponent <Cube>(); currCubeZ = currCube.transform.position.z; currCubeShift = currCube.transform.position - MouseSpacePosition(currCubeZ); targetPos = currCube.transform.position; mouseState = MouseState.Cube; firstChoosen = currCube.Choose(true); cursor.SetActive(false); } else { MusicButton mb = go.GetComponent <MusicButton>(); if (mb != null) { mb.ProcessMusic(); } } } } } else { currCube.Choose(false); currCube = null; mouseState = MouseState.Free; cursor.SetActive(true); if (firstChoosen) { Instantiate(cubePref, birthPlace); firstChoosen = false; } } } } }
private void Init() { container = CreateChild <UguiObject>("container"); { container.Anchor = AnchorType.TopStretch; container.Pivot = PivotType.Top; container.SetOffsetHorizontal(0f); container.Height = ContainerHeight; container.Y = 0f; backgroundSprite = container.CreateChild <BackgroundSprite>("background"); { backgroundSprite.Anchor = AnchorType.Fill; backgroundSprite.RawSize = Vector2.zero; backgroundSprite.SetOffsetVertical(0f); } comboMenuButton = container.CreateChild <ComboMenuButton>("combo-menu"); { comboMenuButton.Anchor = AnchorType.LeftStretch; comboMenuButton.Pivot = PivotType.Left; comboMenuButton.SetOffsetVertical(0f); comboMenuButton.X = 0f; comboMenuButton.Width = 80f; } profileButton = container.CreateChild <ProfileMenuButton>("profile-menu"); { profileButton.Anchor = AnchorType.LeftStretch; profileButton.Pivot = PivotType.Left; profileButton.SetOffsetVertical(0f); profileButton.X = comboMenuButton.Width; profileButton.Width = 220f; } modeButton = container.CreateChild <ModeMenuButton>("mode-menu"); { modeButton.Anchor = AnchorType.LeftStretch; modeButton.Pivot = PivotType.Left; modeButton.SetOffsetVertical(0f); modeButton.X = profileButton.X + profileButton.Width; modeButton.Width = 80f; } notificationMenuButton = container.CreateChild <NotificationMenuButton>("notification-menu"); { notificationMenuButton.Anchor = AnchorType.RightStretch; notificationMenuButton.Pivot = PivotType.Right; notificationMenuButton.SetOffsetVertical(0f); notificationMenuButton.X = 0f; notificationMenuButton.Width = 80f; } settingsMenuButton = container.CreateChild <SettingsMenuButton>("settings-menu"); { settingsMenuButton.Anchor = AnchorType.RightStretch; settingsMenuButton.Pivot = PivotType.Right; settingsMenuButton.SetOffsetVertical(0f); settingsMenuButton.X = -notificationMenuButton.Width; settingsMenuButton.Width = 80f; } musicButton = container.CreateChild <MusicButton>("music-menu"); { musicButton.Anchor = AnchorType.RightStretch; musicButton.Pivot = PivotType.Right; musicButton.SetOffsetVertical(0f); musicButton.X = settingsMenuButton.X - settingsMenuButton.Width; musicButton.Width = 80f; } } menuButtons = GetComponentsInChildren <BaseMenuButton>(true); OnEnableInited(); }
public void setButton(MusicButton firstButton) { musicButton = firstButton; }
void turnOnThemeShop() { ColorsButton.GetComponent <Image>().color = Color.white; ShapesButton.GetComponent <Image>().color = Color.white; PathColorsButton.GetComponent <Image>().color = Color.white; ThemesButton.GetComponent <Image>().color = Color.gray; MusicButton.GetComponent <Image>().color = Color.white; MoneyButton.GetComponent <Image>().color = Color.green; PlayerColorText.GetComponent <Text>().color = Color.black; PlayerShapeText.GetComponent <Text>().color = Color.black; PathColorText.GetComponent <Text>().color = Color.black; ThemeText.GetComponent <Text>().color = Color.white; MusicText.GetComponent <Text>().color = Color.black; MoneyText.GetComponent <Text>().color = Color.white; PlayerColorShop.SetActive(false); PlayerShapeShop.SetActive(false); PathColorShop.SetActive(false); ThemeShop.SetActive(true); TrailShop.SetActive(false); ValuablesShop.SetActive(false); //for default if (PlayerPrefs.GetInt("ThemeOnce") == 0) { buyThemeItem(0, "WhiteBlackColor"); PlayerPrefs.SetInt("ThemeOnce", 1); } //if bought then keep transparent colors default if bought if (PlayerPrefs.GetInt("WhiteBlackColor", 0) == 1) { GameObject.Find("WhiteBlackColorCost").GetComponent <Text>().text = "Normal"; } if (PlayerPrefs.GetInt("BlackWhiteColor", 0) == 1) { GameObject.Find("BlackWhiteColorCost").GetComponent <Text>().text = "Inverted"; } if (PlayerPrefs.GetInt("BlueYellowColor", 0) == 1) { GameObject.Find("BlueYellowColorCost").GetComponent <Text>().text = "Yankee"; } if (PlayerPrefs.GetInt("GreenRedColor", 0) == 1) { GameObject.Find("GreenRedColorCost").GetComponent <Text>().text = "Holidays"; } if (PlayerPrefs.GetInt("PinkPurpleColor", 0) == 1) { GameObject.Find("PinkPurpleColorCost").GetComponent <Text>().text = "Pink"; } if (PlayerPrefs.GetInt("GreenGreenColor", 0) == 1) { GameObject.Find("GreenGreenColorCost").GetComponent <Text>().text = "Forest"; } if (PlayerPrefs.GetInt("YellowYellowColor", 0) == 1) { GameObject.Find("YellowYellowColorCost").GetComponent <Text>().text = "Sandy"; } if (PlayerPrefs.GetInt("OrangeRedColor", 0) == 1) { GameObject.Find("OrangeRedColorCost").GetComponent <Text>().text = "Sunny"; } GameObject.Find(PlayerPrefs.GetString("WhichThemeSelected") + "Cost").GetComponent <Text>().text = "Selected"; //selected on start }
void turnOnPathColorShop() { ColorsButton.GetComponent <Image>().color = Color.white; ShapesButton.GetComponent <Image>().color = Color.white; PathColorsButton.GetComponent <Image>().color = Color.gray; ThemesButton.GetComponent <Image>().color = Color.white; MusicButton.GetComponent <Image>().color = Color.white; MoneyButton.GetComponent <Image>().color = Color.green; PlayerColorText.GetComponent <Text>().color = Color.black; PlayerShapeText.GetComponent <Text>().color = Color.black; PathColorText.GetComponent <Text>().color = Color.white; ThemeText.GetComponent <Text>().color = Color.black; MusicText.GetComponent <Text>().color = Color.black; MoneyText.GetComponent <Text>().color = Color.white; PlayerColorShop.SetActive(false); PlayerShapeShop.SetActive(false); PathColorShop.SetActive(true); ThemeShop.SetActive(false); TrailShop.SetActive(false); ValuablesShop.SetActive(false); //for default if (PlayerPrefs.GetInt("PathColorOnce") == 0) { buyPathColorItem(0, "RedPath"); PlayerPrefs.SetInt("PathColorOnce", 1); } //if bought then keep transparent colors default if bought if (PlayerPrefs.GetInt("RedPath", 0) == 1) { GameObject.Find("RedPathCost").GetComponent <Text>().text = "Red"; } if (PlayerPrefs.GetInt("BluePath", 0) == 1) { GameObject.Find("BluePathCost").GetComponent <Text>().text = "Blue"; } if (PlayerPrefs.GetInt("YellowPath", 0) == 1) { GameObject.Find("YellowPathCost").GetComponent <Text>().text = "Yellow"; } if (PlayerPrefs.GetInt("OrangePath", 0) == 1) { GameObject.Find("OrangePathCost").GetComponent <Text>().text = "Orange"; } if (PlayerPrefs.GetInt("GreenPath", 0) == 1) { GameObject.Find("GreenPathCost").GetComponent <Text>().text = "Green"; } if (PlayerPrefs.GetInt("PurplePath", 0) == 1) { GameObject.Find("PurplePathCost").GetComponent <Text>().text = "Purple"; } if (PlayerPrefs.GetInt("PinkPath", 0) == 1) { GameObject.Find("PinkPathCost").GetComponent <Text>().text = "Pink"; } if (PlayerPrefs.GetInt("WhitePath", 0) == 1) { GameObject.Find("WhitePathCost").GetComponent <Text>().text = "White"; } GameObject.Find(PlayerPrefs.GetString("WhichPathColorSelected") + "Cost").GetComponent <Text>().text = "Selected"; //selected on start }