コード例 #1
0
 public PlantedCropData(CropData cropData, Vector2Int position, int age, bool dehydrated, bool dead)
 {
     this.cropData   = cropData;
     this.position   = position;
     this.age        = age;
     this.dehydrated = dehydrated;
     this.dead       = dead;
 }
コード例 #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 SetCrop(CropData cropData)
 {
     this.cropData = cropData;
     UpdateSprite();
 }