// Function called when the cursor enters a garden plot public void WaterEnter(GameObject plot) { if (plantInfo.gameObject.activeSelf == false) { // If the plant info window is disabled, set the selected plot to the given plot and set isHovering to true selectedPlot = plot.GetComponent <GardenPlotScript>(); if (selectedPlot.plotState != 0) { isHovering = true; } } }
// Function called when a player uses the garden plot buttons public void SelectPlot(GameObject plot) { if (plantInfo.gameObject.activeSelf == false) { // If the plant info window is disabled, update the selected plot with the button that was pressed selectedPlot = plot.GetComponent <GardenPlotScript>(); if (!isWatering) { if (selectedPlot.plotState == 0) { // If the garden is not in watering mode & the plot has no plant, enable the seed select window if (seedSelect.activeSelf == false) { seedSelect.SetActive(true); } } else { // If the garden is not in watering mode & the plot does have a plant, enable the plant info window if (plantInfo.activeSelf == false) { plantInfo.SetActive(true); // Change the plant info title text to be equal to the plots plant type if (selectedPlot.plantType == "Sunflower") { plantTitle.text = "Sunflower"; } else if (selectedPlot.plantType == "Carrot") { plantTitle.text = "Carrot"; } } } } } }