Main Menu
Added Main Menu scene Tweaked world map to incorporate secondary colors in zone icons + glowing links Entity Serialization is now generic Zone Serialization now includes entities Fixed bug where wormhole traversal would unbind from player entity Game Manager no longer spawns entities (loadout file format changed) Wrote extension to randomly select weighted items from collections (for generating enemies)
This commit is contained in:
parent
1aef932162
commit
e6181c11dc
53 changed files with 3763 additions and 49169 deletions
46
Assets/Scripts/MainMenu.cs
Normal file
46
Assets/Scripts/MainMenu.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class MainMenu : MonoBehaviour
|
||||
{
|
||||
public TextMeshProUGUI Title;
|
||||
public Prototype ButtonPrototype;
|
||||
|
||||
private List<Prototype> _contents = new List<Prototype>();
|
||||
|
||||
void Start()
|
||||
{
|
||||
ShowMain();
|
||||
}
|
||||
|
||||
private void ShowMain()
|
||||
{
|
||||
Title.text = "aetheria\n<smallcaps><size=50%>terminus";
|
||||
Clear();
|
||||
AddButton("Continue", null);
|
||||
AddButton("New Game", null);
|
||||
AddButton("Load Game", null);
|
||||
AddButton("Settings", null);
|
||||
AddButton("Quit", Application.Quit);
|
||||
}
|
||||
|
||||
private void Clear()
|
||||
{
|
||||
foreach(var item in _contents)
|
||||
item.ReturnToPool();
|
||||
_contents.Clear();
|
||||
}
|
||||
|
||||
private void AddButton(string label, Action onPress)
|
||||
{
|
||||
var button = ButtonPrototype.Instantiate<Button>();
|
||||
button.GetComponent<TextMeshProUGUI>().text = label;
|
||||
button.onClick.RemoveAllListeners();
|
||||
button.onClick.AddListener(() => onPress?.Invoke());
|
||||
_contents.Add(button.GetComponent<Prototype>());
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue