using System.Collections.Generic; using Managers; using Types.Items; using Types.Map; using UnityEngine; namespace Data.ScriptableObjects.Items { [CreateAssetMenu(fileName = "SeedItem", menuName = "Game Data/Seed")] public class SeedItemSo : GameItemSo { public int growthTime; public List growSeasons; public CropItem Crop; // set type on instantiation public SeedItemSo() { type = ItemType.Seed; } public void Plant(Tile tile) { // checks if it's the correct season to be plantable. // checks if the tile is tilled and not occupied by another crop. // sets the tile to be occupied by the crop. // sets the crop to the correct growth stage. Debug.Log("Planting seed"); var cropInteractable = CropManager.Instance.GetCropByName(Crop.ItemName); cropInteractable.currentGrowthStage = 1; cropInteractable.SeedItem = Clone(); tile.SetInteractable(cropInteractable); } public new SeedItem Clone() { var clone = new SeedItem { ItemName = itemName, Icon = icon, ItemValue = itemValue, Rarity = rarity, Quantity = quantity, StackSize = stackSize, SellValue = sellValue, IsStackable = isStackable, IsEquippable = isEquippable, IsConsumable = isConsumable, IsQuestItem = isQuestItem, IsKeyItem = isKeyItem, IsCraftable = isCraftable, IsTradeable = isTradeable, IsSellable = isSellable, IsDroppable = isDroppable, IsDestroyable = isDestroyable, Crop = Crop, GrowthTime = growthTime, GrowSeasons = growSeasons }; return clone; } } }