-
Notifications
You must be signed in to change notification settings - Fork 0
/
restart.cs
52 lines (43 loc) · 1.13 KB
/
restart.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
49
50
51
52
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using Valve.VR;
public class restart : MonoBehaviour
{
public GameObject score;
ScoreBox scorebox;
private AudioSource click;
public AudioClip hit;
// Start is called before the first frame update
void Start()
{
SteamVR_Fade.Start(Color.black, 0f);
SteamVR_Fade.Start(Color.clear, 1f);
score = GameObject.Find("ScoreBox");
scorebox = score.GetComponent<ScoreBox>();
click = gameObject.AddComponent<AudioSource>();
}
// Update is called once per frame
void Update()
{
}
public void OnCollisionEnter(Collision collision)
{
if (collision.gameObject)
{
click.PlayOneShot(hit);
SteamVR_Fade.Start(Color.black, 1f);
Invoke("ReStart", 1);
}
}
public void ReStart()
{
scorebox.getpoint = 0;
scorebox.combo = 0;
scorebox.combomax = 0;
scorebox.miss = 0;
scorebox.save = true;
SceneManager.LoadScene("Main");
}
}