-
Notifications
You must be signed in to change notification settings - Fork 0
/
dataFadeIn.cs
48 lines (37 loc) · 1.11 KB
/
dataFadeIn.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
36
37
38
39
40
41
42
43
44
45
46
47
48
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class dataFadeIn : MonoBehaviour
{
public GameObject desc, local;
public Image dataLocal;
// Start is called before the first frame update
void Start()
{
dataLocal.canvasRenderer.SetAlpha(0.0f);
}
private void Update()
{
Debug.Log(dataLocal.canvasRenderer.GetAlpha());
StartCoroutine(fadeInOut(3));
}
public void fadeIn()
{
Time.timeScale = 1;
dataLocal.CrossFadeAlpha(1, 3, true);
}
IEnumerator fadeInOut(float tempo)
{
if (dataLocal.canvasRenderer.GetAlpha() == 1f)
{
yield return new WaitForSecondsRealtime(tempo);
dataLocal.CrossFadeAlpha(0, 2, true);
yield return new WaitForSecondsRealtime(2);
//Time.timeScale = 1;
yield return new WaitForSecondsRealtime(1);
desc.SetActive(false);
local.SetActive(false);
}
}
}