Added saving of buildings
This commit is contained in:
@@ -1,26 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
using Fruitomation.Global;
|
||||
using UnityEngine;
|
||||
using Fruitomation.Global;
|
||||
using Fruitomation.Game;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Fruitomation.UI
|
||||
{
|
||||
public class BuildingMenu : MonoBehaviour
|
||||
{
|
||||
[System.Serializable] private class BuildingInfo
|
||||
{
|
||||
public string Name;
|
||||
public GameObject Prefab;
|
||||
}
|
||||
|
||||
[Header("References")]
|
||||
[SerializeField] private GameCursor Cursor;
|
||||
[SerializeField] private GameObject Menu;
|
||||
[SerializeField] private GameObject MenuGrid;
|
||||
[SerializeField] private GameObject MenuItemPrefab;
|
||||
|
||||
[Header("Options")]
|
||||
[SerializeField] private List<BuildingInfo> BuildingPrefabs;
|
||||
[SerializeField] private BuildingRegistry BuildingPrefabs;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
@@ -29,7 +21,7 @@ namespace Fruitomation.UI
|
||||
|
||||
private void Start()
|
||||
{
|
||||
foreach (BuildingInfo info in BuildingPrefabs)
|
||||
foreach (BuildingRegistry.BuildingInfo info in BuildingPrefabs.GetBuildings())
|
||||
{
|
||||
GameObject go = Instantiate(MenuItemPrefab, MenuGrid.transform);
|
||||
Text text = go.GetComponentInChildren<Text>();
|
||||
@@ -40,7 +32,7 @@ namespace Fruitomation.UI
|
||||
butt.onClick.AddListener(() =>
|
||||
{
|
||||
GameStateController.State = GameState.Building;
|
||||
Cursor.SetSelectedBuildingToBuild(info.Prefab);
|
||||
Cursor.SetSelectedBuildingToBuild(info);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user