Repository navigation
Expand file tree
/
Copy pathTitle.cs
More file actions
66 lines (54 loc) · 1.43 KB
/
Copy pathTitle.cs
File metadata and controls
66 lines (54 loc) · 1.43 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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Title : MonoBehaviour
{
[SerializeField] private AudioClip gameStartSound;
[SerializeField] private AudioClip selectSound;
private AudioSource audioSource;
// Start is called before the first frame update
void Start()
{
audioSource = GetComponent<AudioSource>();
}
// Update is called once per frame
void Update()
{
}
public void OnGameStartButtonPressed()
{
audioSource.PlayOneShot(gameStartSound, 0.8f);
Invoke(nameof(GameStart), 0.2f);
}
public void OnHowToButtonPressed()
{
audioSource.PlayOneShot(selectSound, 0.4f);
Invoke(nameof(ViewHowTo), 0.2f);
}
public void OnCreditsButtonPressed()
{
audioSource.PlayOneShot(selectSound, 0.4f);
Invoke(nameof(ViewCredits), 0.2f);
}
public void OnExitButtonPressed()
{
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}
private void GameStart()
{
SceneManager.LoadScene("Scenes/StageSelect", LoadSceneMode.Single);
}
private void ViewHowTo()
{
SceneManager.LoadScene("Scenes/HowTo", LoadSceneMode.Single);
}
private void ViewCredits()
{
SceneManager.LoadScene("Scenes/Credits", LoadSceneMode.Single);
}
}