using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class Test_FadeInMain : MonoBehaviour
{
[SerializeField]
private Image dim;
private System.Action onFadeInComplete;
// Start is called before the first frame update
void Start()
{
this.onFadeInComplete = () => {
//영웅추가
};
this.StartCoroutine(this.FadeIn());
}
private IEnumerator FadeIn()
{
Color color = this.dim.color;
//어두워져야함
while (true)
{
color.a -= 0.01f;
this.dim.color = color;
Debug.Log(this.dim.color.a);
if (this.dim.color.a <= 0)
{
break;
}
yield return null;
}
this.onFadeInComplete();
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class Test_FadeOutMain : MonoBehaviour
{
[SerializeField]
private Image dim;
private System.Action onFadeOutComplete;
// Start is called before the first frame update
void Start()
{
this.onFadeOutComplete = () => {
//씬전환
SceneManager.LoadScene("Test_FadeIn");
};
this.StartCoroutine(this.FadeOut());
}
private IEnumerator FadeOut()
{
Color color = this.dim.color;
//어두워져야함
while(true)
{
color.a += 0.01f;
this.dim.color = color;
Debug.Log(this.dim.color.a);
if(this.dim.color.a >= 1)
{
break;
}
yield return null;
}
this.onFadeOutComplete();
}
}