// Use this for initialization void Start() { GameObject tmpObj = new GameObject(); DontDestroyOnLoad(tmpObj); Global.outGameBGM = tmpObj.AddComponent <AudioSource>(); RSC.LoadAudio("Sound/bgm1"); Global.outGameBGM.playOnAwake = false; Global.outGameBGM.loop = true; Global.outGameBGM.clip = RSC.GetAudio("bgm1"); Global.outGameBGM.Play(); // TST 스프라이트 받아오기 spr_TST = obj_TouchToStart.GetComponent <UI2DSprite>(); }
// Use this for initialization void Start() { // 배경 비디오 로드 if (Global.modeVideoName != null) { MediaPlayerCtrl videoCache; GameObject tmpGO = RSC.GetVideo(Global.modeVideoName[(int)Global.currentSelectMode]) as GameObject; if (tmpGO != null) { videoCache = tmpGO.GetComponent <MediaPlayerCtrl>(); if (videoCache != null) { videoCache.m_TargetMaterial[0] = bgObject; videoCache.Play(); } else { Debug.Log("Cannot load videocache."); } } else { Debug.Log("Object not Found"); } } else { Debug.Log("Cannot load videocache."); } // 미리듣기 로드 AudioClip tmpAudio = RSC.GetAudio(Global.musicInfo[Global.currentSelectMusic].prevName); if (tmpAudio != null) { titleObject.GetComponent <AudioSource>().clip = tmpAudio; titleObject.GetComponent <AudioSource>().Play(); } else { Debug.Log("Cannot Load audio."); } // 난이도 스프라이트 로드 easyButtonIdle = easyButton.GetComponent <UI2DSprite>().sprite2D; normalButtonIdle = normalButton.GetComponent <UI2DSprite>().sprite2D; hardButtonIdle = hardButton.GetComponent <UI2DSprite>().sprite2D; Global.currentSelectDifficulty = Difficulty.Easy; changeDifficulty(Global.currentSelectDifficulty); // 타이틀 이미지 로드 if (Global.musicInfo != null) { Sprite tmpSpr = RSC.GetSprite(Global.musicInfo[Global.currentSelectMusic].pngName); if (tmpSpr != null) { titleObject.GetComponent <UI2DSprite>().sprite2D = tmpSpr; // 곡 락 여부 if (Global.musicInfo[Global.currentSelectMusic].isLocked != 0) { titleObject.GetComponent <UI2DSprite>().color = new Color(1, 1, 1, 0.5f); obj_TitleLock.SetActive(true); obj_UnlockTooltip.SetActive(true); } } else { Debug.Log("Cannot Load title image."); } } // 스타트 버튼, 아이템 버튼 활성화 조정 if (Global.musicInfo[Global.currentSelectMusic].isLocked != 0) { startButton.SetActive(false); itemButtons.SetActive(false); } // 타이틀, 아티스트 라벨 로드 titleLabel.GetComponent <UILabel>().text = Global.musicInfo[Global.currentSelectMusic].titleName; artistLabel.GetComponent <UILabel>().text = Global.musicInfo[Global.currentSelectMusic].makerName; // BGM 페이드아웃 준비 Global.bgmVolume = Global.outGameBGM.volume = 1f; alpha_Tooltip = 0f; alpha_UnlockTooltip = 5f; }
// Use this for initialization void Start() { resetGlobalVariable(); float secondPerMeasure = 240f / Global.currentModeInfo.bpm; // 판정 오브젝트 judgeAnimation = judgeObject.GetComponent <JudgementAnimation>() as JudgementAnimation; //judgeObject.SetActive(false); if (Global.musicInfo != null) { // 오디오 로드 mp3Audio = GetComponent <AudioSource>(); mp3Audio.clip = RSC.GetAudio(Global.musicInfo[Global.currentSelectMusic].mp3Name); if (mp3Audio.clip == null) { Debug.Log("Cannot load audio file."); } // 배경 비디오 로드 GameObject tmpGO = RSC.GetVideo(Global.musicInfo[Global.currentSelectMusic].bgaName) as GameObject; if (tmpGO != null) { videoCache = tmpGO.GetComponent <MediaPlayerCtrl>(); if (videoCache != null) { videoCache.m_bLoop = false; videoCache.m_bFullScreen = true; videoCache.m_bAutoPlay = false; Array.Resize(ref videoCache.m_TargetMaterial, 1); videoCache.m_TargetMaterial[0] = bgObject; videoCache.Stop(); } else { Debug.Log("Cannot load videocache."); } } else { Debug.Log("Object not Found"); } } else { Debug.Log("Cannot load videocache."); } // 노트 오브젝트 로드 if (Global.currentModeInfo.noteInfo != null) { Global.noteManager = new Dictionary <int, List <NoteManager> >(); for (int i = 0; i < Global.currentModeInfo.noteInfo.Count; ++i) { List <NoteManager> tmpNoteManagerList = new List <NoteManager>(); for (int j = 0; j < Global.currentModeInfo.noteInfo[i].Count; ++j) { GameObject noteObject = Instantiate(dummyNote) as GameObject; NoteManager tmpNoteManager = noteObject.GetComponent <NoteManager>() as NoteManager; tmpNoteManager.noteInfo = Global.currentModeInfo.noteInfo[i][j]; noteObject.transform.SetParent(dummyNote.transform.parent); noteObject.transform.localScale = new Vector3(1, 1, 1); switch (tmpNoteManager.noteInfo.type) { case NoteType.Normal: { switch (tmpNoteManager.noteInfo.drag) { case DragType.Normal: break; case DragType.DragBody1: case DragType.DragHead1: case DragType.DragTail1: case DragType.DragBody2: case DragType.DragHead2: case DragType.DragTail2: { noteObject.GetComponent <UI2DSprite>().sprite2D = dummySprites[1]; } break; default: break; } } break; case NoteType.LongHead: case NoteType.LongBody: case NoteType.LongTail: { noteObject.GetComponent <UI2DSprite>().sprite2D = dummySprites[2]; } break; default: break; } tmpNoteManager.absoluteTime = Global.firstNoteDelayTime + (secondPerMeasure * tmpNoteManager.noteInfo.measure) + (secondPerMeasure * tmpNoteManager.noteInfo.grid); Vector3 tmpVector = new Vector3(); tmpVector.x = Global.sequencePosition[i].x; tmpVector.y = Global.sequencePosition[i].y; tmpVector.z = (float)(tmpNoteManager.absoluteTime * Global.z_PerMeasure); noteObject.transform.localPosition = tmpNoteManager.absolutePosition = tmpVector; //noteObject.SetActive(true); noteObject.GetComponent <UIWidget>().depth = 10000 - j; tmpNoteManagerList.Add(tmpNoteManager); } Global.noteManager[i] = tmpNoteManagerList; } } }