forked from danielcollishaw/firefly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MenuSettings.cs
46 lines (42 loc) · 1.42 KB
/
MenuSettings.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
#region Copyright
/*---------------------------------------------------------------*/
/* File: MenuSettings.cs */
/* Firefly */
/* AI For Game Programming - CAP 4053 */
/* Copyright (c) 2023 Serenity Studios */
/* All rights reserved. */
/* Made with love, by Justin Sasso. */
/*---------------------------------------------------------------*/
#endregion
using System;
using UnityEngine;
using System.Collections.Generic;
using UnityEngine.SceneManagement;
public class MenuSettings : MonoBehaviour
{
[SerializeField]
private GameObject exitLevelObject;
[SerializeField]
private GameObject exitGameObject;
private void Start()
{
Scene activeScene = SceneManager.GetActiveScene();
if (activeScene.name == "Menu" || activeScene.buildIndex == 0)
{
exitLevelObject.SetActive(false);
exitGameObject.SetActive(false);
}
}
public void ExitLevel()
{
SceneManager.LoadScene("overworld/scenes/overworld", LoadSceneMode.Single);
}
public void ExitGame()
{
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}
}