FadIn,FadOut 코드
Unity/과제2019. 4. 17. 01:54
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 38 39 40 41 42 43 44 45 46 47 48 49 50 | 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() { //인스턴스가 로딩될 때 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.uiLogo.Init(this.uiCamera); StartCoroutine(logo.uiLogo.FadeIn()); logo.uiLogo.onFadeInCompleted = () => { Debug.Log("FadeIn완료"); StartCoroutine(logo.uiLogo.WaitForSeconds(3)); logo.uiLogo.onWaitForCecondsCompleted = () => { StartCoroutine(logo.uiLogo.FadeOut()); logo.uiLogo.onFadeOutCompleted = () => { Debug.Log("FadOut완료"); }; }; }; }; } // Update is called once per frame void Update() { } } } | cs |
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 updatevoid Start(){var oper = SceneManager.LoadSceneAsync("Logo");oper.completed += (asyncOper) =>{var logo = GameObject.FindObjectOfType<Logo>();logo.uiLogo.Init(this.uiCamera);StartCoroutine(logo.uiLogo.FadeIn());logo.uiLogo.onFadeInCompleted = () =>{Debug.Log("FadeIn완료");StartCoroutine(logo.uiLogo.WaitForSeconds(3));logo.uiLogo.onWaitForCecondsCompleted = () =>{StartCoroutine(logo.uiLogo.FadeOut());logo.uiLogo.onFadeOutCompleted = () =>{Debug.Log("FadOut완료");};};};};}// Update is called once per framevoid Update(){}}}
1 2 3 4 5 6 7 8 9 | using System.Collections; using System.Collections.Generic; using UnityEngine; public class UILogo : UIBase { } | cs |
1 2 3 4 5 6 7 8 9 | using System.Collections; using System.Collections.Generic; using UnityEngine; public class Logo : MonoBehaviour { public UILogo uiLogo; } | cs |
'Unity > 과제' 카테고리의 다른 글
unity 지정된 몬스터 공격 및 대상 삭제 (0) | 2019.04.24 |
---|---|
타이틀씬까지 로드 (0) | 2019.04.18 |
[Unity]코루틴 사용하여 캐릭터 이동 및 공격모션 (0) | 2019.04.17 |
유니티 게임시작화면관리하기 (0) | 2019.04.16 |
유니티 캐릭터생성 및 위치지정 (0) | 2019.04.15 |