This repository has been archived by the owner on Dec 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TitleControl.cs
82 lines (71 loc) · 2.4 KB
/
TitleControl.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
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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using System;
//Raul Rojas
//CSE 1302
//Project
//File Created: 7-11-2017
public class TitleControl : MonoBehaviour
{
public Button Play;
public Button HowToPlay;
public Button HighScores;
public Button Options;
public Button Credits;
public Button Exit;
private void Start()
{
Play.onClick.AddListener(pressedPlay);
HowToPlay.onClick.AddListener(pressedHowToPlay);
HighScores.onClick.AddListener(pressedHighScores);
Options.onClick.AddListener(pressedOptions);
Credits.onClick.AddListener(pressedCredits);
Exit.onClick.AddListener(pressedExit);
if (PlayerPrefs.GetInt(GameStructs.PrefKeys.MusicOn) == 1)
{
if (!AudioManager.instance.isPlaying(GameStructs.ClipName.TitleMusic))
{
AudioManager.instance.Play(GameStructs.ClipName.TitleMusic);
}
}
}
void pressedPlay()
{
//Debug.Log("You Pressed Play Button.");
AudioManager.instance.StopAll();
AudioManager.instance.Play(GameStructs.ClipName.ButtonClick);
SceneManager.LoadScene("GameScene", LoadSceneMode.Single);
}
void pressedHowToPlay()
{
//Debug.Log("You Pressed How to Play Button. ");
AudioManager.instance.Play(GameStructs.ClipName.ButtonClick);
SceneManager.LoadScene("Instructions", LoadSceneMode.Single);
}
void pressedHighScores()
{
//Debug.Log("You Pressed HighScores Button. ");
AudioManager.instance.Play(GameStructs.ClipName.ButtonClick);
SceneManager.LoadScene("HighScores", LoadSceneMode.Single);
}
void pressedOptions()
{
//Debug.Log("You Pressed Options Button. ");
AudioManager.instance.Play(GameStructs.ClipName.ButtonClick);
SceneManager.LoadScene("Options", LoadSceneMode.Single);
}
void pressedCredits()
{
AudioManager.instance.Play(GameStructs.ClipName.ButtonClick);
SceneManager.LoadScene("Credits", LoadSceneMode.Single);
}
void pressedExit()
{
AudioManager.instance.StopAll();
AudioManager.instance.Play(GameStructs.ClipName.ButtonClick);
Application.Quit();
}
}