Payment.cs
1.35 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
50
51
52
53
54
55
56
57
58
59
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
public class Payment : MonoBehaviour
{
public GameObject Pay;
public GameObject menu2;
public GameObject Tim;
[SerializeField] Text payText;
[SerializeField] Text Time_left;
float starttime = 0f;
float tim = 3f;
public void pay_money(int x)
{
menu2.SetActive(false);
Pay.SetActive(true);
ShowPoint.point2 += x;
}
public void change()
{
Pay.SetActive(false);
menu2.SetActive(true);
payText.text = "터치를\n3초 이상\n유지해주세요\n지문인식으로\n결제됩니다...";
}
// Update is called once per frame
void Update()
{
tim -= 1 * Time.deltaTime;
if (tim < 0)
tim = 0;
Time_left.text = Math.Round(tim, 1).ToString();
if (Input.GetMouseButtonDown(0))
{
tim = 3f;
Tim.SetActive(true);
starttime = Time.time;
}
if (Input.GetMouseButtonUp(0))
{
Tim.SetActive(false);
float delta = Time.time - starttime;
if(delta > 3f)
{
payText.text = "결제가\n완료되었습니다!";
Invoke("change", 2);
}
}
}
}