Added mainmenu
This commit is contained in:
parent
77924dda40
commit
6a8b37bf05
5477
Assets/Scenes/MainMenu.unity
Normal file
5477
Assets/Scenes/MainMenu.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scenes/MainMenu.unity.meta
Normal file
7
Assets/Scenes/MainMenu.unity.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e00e1e3705465134eb4853ed0bef2506
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -145,6 +145,10 @@ PrefabInstance:
|
|||||||
propertyPath: player
|
propertyPath: player
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 1407792871}
|
objectReference: {fileID: 1407792871}
|
||||||
|
- target: {fileID: 1245760476298502058, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_IsActive
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 3203615922723506192, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
- target: {fileID: 3203615922723506192, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
propertyPath: player
|
propertyPath: player
|
||||||
value:
|
value:
|
||||||
|
|||||||
71
Assets/Scripts/MainMenuController.cs
Normal file
71
Assets/Scripts/MainMenuController.cs
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
|
public class MainMenuController : MonoBehaviour
|
||||||
|
{
|
||||||
|
public enum MenuMode {
|
||||||
|
MainMenu,
|
||||||
|
Options,
|
||||||
|
Help,
|
||||||
|
Leaderboard
|
||||||
|
}
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
TMP_Text titleLabel;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
Transform startMenuParent;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
Transform optionsParent;
|
||||||
|
[SerializeField]
|
||||||
|
Transform helpParent;
|
||||||
|
|
||||||
|
MenuMode? lastMode;
|
||||||
|
MenuMode mode;
|
||||||
|
|
||||||
|
private void Start() {
|
||||||
|
SetMenuMode(MenuMode.MainMenu);
|
||||||
|
}
|
||||||
|
public void SetMenuMode(MenuMode mode) {
|
||||||
|
//meh
|
||||||
|
titleLabel.gameObject.SetActive(mode == MenuMode.MainMenu);
|
||||||
|
startMenuParent.gameObject.SetActive(mode == MenuMode.MainMenu);
|
||||||
|
optionsParent.gameObject.SetActive(mode == MenuMode.Options);
|
||||||
|
helpParent.gameObject.SetActive(mode == MenuMode.Help);
|
||||||
|
if(this.mode == MenuMode.MainMenu)
|
||||||
|
lastMode = this.mode;
|
||||||
|
|
||||||
|
this.mode = mode;
|
||||||
|
// ResetMenuState();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnPlay(){
|
||||||
|
SceneManager.LoadScene("testing_art");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnOptions(){
|
||||||
|
SetMenuMode(MenuMode.Options);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnHelp(){
|
||||||
|
SetMenuMode(MenuMode.Help);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnLeaderboard(){
|
||||||
|
SetMenuMode(MenuMode.Leaderboard);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnBack(){
|
||||||
|
if (lastMode != null)
|
||||||
|
SetMenuMode(lastMode.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnQuit(){
|
||||||
|
Application.Quit();
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/MainMenuController.cs.meta
Normal file
11
Assets/Scripts/MainMenuController.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 63a136c2da9b90043bc035364152917d
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -5,7 +5,13 @@ EditorBuildSettings:
|
|||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Scenes:
|
m_Scenes:
|
||||||
|
- enabled: 0
|
||||||
|
path:
|
||||||
|
guid: 00000000000000000000000000000000
|
||||||
- enabled: 1
|
- enabled: 1
|
||||||
path: Assets/Scenes/SampleScene.unity
|
path: Assets/Scenes/MainMenu.unity
|
||||||
guid: 8c9cfa26abfee488c85f1582747f6a02
|
guid: e00e1e3705465134eb4853ed0bef2506
|
||||||
|
- enabled: 1
|
||||||
|
path: Assets/Scenes/testing_art.unity
|
||||||
|
guid: 99c9720ab356a0642a771bea13969a05
|
||||||
m_configObjects: {}
|
m_configObjects: {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user