1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class Logo : MonoBehaviour { public UILogo uiLogo; public void Init(Camera uiCamera) { this.uiLogo.Init(uiCamera); uiLogo.FadeIn(); this.uiLogo.onFadeInCompleted = () => { Debug.Log("Logo FadeIn완료"); StartCoroutine(this.uiLogo.WaitForSeconds(3)); uiLogo.onWaitForCecondsCompleted = () => { uiLogo.FadeOut(); }; }; this.uiLogo.onFadeOutCompleted = () => { Debug.Log("Logo FadOut완료"); var oper = SceneManager.LoadSceneAsync("Title"); oper.completed += (asyncOper) => { Debug.Log("Title로고씬 로드"); var title = GameObject.FindObjectOfType<Title>(); title.Init(uiCamera); }; }; } } | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using System; public class Title : MonoBehaviour { public UITitle uiTitle; private bool isRead; public void Awake() { this.uiTitle.btn.onClick.AddListener(() => { Debug.Log("버튼클릭함"); this.uiTitle.FadeOut(); //StartCoroutine(this.uiTitle.WaitForSeconds(3)); }); } public void Init(Camera uiCamera) { this.uiTitle.Init(uiCamera); this.uiTitle.FadeIn(); this.uiTitle.onFadeInCompleted = () => { Debug.Log("Title FadeIn 완료"); }; } } | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; namespace yangjaejoon.scenes { public class App : MonoBehaviour { public Camera uiCamera; private void Awake() { //인스턴스가 로딩될 때 Object.DontDestroyOnLoad(this); } // Start is called before the first frame update void Start() { var oper = SceneManager.LoadSceneAsync("Logo"); oper.completed += (asyncOper) => { var logo = GameObject.FindObjectOfType<Logo>(); logo.Init(this.uiCamera); }; } // Update is called once per frame void Update() { } } } | cs |
'Unity > 과제' 카테고리의 다른 글
unity 지정된 몬스터 공격 및 대상 삭제 (0) | 2019.04.24 |
---|---|
FadIn,FadOut 코드 (0) | 2019.04.17 |
[Unity]코루틴 사용하여 캐릭터 이동 및 공격모션 (0) | 2019.04.17 |
유니티 게임시작화면관리하기 (0) | 2019.04.16 |
유니티 캐릭터생성 및 위치지정 (0) | 2019.04.15 |