private void Awake() { MusicClass mC = null; try { GameObject audio = GameObject.FindGameObjectWithTag("Music"); mC = audio.GetComponent <MusicClass>(); if (mC._audioSource.isPlaying) { Destroy(this.gameObject); } else { DontDestroyOnLoad(transform.gameObject); _audioSource = GetComponent <AudioSource>(); PlayMusic(); } } catch { DontDestroyOnLoad(transform.gameObject); _audioSource = GetComponent <AudioSource>(); PlayMusic(); } }
void Start() { renderer = GetComponent <Renderer>(); renderer.material.color = Color.cyan; trail = GetComponent <TrailRenderer> (); trail.material.color = Color.cyan; gameOverMenu = GameObject.Find("GameOver"); gameOverMenu.SetActive(false); score.text = "Score: 0"; round.text = "Round 1"; score.color = Color.cyan; bestScore = PlayerPrefs.GetInt("bestscore", bestScore); replayBtn.onClick.AddListener(retryButtonAction); homeBtn.onClick.AddListener(quitButtonAction); homeBtn2.onClick.AddListener(quitButtonAction); pauseBtn.onClick.AddListener(pauseButtonAction); playBtn.onClick.AddListener(playButtonAction); muteBtn.onClick.AddListener(muteButtonAction); pauseMenu = GameObject.Find("PauseMenu"); pauseMenu.SetActive(false); music = GameObject.Find("SoundManager").GetComponent <MusicClass> (); buttonImage = muteBtn.GetComponent <Image>(); int m = 0; mute = PlayerPrefs.GetInt("mute", m) == 0 ? false : true; muteSprite = Resources.Load <Sprite> ("style01/shape010_style01_color08"); unmuteSprite = Resources.Load <Sprite> ("style01/shape009_style01_color08"); if (mute) { buttonImage.sprite = muteSprite; } volume = PlayerPrefs.GetFloat("volume", volume); }
public static void EnableMusicChannel() { if (Camera.main.gameObject.GetComponent <MusicClass> () == null) { Camera.main.gameObject.AddComponent <MusicClass> (); musicSource = Camera.main.gameObject.GetComponent <MusicClass> (); } }
public async Task <IActionResult> Create([Bind("MusicClassId,TutorId,LessonTimeId,StartDate,EndDate")] MusicClass musicClass) { if (ModelState.IsValid) { _context.Add(musicClass); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["LessonTimeId"] = new SelectList(_context.LessonTime, "LessonTimeId", "LessonTimeId", musicClass.LessonTimeId); ViewData["TutorId"] = new SelectList(_context.Tutor, "TutorId", "TutorId", musicClass.TutorId); return(View(musicClass)); }
void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(this); } else { Destroy(this); return; } }
private void Awake() { if (instance != null) { return; } else { instance = this; DontDestroyOnLoad(gameObject); Play(); } }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }
private void Awake() { DontDestroyOnLoad(transform.gameObject); _audioSource = GetComponent <AudioSource>(); if (musicInstance == null) { musicInstance = this; } else { DestroyObject(gameObject); } }
private async void LoadItems() { MusicClass mc1 = new MusicClass(); mc1.ClassAge = 8; mc1.ClassExperience = 1; mc1.NumberUser = 10; await musicClass1.Insert(mc1); var result = this.pageSchool.ucMusicClassUserControl.MusicClass = await musicClass1.Get(1); this.pageSchool.ucMusicClassUserControl.MusicClass = result; }
private void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(transform.gameObject); _audioSource = GetComponent <AudioSource>(); }
void Awake() { if (!_instance) { _instance = this; } else { Destroy(this.gameObject); } DontDestroyOnLoad(this.gameObject); }
private void Awake() { if (instance == null) { DontDestroyOnLoad(this); instance = this; } else if (instance != this) { Destroy(gameObject); } _audioSource = GetComponent <AudioSource>(); }
void Awake() { if (_instance == null) { //If I am the first instance, make me the Singleton _instance = this; DontDestroyOnLoad(this); } else { //If a Singleton already exists and you find //another reference in scene, destroy it! if (this != _instance) { Destroy(this.gameObject); } } }
public async Task <IActionResult> Edit(int id, [Bind("MusicClassId,TutorId,LessonTimeId,StartDate,EndDate")] MusicClass mc) { var musicClass = await _context.MusicClass .Include(m => m.LessonTime) .Include(m => m.Tutor) .FirstOrDefaultAsync(m => m.MusicClassId == id); musicClass.LessonTimeId = mc.LessonTimeId; musicClass.TutorId = mc.TutorId; if (id != musicClass.MusicClassId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(musicClass); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MusicClassExists(musicClass.MusicClassId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["LessonTimeId"] = new SelectList(_context.LessonTime, "LessonTimeId", "LessonTimeId", musicClass.LessonTimeId); ViewData["TutorId"] = new SelectList(_context.Tutor, "TutorId", "TutorId", musicClass.TutorId); return(View(musicClass)); }
void Start() { nowMusicClass = new MusicClass(); linePos = new Vector3(0, 0, 0); linePool = new GameObject[100]; lineCounter = 0; nowBeatIndex = 0; nowState = State.Nothing; leftNoteIndex = 0; rightNoteIndex = 0; touchedOnNothing = false; int k = 0; int j = 0; for (int i = 0; i < 100; i++) { GameObject obj = Instantiate(line, lineMover.transform, false); linePool[i] = obj; obj.transform.localPosition = new Vector3(0, i + 1, 0); int k1 = Random.Range(1, 4); int j1 = Random.Range(1, 4); k += k1; j += j1; nowMusicClass.leftNoteArray[i] = k; nowMusicClass.rightNoteArray[i] = j; } scoreBoard = new bool[nowMusicClass.wholeBeat]; for (int i = 0; i < scoreBoard.Length; i++) { scoreBoard[i] = false; } SetGame(); //더미생성자여. }
private void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; volume = PlayerPrefs.GetFloat("volume", volume); int m = 0; mute = PlayerPrefs.GetInt("mute", m) == 0 ? false : true; if (mute) { _audioSource.Stop(); } else { _audioSource.volume = volume; } } DontDestroyOnLoad(this.gameObject); }
// Use this for initialization void Start() { buttonImage = GameObject.Find("MusicButton").GetComponent <Image>(); muteSprite = Resources.Load <Sprite> ("style01/shape010_style01_color08"); unmuteSprite = Resources.Load <Sprite>("style01/shape009_style01_color08"); music = GameObject.Find("SoundManager").GetComponent <MusicClass> (); slider = GameObject.Find("Slider").GetComponent <Slider> (); volume = PlayerPrefs.GetFloat("volume", volume); slider.value = volume; int m = 0; mute = PlayerPrefs.GetInt("mute", m) == 0 ? false : true; if (mute) { buttonImage.sprite = muteSprite; music.StopMusic(); } else { buttonImage.sprite = unmuteSprite; music.PlayMusic(); } }