Final.cs
1.21 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.SceneManagement;
public class Final : MonoBehaviour
{
GameObject follow; //커서
Vector3 pos;
private float timer1;
private float timer2;
public string SceneToLoad;
// Start is called before the first frame update
void Start()
{
follow = GameObject.Find("follow").gameObject;
pos = follow.transform.position;
timer1 = 0;
timer2 = 0;
}
// Update is called once per frame
void Update()
{
pos = follow.transform.position;
Debug.Log(pos);
if (pos.x >= 290 && pos.x <= 725 && pos.y >= 265 && pos.y <= 315 && pos.z == 200)
{
timer1 += Time.deltaTime;
if (timer1 > 2.5)
{
Debug.Log("Clicked");
SceneManager.LoadScene("Start");
}
}
if (pos.x >= 290 && pos.x <= 725 && pos.y >= 95 && pos.y <= 158 && pos.z == 200)
{
timer2 += Time.deltaTime;
if (timer2 > 2.5)
{
Debug.Log("Clicked");
SceneManager.LoadScene("Intro");
}
}
}
}