// Use this for initialization void Start() { TitleMusic titleMusic = (TitleMusic)FindObjectOfType(typeof(TitleMusic)); musicAudioSource = (AudioSource)titleMusic.GetComponent <AudioSource>(); imgMusic = (Image)btnMusic.GetComponent <Image> (); imgSounds = (Image)btnSounds.GetComponent <Image> (); if (InformationManager.instance.musicSettings == "Music") { imgMusic.sprite = music; musicAudioSource.mute = false; } else { imgMusic.sprite = noMusic; musicAudioSource.mute = true; } if (InformationManager.instance.soundsSettings == "Sounds") { imgSounds.sprite = sounds; setSounds(false); } else { imgSounds.sprite = noSounds; setSounds(true); } }
public MainWindow() { InitializeComponent(); SliderVolume.Value = 0.5; radioTray = new NotifyIcon(); radioTray.Icon = RadioOnline.Properties.Resources.radiov1; ListStations.ItemsSource = stations; timerStatus = new DispatcherTimer(); timerStatus.Tick += TimerStatus_Tick; timerStatus.Interval = new TimeSpan(0, 0, 1); TitleMusicFM = new GetTitleMusicFM(); timerForGetTitleMusic = new DispatcherTimer(); timerForGetTitleMusic.Tick += TimerForGetTitleMusic_Tick; timerForGetTitleMusic.Interval = new TimeSpan(0, 0, 15); animation = new ThicknessAnimation(); animation.From = new Thickness(300, 0, 0, 0); animation.To = new Thickness(-500, 0, 0, 0); animation.RepeatBehavior = RepeatBehavior.Forever; animation.Duration = new Duration(TimeSpan.Parse("0:0:10")); TitleMusic.BeginAnimation(TextBlock.MarginProperty, animation); }
void Update() { var sceneName = SceneManager.GetActiveScene().name; if (sceneName.StartsWith("Level", System.StringComparison.OrdinalIgnoreCase) && sceneName.Length == 6) { instance = null; Destroy(gameObject); } }
void Awake() { if (instance != null) { Destroy(gameObject); } else { DontDestroyOnLoad(gameObject); instance = this; } }
void Awake() { if (null == _instance) { _instance = this; DontDestroyOnLoad(gameObject); } else if (_instance.gameObject != gameObject) { GameObject.Destroy(gameObject); } }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }
private void Awake() { titleSource.clip = titleClip; if (titleMusic == null) { DontDestroyOnLoad(gameObject); titleMusic = this; } else if (titleMusic != this) { Destroy(gameObject); } }
// Use this for initialization void Awake() { // Set Don't destroy if this is the first time GameManager is Instantiated if (music == null) { DontDestroyOnLoad(gameObject); music = this; } // If the current object is not the same as the one referenced destroy it else if (music != this) { Destroy(gameObject); } }
private void Awake() { instance = this; }
public void End() { instance = null; GetComponent <AudioSource>().Stop(); Destroy(gameObject); }