mirror of
				https://github.com/DerTyp7/grow-ai-unity.git
				synced 2025-10-31 05:17:08 +01:00 
			
		
		
		
	idk
This commit is contained in:
		
							
								
								
									
										31
									
								
								Assets/BuildingMenuSlot.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								Assets/BuildingMenuSlot.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| 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); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 j.mei7
					j.mei7