private void ToPlant(Collider2D collision) { PlantSpotComponent plantSpotComponent = collision.gameObject.GetComponent <PlantSpotComponent>(); if (plantSpotComponent == null) { return; } if (plantSpotComponent.GetInstanceID() != _interactableInstanceId) { return; } ActionSlotComponent selectedActionSlot = _uiManager.GetSelectedActionSlot(); if (!plantSpotComponent.CanAcceptNewSeed()) { return; } if (!selectedActionSlot.ItemCanBeUsedToPlant()) { return; } _isPlanting = true; _animatorVariables.PlantSpotComponent = plantSpotComponent; _animatorVariables.SelectedActionSlot = selectedActionSlot; _animator.ResetTrigger(_animatorVariables.PlantSeed); _animator.SetTrigger(_animatorVariables.PlantSeed); }
private PlantSpotComponent HarvestPlnantValidatios(Collider2D collision) { PlantSpotComponent plantSpotComponent = collision.gameObject.GetComponent <PlantSpotComponent>(); if (plantSpotComponent == null) { return(null); } if (plantSpotComponent.GetInstanceID() != _interactableInstanceId) { return(null); } if (!plantSpotComponent.IsReadyToHarvest()) { return(null); } return(plantSpotComponent); }