void Start( ) { Assert.IsNotNull(animator); Assert.IsNotNull(highlight); buttonSounds = GameObject.Find("ButtonSoundManager").GetComponent <ButtonSounds>( ); Assert.IsNotNull(buttonSounds); }
//---------------------------------------------------------- void OnMouseDown() { if (!gameMenu.activeSelf) { ButtonSounds Sound = GameObject.Find("UISounds").GetComponent <ButtonSounds>(); Sound.playButton1(); gameMenu.SetActive(true); } }
private void Awake() { if (sounds == null) { sounds = this; } else { DestroyImmediate(this.gameObject); } DontDestroyOnLoad(this.gameObject); }
//---------------------------------------------------------- void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); audioSource = GetComponent <AudioSource> (); }
void Awake( ) { #if !(UNITY_FLASH) useGUILayout = false; #endif ExposedVariables.Awake( ); ExposedVariables.SetParent(this.gameObject); if ("1.CMR" != uScript_MasterComponent.Version) { uScriptDebug.Log("The generated code is not compatible with your current uScript Runtime " + uScript_MasterComponent.Version, uScriptDebug.Type.Error); ExposedVariables = null; UnityEngine.Debug.Break(); } }
public void SelectButton() { if (firstSelected && !lastSelectedGO) { lastSelectedGO = firstSelected.gameObject; } if (lastSelectedGO) { ButtonSounds bs = lastSelectedGO.GetComponent <ButtonSounds>(); if (bs) { bs.isIgnoreNextEnter = true; } TemplateGameManager.Instance.uiinput.SetSelectedButton(lastSelectedGO); } }
void Awake() { ButtonMusic.GetComponent <Toggle>().onValueChanged.RemoveAllListeners(); ButtonMusic.GetComponent <Toggle>().onValueChanged.AddListener((bool on) => { ButtonMusic.GetComponent <Image>().sprite = on ? SpriteOn : SpriteOff; SoundManager.EnableMusic(on); }); ButtonMusic.GetComponent <Toggle>().isOn = SoundManager.IsMusicEnabled(); ButtonSounds.GetComponent <Toggle>().onValueChanged.RemoveAllListeners(); ButtonSounds.GetComponent <Toggle>().onValueChanged.AddListener((bool on) => { ButtonSounds.GetComponent <Image>().sprite = on ? SpriteOn : SpriteOff; SoundManager.EnableSounds(on); }); ButtonSounds.GetComponent <Toggle>().isOn = SoundManager.AreSoundsEnabled(); ButtonVibrations.SetActive(false); TextVibrations.SetActive(false); ButtonVibrations.GetComponent <Toggle>().onValueChanged.RemoveAllListeners(); ButtonVibrations.GetComponent <Toggle>().onValueChanged.AddListener((bool on) => { ButtonVibrations.GetComponent <Image>().sprite = on ? SpriteOn : SpriteOff; }); }
public void PlayButtonSound(ButtonSounds sound) { _gameManager.SoundManager.PlayButtonSound(sound); }