-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainMenuController.cs
More file actions
61 lines (39 loc) · 1.28 KB
/
MainMenuController.cs
File metadata and controls
61 lines (39 loc) · 1.28 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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class MainMenuController : MonoBehaviour {
public GameObject quitImage;
public GameObject start2pImage;
public GameObject starteSpaceImage;
private Button quitButton;
private Button start2pButton;
private Button startSpaceButton;
public static int players = 2;
void Start() {
quitButton = quitImage.GetComponent<Button>();
start2pButton = start2pImage.GetComponent<Button>();
startSpaceButton = starteSpaceImage.GetComponent<Button>();
start2pButton.onClick.AddListener(Load2p);
startSpaceButton.onClick.AddListener(Load4p);
quitButton.onClick.AddListener(Quit);
}
public void Select2PButton()
{
start2pButton.GetComponent<Selectable>().Select();
}
public void SelectSpaceGame()
{
startSpaceButton.GetComponent<Selectable>().Select();
}
public void Quit() {
Application.Quit();
}
public void Load2p() {
SceneManager.LoadScene(1);
}
public void Load4p() {
SceneManager.LoadScene(2);
}
}