Scriptable Objects + Upgrade Menu
This commit is contained in:
31
Assets/Game/Scripts/SelectedItemMenu.cs
Normal file
31
Assets/Game/Scripts/SelectedItemMenu.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class SelectedItemMenu : MonoBehaviour
|
||||
{
|
||||
public Text nameTxt;
|
||||
public Button upgradeBtn;
|
||||
|
||||
public UpgradeMenuItem[] menus;
|
||||
void Start()
|
||||
{
|
||||
upgradeBtn.onClick.AddListener(OnUpgradeClicked);
|
||||
}
|
||||
|
||||
void OnUpgradeClicked(){
|
||||
//int relatedMenuIndex = -1;
|
||||
for(int i = 0; i < menus.Length; i++){
|
||||
menus[i].menuObject.SetActive(menus[i].relatedBuildings.Contains(Selector.selectedBuilding.buildingData));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
[System.Serializable]
|
||||
public class UpgradeMenuItem{
|
||||
public GameObject menuObject;
|
||||
public List<BuildingData> relatedBuildings;
|
||||
}
|
||||
Reference in New Issue
Block a user