-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest_chap11.cs
More file actions
50 lines (35 loc) · 1.08 KB
/
Test_chap11.cs
File metadata and controls
50 lines (35 loc) · 1.08 KB
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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Test_chap11 : MonoBehaviour{
[SerializeField] private Text txt_name;
[SerializeField] private Image img_name;
[SerializeField] private Sprite sprite;
private bool isCoolTime=false;
private float currentTime=5f;
private float delayTime=5f;
void update(){
img_name.color=Color.red; //색 변화 가능
// img_name.sprite= 어쩌구 //sprite 변화 가능
//색 투명하게
Color color = img_name.color;
color.a=0f;
img_name.color=color;
if(isCoolTime){
currentTime-=Time.deltaTime;
img_name.fillAmount=currentTime/delayTime; //버튼이 빙글빙글 돌게됨
if(currentTime<=0){ //다시 누르면 다시 돌 수 있게
isCoolTime=false;
currentTime=delayTime;
img_name.fillAmount=currentTime;
}
}
}
// Start is called before the first frame update
public void Change()
{
txt_name.text="변경됨";
isCoolTime=true;
}
}