using UnityEngine; public class CropVisuals : MonoBehaviour { [SerializeField] private GameObject[] growthStages; [SerializeField] private ItemSO plantItemSO; public InventoryManager inventoryManager { get; private set; } public SoilPlanting AssignedSoil { get; set; } private bool isReadyToHarvest; private void Awake() { inventoryManager = FindObjectOfType<InventoryManager>(); } public void ShowStages(int index) { for (int i = 0; i < growthStages.Length; i++) { bool isCurrent = i == index; growthStages[i].SetActive(isCurrent); if (isCurrent) isReadyToHarvest = index == growthStages.Length - 1; } if (isReadyToHarvest) Debug.Log("Crop is ready to harvest!"); } public void HarvestCrop() { if (!isReadyToHarvest) return; inventoryManager.AddItem(new Item { itemData = plantItemSO, amount = 3 }); isReadyToHarvest = false; AssignedSoil.ResetSoil(); Destroy(gameObject); Debug.Log("Crop harvested!"); } }