示例#1
0
 public void LoadPlantedCrops(PlantedCropData[] plantedCropDatas)
 {
     foreach (PlantedCropData cropData in plantedCropDatas)
     {
         PlantedCrop crop = Instantiate(plantedCropPrefab, cropData.position.TileToWorld(), Quaternion.identity);
         plantedCrops[cropData.position] = crop;
         crop.Load(cropData);
     }
 }
示例#2
0
        public void PlantCrop(Vector2Int tile, CropData cropData)
        {
            if (plantedCrops.ContainsKey(tile))
            {
                Debug.LogWarning($"Tile {tile} already has a crop!");
                return;
            }
            PlantedCrop crop = Instantiate(plantedCropPrefab, tile + new Vector2(0.5f, 0.5f), Quaternion.identity);

            plantedCrops[tile] = crop;
            crop.SetCrop(cropData);
        }
示例#3
0
 public void RemoveCrop(PlantedCrop crop)
 {
     RemoveCrop(plantedCrops.First(pair => pair.Value == crop).Key);
 }