mirror of
				https://github.com/DerTyp7/grow-ai-unity.git
				synced 2025-11-03 22:38:59 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			32 lines
		
	
	
		
			757 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			757 B
		
	
	
	
		
			C#
		
	
	
	
	
	
using System.Collections;
 | 
						|
using System.Collections.Generic;
 | 
						|
using UnityEngine;
 | 
						|
using UnityEngine.UI;
 | 
						|
using TMPro;
 | 
						|
 | 
						|
public class BuildingMenuSlot : MonoBehaviour
 | 
						|
{
 | 
						|
    public PlacedObjectTypeSO placedObjectTypeSO;  
 | 
						|
 | 
						|
    Image img;
 | 
						|
    Button btn;
 | 
						|
    TextMeshProUGUI textObj;
 | 
						|
 | 
						|
    void Start()
 | 
						|
    {
 | 
						|
        img = transform.Find("Image").gameObject.GetComponent<Image>();
 | 
						|
        btn = GetComponent<Button>();
 | 
						|
        textObj = transform.Find("Text").gameObject.GetComponent<TextMeshProUGUI>();
 | 
						|
 | 
						|
 | 
						|
        img.sprite = placedObjectTypeSO.iconSprite;
 | 
						|
        textObj.text = placedObjectTypeSO.nameString;
 | 
						|
        btn.onClick.AddListener(OnClick);
 | 
						|
    }
 | 
						|
 | 
						|
    void OnClick()
 | 
						|
    {
 | 
						|
        GridBuildingSystem.instance.SelectBuilding(placedObjectTypeSO);
 | 
						|
    }
 | 
						|
}
 |