Skip to content
This repository was archived by the owner on Aug 9, 2024. It is now read-only.

Commit fcd4c9e

Browse files
committed
FInished main quick level; Added some functionality to menu's but it's still a work in progress.
1 parent 2902f5f commit fcd4c9e

22 files changed

Lines changed: 7557 additions & 1011 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
/[Oo]bj/
44
/[Bb]uild/
55
/[Bb]uilds/
6+
/[Ss]ounds/
7+
/[Ss]ound/
68
/Assets/AssetStoreTools*
79

810
# Visual Studio 2015 cache directory

Assets/Scripts/Background.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
public class Background : MonoBehaviour {
6+
7+
private static Background instance = null;
8+
public static Background Instance {
9+
get { return instance; }
10+
}
11+
12+
public AudioSource Music;
13+
14+
// Use this for initialization
15+
void Awake () {
16+
17+
if (instance != null && Instance != null) {
18+
Destroy(this.gameObject);
19+
return;
20+
} else {
21+
instance = this;
22+
}
23+
24+
DontDestroyOnLoad(gameObject);
25+
}
26+
27+
void Start() {
28+
Music = GetComponent<AudioSource>();
29+
}
30+
}

Assets/Scripts/Background.cs.meta

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Scripts/Cam.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ public class Cam : MonoBehaviour {
88

99
Vector3 offset;
1010
Vector3 velocity;
11-
11+
12+
DeadMenu deadMenu;
1213

1314
// Use this for initialization
1415
void Start () {
1516
player = GameObject.FindWithTag("Player");
1617
offset = transform.position - player.transform.position;
1718
velocity = Vector3.zero;
19+
deadMenu = GameObject.FindWithTag("DeadMenu").GetComponent<DeadMenu>();
20+
deadMenu.gameObject.SetActive(false);
1821
}
1922

2023
void Update() {
@@ -29,8 +32,14 @@ void FixedUpdate () {
2932

3033
//If player is dead, we're going to end the game and bring up the menu
3134
void CheckDead() {
32-
if (!player.activeSelf) {
33-
//Debug.Log("You're dead kiddo");
35+
//If the player is dead...
36+
if (isDead()) {
37+
deadMenu.gameObject.SetActive(true);
38+
Time.timeScale = 0;
3439
}
3540
}
41+
42+
public bool isDead() {
43+
return !player.activeSelf;
44+
}
3645
}

Assets/Scripts/DeadMenu.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using UnityEngine.UI;
5+
using UnityEngine.SceneManagement;
6+
7+
public class DeadMenu : MonoBehaviour {
8+
9+
Button restart, options, exit, exitOptions;
10+
11+
12+
public OptMenu optMenu;
13+
14+
void Start() {
15+
restart = GameObject.FindWithTag("Restart").GetComponent<Button>();
16+
restart.onClick.AddListener(RestartGame);
17+
18+
options = GameObject.FindWithTag("Options").GetComponent<Button>();
19+
options.onClick.AddListener(OptionsMenu);
20+
21+
exit = GameObject.FindWithTag("Exit").GetComponent<Button>();
22+
23+
}
24+
25+
//Restart Methods
26+
void RestartGame() {
27+
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
28+
}
29+
30+
void OptionsMenu() {
31+
optMenu.OptionsMenu();
32+
}
33+
34+
}

Assets/Scripts/DeadMenu.cs.meta

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Scripts/OptMenu.cs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using UnityEngine.UI;
5+
6+
public class OptMenu : MonoBehaviour {
7+
8+
public Button exitOptions;
9+
10+
public Slider sfxVol, musVol;
11+
12+
public Toggle floatyControls;
13+
14+
AudioSource musAS;
15+
16+
Player player;
17+
18+
// Use this for initialization
19+
void Start () {
20+
player = GameObject.FindWithTag("Player").GetComponent<Player>();
21+
22+
//Options Menu Stuff
23+
24+
musAS = GameObject.FindWithTag("Background").GetComponent<AudioSource>();
25+
musVol.onValueChanged.AddListener(this.UpdateMusicVolumeFromSlider);
26+
27+
floatyControls.onValueChanged.AddListener(updateControllerScheme);
28+
29+
exitOptions.onClick.AddListener(OptionsMenu);
30+
31+
gameObject.SetActive(false);
32+
}
33+
34+
public void OptionsMenu() {
35+
gameObject.SetActive(!gameObject.activeSelf);
36+
}
37+
38+
// Update is called once per frame
39+
void Update () {
40+
41+
}
42+
43+
public void UpdateMusicVolumeFromSlider(float volume) {
44+
musAS.volume = volume;
45+
}
46+
47+
public void UpdateSFXVolumeFromSlider(float volume) {
48+
//TODO
49+
}
50+
51+
public void updateControllerScheme(bool isSpaceLike) {
52+
player.isSpaceLike = isSpaceLike;
53+
}
54+
}

Assets/Scripts/OptMenu.cs.meta

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Scripts/PauseMenu.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using UnityEngine.UI;
5+
using UnityEngine.SceneManagement;
6+
7+
public class PauseMenu : MonoBehaviour {
8+
9+
public Button cont, options, exit;
10+
11+
public OptMenu optMenu;
12+
13+
Player player;
14+
15+
void Start() {
16+
player = GameObject.FindWithTag("Player").GetComponent<Player>();
17+
18+
cont.onClick.AddListener(PauseOrUnpause);
19+
20+
options.onClick.AddListener(OptionsMenu);
21+
22+
23+
}
24+
25+
void OptionsMenu() {
26+
optMenu.OptionsMenu();
27+
}
28+
29+
void PauseOrUnpause() {
30+
player.isPaused = true;
31+
player.TrackGamePause();
32+
}
33+
34+
}

Assets/Scripts/PauseMenu.cs.meta

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)