-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTutorial.cs
More file actions
84 lines (75 loc) · 1.86 KB
/
Tutorial.cs
File metadata and controls
84 lines (75 loc) · 1.86 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class Tutorial : MonoBehaviour {
public Text tutorialText;
public Text score;
private int stage = 0;
private bool forward = false;
private bool left = false;
private bool right = false;
private int initialScore;
void Update () {
if (stage == 0)
{
BasicMovementCheck();
}
else if (stage == 1)
{
JumpCheck();
}
else if (stage == 2)
{
KickFlipCheck();
}
ExitCheck();
}
void BasicMovementCheck()
{
if (Input.GetKey("w") && !forward)
{
forward = true;
}
if (Input.GetKey("a") && !left)
{
left = true;
}
if (Input.GetKey("d") && !right)
{
right = true;
}
if (forward && left && right)
{
stage = 1;
tutorialText.text = "Now try jumping using the spacebar!";
}
}
void JumpCheck()
{
if (Input.GetKey("space"))
{
stage = 2;
tutorialText.text = "Hold A or D in the air to do a flip! \n" +
"This will score you points based off of your speed!";
initialScore = Int32.Parse(score.text.Split('+')[0]);
}
}
void KickFlipCheck()
{
if (Int32.Parse(score.text.Split('+')[0]) >= initialScore + 50)
{
stage = 3;
tutorialText.text = "Congratulations! You have the basic controls down! \n" +
"Now try the full game and get creative! \n" +
"Press the escape key to return to the main menu.";
}
}
void ExitCheck()
{
if (Input.GetKey("escape"))
{
SceneManager.LoadScene(0);
}
}
}