-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSaveAndLoad.cs
More file actions
47 lines (40 loc) · 1.07 KB
/
SaveAndLoad.cs
File metadata and controls
47 lines (40 loc) · 1.07 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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using TMPro;
using System;
public class SaveAndLoad : MonoBehaviour
{
public TMP_Text buttonText;
public int Scene2Load;
public int AlternativeScene;
bool startGame;
void Update()
{
if (KeyboardScript.doneWithForm == 1 & startGame)
{
SceneManager.LoadSceneAsync(Scene2Load, LoadSceneMode.Single);
startGame = false;
}
else if(KeyboardScript.doneWithForm == 2 & startGame)
{
SceneManager.LoadSceneAsync(AlternativeScene, LoadSceneMode.Single);
startGame = false;
}
else if(startGame)
{
buttonText.text = "Please answer all the questions first";
Invoke("ClearText",5f);
startGame = false;
}
}
private void ClearText()
{
buttonText.text = "";
}
void OnTriggerEnter(Collider otr)
{
startGame = true;
}
}