-
Notifications
You must be signed in to change notification settings - Fork 5
/
MasterSwitch_01.cs
49 lines (45 loc) · 1.23 KB
/
MasterSwitch_01.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
using UnityEngine;
namespace Section.Switch.Challenge01
{
public class MasterSwitch_01 : MonoBehaviour
{
/// Challenge Overview:
///
/// 01: Print a message based on the number of points
/// 50 points == message
/// 100 points == message
/// 0 points == need more points
///
/// Note: Must use switch statements
///
public int points;
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Q))
{
points = 50;
}
else if (Input.GetKeyDown(KeyCode.W))
{
points = 100;
}
else if (Input.GetKeyDown(KeyCode.E))
{
points = 0;
}
switch (points)
{
case 50:
Debug.Log("Points are 50!");
break;
case 100:
Debug.Log("Points are 100!");
break;
default:
Debug.Log("You need 50 or 100 points to recieve a message");
break;
}
}
}
}