private void OnMouseDown() { if (CropHarvestMiniGame.selectedTool != null) { if (CropHarvestMiniGame.selectedTool.toolType == MiniGameToolType.Clippers && !isTrimmed) { isTrimmed = true; Vector3 deadLeafPosition = transform.position; deadLeafPosition.y -= 1.5f; Instantiate(deadLeavesPrefab, deadLeafPosition, new Quaternion(), transform.parent); //Let mini game manager know that dead leaves are required to be thrown away in order to win. miniGameManager.IncrementRequiredScore(); pruneLevel = maxPruneLevel; AudioManager.instance.PlaySFX(trimCropSFX[Random.Range(0, trimCropSFX.Length)]); } if (CropHarvestMiniGame.selectedTool.toolType == MiniGameToolType.WateringCan && !isWatered) { isWatered = true; waterLevel = maxWaterLevel; AudioManager.instance.PlaySFX(waterCropSFX[Random.Range(0, waterCropSFX.Length)]); } if (CropHarvestMiniGame.selectedTool.toolType == MiniGameToolType.Fertilizer && !isFertilized) { isFertilized = true; AudioManager.instance.PlaySFX(fertilizeCropSFX[Random.Range(0, fertilizeCropSFX.Length)]); } if (CropHarvestMiniGame.selectedTool.toolType == MiniGameToolType.Seed && stage == CropStage.Unplanted) { stage = CropStage.Seedling; AudioManager.instance.PlaySFX(plantCropSFX[Random.Range(0, plantCropSFX.Length)]); } } }
private void Start() { originalColor = plantImage.color; miniGameManager = GameObject.FindGameObjectWithTag("MiniGameScoreManager").GetComponent <CropHarvestMiniGame>(); Vector3 position = transform.position; position.z -= 0.1f; harvestableCropPrefab = Instantiate(harvestableCropPrefab, position, new Quaternion(), transform.parent); harvestableCropPrefab.SetActive(false); //Let minGameManager know how many crops are needed to beat the mini game miniGameManager.IncrementRequiredScore(); StartCoroutine(DisplayNeeds()); }