コード例 #1
0
    /// <summary>
    /// Checks plant state and updates to correct sprite
    /// </summary>
    private void UpdateSprite()
    {
        if (plantData == null)
        {
            plantSprite.PushClear();
            return;
        }
        switch (plantCurrentStage)
        {
        case PlantSpriteStage.None:
            plantSprite.PushClear();
            break;

        case PlantSpriteStage.FullyGrown:
            plantSprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.FullyGrownSprite);
            plantSprite.PushTexture();
            break;

        case PlantSpriteStage.Dead:
            plantSprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.DeadSprite);
            plantSprite.PushTexture();
            break;

        case PlantSpriteStage.Growing:
            if (growingPlantStage >= plantData.GrowthSprites.Count)
            {
                Logger.Log($"Plant data does not contain growthsprites for index: {growingPlantStage} in plantData.GrowthSprites. Plant: {plantData.Plantname}");
                return;
            }
            plantSprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.GrowthSprites[growingPlantStage]);
            plantSprite.PushTexture();
            break;
        }
    }
コード例 #2
0
    private void SyncStage(PlantSpriteStage newStage)
    {
        if (newStage == plantSyncStage)
        {
            return;
        }

        plantSyncStage = newStage;
        switch (plantSyncStage)
        {
        case PlantSpriteStage.None:
            plantSprite.PushClear();
            break;

        case PlantSpriteStage.FullyGrown:
            plantSprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.FullyGrownSprite);
            plantSprite.PushTexture();
            break;

        case PlantSpriteStage.Dead:
            plantSprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.DeadSprite);
            plantSprite.PushTexture();
            break;

        case PlantSpriteStage.Growing:
            plantSprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.GrowthSprites[growingPlantStage]);
            plantSprite.PushTexture();
            break;
        }
    }
コード例 #3
0
 public void SetUpFood()
 {
     SyncPlant(null, plantData.Name);
     SpriteHandler.spriteData = SpriteFunctions.SetupSingleSprite(plantData.ProduceSprite);
     SpriteHandler.PushTexture();
     SetupChemicalContents();
     SyncSize(SizeScale, 0.5f + (plantData.Potency / 100f));
 }
コード例 #4
0
    public void ReceiveMessage(string plantString, int growingStage, PlantSpriteStage spriteStage,
                               bool harvestSync, bool weedSync, bool waterSync, bool nutrimentSync)
    {
        plantSyncString = plantString;

        SyncHarvest(harvestSync);
        SyncWeed(weedSync);
        SyncWater(waterSync);
        SyncNutriment(nutrimentSync);

        if (DefaultPlantData.PlantDictionary.ContainsKey(plantSyncString))
        {
            plantData = DefaultPlantData.PlantDictionary[plantSyncString].plantData;
        }

        growingPlantStage = growingStage;

        plantSyncStage = spriteStage;

        if (plantData == null)
        {
            //FIXME "BOD PLZ FIX BOTANY PLANT DATA IS NULL!"
            return;
        }
        switch (plantSyncStage)
        {
        case PlantSpriteStage.None:
            plantSprite.PushClear();
            break;

        case PlantSpriteStage.FullyGrown:
            plantSprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.FullyGrownSprite);
            plantSprite.PushTexture();
            break;

        case PlantSpriteStage.Dead:
            plantSprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.DeadSprite);
            plantSprite.PushTexture();
            break;

        case PlantSpriteStage.Growing:
            if (growingPlantStage >= plantData.GrowthSprites.Count)
            {
                Logger.Log($"Plant data does not contain growthsprites for index: {growingPlantStage} in plantData.GrowthSprites. Plant: {plantData.Plantname}");
                return;
            }
            plantSprite.spriteData =
                SpriteFunctions.SetupSingleSprite(plantData.GrowthSprites[growingPlantStage]);
            plantSprite.PushTexture();
            break;
        }
    }
コード例 #5
0
ファイル: SeedPacket.cs プロジェクト: ynot01/unitystation
 public void SyncPlant(string _PlantSyncString)
 {
     PlantSyncString = _PlantSyncString;
     if (!isServer)
     {
         if (DefaultPlantData.PlantDictionary.ContainsKey(PlantSyncString))
         {
             plantData = DefaultPlantData.PlantDictionary[PlantSyncString].plantData;
         }
     }
     Sprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.PacketsSprite);
     Sprite.PushTexture();
 }
コード例 #6
0
ファイル: ClothingV2.cs プロジェクト: ynot01/unitystation
    //set up the sprites / config of this instance using the cloth data
    private void TryInit()
    {
        if (clothData is ClothingData clothingData)
        {
            var item = GetComponent <ItemAttributesV2>();
            spriteInfo = SetUpSheetForClothingData(clothingData);
            SetUpFromClothingData(clothingData.Base);

            switch (variantType)
            {
            case ClothingVariantType.Default:
                if (variantIndex > -1)
                {
                    if (!(clothingData.Variants.Count >= variantIndex))
                    {
                        SetUpFromClothingData(clothingData.Variants[variantIndex]);
                    }
                }

                break;

            case ClothingVariantType.Skirt:
                SetUpFromClothingData(clothingData.DressVariant);
                break;

            case ClothingVariantType.Tucked:
                SetUpFromClothingData(clothingData.Base_Adjusted);
                break;
            }
        }
        else if (clothData is ContainerData containerData)
        {
            var Item = GetComponent <ItemAttributesV2>();
            this.spriteInfo = SpriteFunctions.SetupSingleSprite(containerData.Sprites.Equipped);
            SetUpFromClothingData(containerData.Sprites);
        }
        else if (clothData is BeltData beltData)
        {
            var Item = GetComponent <ItemAttributesV2>();
            this.spriteInfo = SpriteFunctions.SetupSingleSprite(beltData.sprites.Equipped);
            SetUpFromClothingData(beltData.sprites);
        }
        else if (clothData is HeadsetData headsetData)
        {
            var Item    = GetComponent <ItemAttributesV2>();
            var Headset = GetComponent <Headset>();
            this.spriteInfo = SpriteFunctions.SetupSingleSprite(headsetData.Sprites.Equipped);
            SetUpFromClothingData(headsetData.Sprites);
            Headset.EncryptionKey = headsetData.Key.EncryptionKey;
        }
    }
コード例 #7
0
    /*public static SeedPacket CreateSeedPacketInstance(SeedPacket seedPacket)
     * {
     *      return new SeedPacket
     *      {
     *              name = seedPacket.name,
     *              Sprite = seedPacket.Sprite,
     *              plantData = PlantData.CreateNewPlant(seedPacket.plantData),
     *              defaultPlantData = seedPacket.defaultPlantData,
     *              PlantSyncString = seedPacket.plantData.Name
     *      };
     * }*/

    public void SyncPlant(string _OldPlantSyncString, string _PlantSyncString)
    {
        //EnsureInit();
        PlantSyncString = _PlantSyncString;

        /*if (!isServer)
         * {
         *      if (DefaultPlantData.PlantDictionary.ContainsKey(PlantSyncString))
         *      {
         *              plantData = DefaultPlantData.PlantDictionary[PlantSyncString].plantData;
         *      }
         * }*/
        Sprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.PacketsSprite);
        Sprite.PushTexture();
    }
コード例 #8
0
    private void SyncStage(PlantSpriteStage newStage)
    {
        if (newStage == plantSyncStage)
        {
            return;
        }

        plantSyncStage = newStage;
        if (plantData == null)
        {
            //FIXME: BOD PLZ FIX BOTANY PLANT DATA IS NULL!
            return;
        }
        switch (plantSyncStage)
        {
        case PlantSpriteStage.None:
            plantSprite.PushClear();
            break;

        case PlantSpriteStage.FullyGrown:
            plantSprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.FullyGrownSprite);
            plantSprite.PushTexture();
            break;

        case PlantSpriteStage.Dead:
            plantSprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.DeadSprite);
            plantSprite.PushTexture();
            break;

        case PlantSpriteStage.Growing:
            if (growingPlantStage >= plantData.GrowthSprites.Count)
            {
                Logger.Log($"Plant data does not contain growthsprites for index: {growingPlantStage} in plantData.GrowthSprites. Plant: {plantData.Plantname}");
                return;
            }
            plantSprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.GrowthSprites[growingPlantStage]);
            plantSprite.PushTexture();
            break;
        }

        //Force a refresh on nearby clients
        if (isServer)
        {
            SendUpdateToNearbyPlayers();
        }
    }
コード例 #9
0
    public void ReceiveMessage(string plantString, int growingStage, PlantSpriteStage spriteStage,
                               bool harvestSync, bool weedSync, bool waterSync, bool nutrimentSync)
    {
        plantSyncString = plantString;

        SyncHarvest(harvestSync);
        SyncWeed(weedSync);
        SyncWater(waterSync);
        SyncNutriment(nutrimentSync);

        if (DefaultPlantData.PlantDictionary.ContainsKey(plantSyncString))
        {
            plantData = DefaultPlantData.PlantDictionary[plantSyncString].plantData;
        }

        growingPlantStage = growingStage;

        plantSyncStage = spriteStage;
        switch (plantSyncStage)
        {
        case PlantSpriteStage.None:
            plantSprite.PushClear();
            break;

        case PlantSpriteStage.FullyGrown:
            plantSprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.FullyGrownSprite);
            plantSprite.PushTexture();
            break;

        case PlantSpriteStage.Dead:
            plantSprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.DeadSprite);
            plantSprite.PushTexture();
            break;

        case PlantSpriteStage.Growing:
            plantSprite.spriteData =
                SpriteFunctions.SetupSingleSprite(plantData.GrowthSprites[growingPlantStage]);
            plantSprite.PushTexture();
            break;
        }
    }
コード例 #10
0
 public void SyncPlant(string _OldPlantSyncString, string _PlantSyncString)
 {
     PlantSyncString = _PlantSyncString;
     if (!isServer)
     {
         if (DefaultPlantData.PlantDictionary.ContainsKey(PlantSyncString))
         {
             plantData = DefaultPlantData.PlantDictionary[PlantSyncString].plantData;
         }
     }
     SpriteHandler.spriteData = SpriteFunctions.SetupSingleSprite(plantData.ProduceSprite);
     SpriteHandler.PushTexture();
     if (ItemAttributesV2 == null)
     {
         ItemAttributesV2 = this.GetComponent <ItemAttributesV2>();
     }
     if (isServer && ItemAttributesV2 != null)
     {
         ItemAttributesV2.ServerSetArticleDescription(plantData.Description);
         ItemAttributesV2.ServerSetArticleName(plantData.Plantname);
     }
     this.name = plantData.Plantname;
 }
コード例 #11
0
    public static void Generate()
    {
        float         progressbarStep;
        float         progressbarState;
        DirectoryInfo d = new DirectoryInfo(Application.dataPath + @"\Textures\objects\hydroponics\growing");

        FileInfo[] Files     = d.GetFiles("*.png");    // \\Getting Text files
        var        ListFiles = new List <string>();

        dictonaryErrors = new Dictionary <string, string>();
        var PlantDictionary       = new Dictionary <string, DefaultPlantData>();
        var PlantDictionaryObject = new Dictionary <string, System.Object>();

        foreach (FileInfo file in Files)
        {
            ListFiles.Add(file.Name);
        }

        var food  = (Resources.Load(@"Prefabs\Items\Botany\food") as GameObject);
        var json  = (Resources.Load(@"Metadata\plants") as TextAsset).ToString();
        var plats = JsonConvert.DeserializeObject <List <Dictionary <string, object> > >(json);

        progressbarStep  = 1f / (plats.Count * ListFiles.Count);
        progressbarState = 0;
        foreach (var plat in plats)
        {
            EditorUtility.DisplayProgressBar("Step 1/3 Setting Sprites", "Loading plant: " + plat["name"], progressbarState);
            //\\foreach (var Datapiece in plat)
            //\\{
            //\\	Logger.Log(Datapiece.Key);
            //\\}

            var plantdata = PlantData.CreateNewPlant((PlantData)null);
            plantdata.ProduceObject = food;
            plantdata.Name          = plat["name"] as string;

            if (plat.ContainsKey("plantname"))
            {
                plantdata.Plantname = plat["plantname"] as string;
            }
            plantdata.Description = plat["Description"] as string;
            var species = "";
            if (plat.ContainsKey("species"))
            {
                species = (plat["species"] as string);
            }
            else
            {
                Debug.Log($"Unable to find 'species' tag for plant {plantdata.Name}, using 'seed_packet' instead");
                species = (plat["seed_packet"] as string);
                if (species.Contains("seed-"))
                {
                    species = species.Replace("seed-", "");
                }
                else if (species.Contains("mycelium-"))
                {
                    species = species.Replace("mycelium-", "");
                }
            };

            plantdata.PacketsSprite         = new SpriteSheetAndData();
            plantdata.PacketsSprite.Texture = (AssetDatabase.LoadAssetAtPath(@"Assets\textures\objects\hydroponics\seeds\" + (plat["seed_packet"] as string) + ".png", typeof(Texture2D)) as Texture2D);
            plantdata.PacketsSprite.setSprites();

            SpriteSheetAndData produceSprite = new SpriteSheetAndData();
            produceSprite.Texture = (AssetDatabase.LoadAssetAtPath(@"Assets\textures\objects\hydroponics\harvest\" + species + ".png", typeof(Texture2D)) as Texture2D);
            if (produceSprite.Texture == null)
            {
                produceSprite         = new SpriteSheetAndData();
                produceSprite.Texture = (AssetDatabase.LoadAssetAtPath(@"Assets\textures\objects\hydroponics\harvest\" + species + "pile.png", typeof(Texture2D)) as Texture2D);
            }
            if (produceSprite.Texture == null)
            {
                produceSprite         = new SpriteSheetAndData();
                produceSprite.Texture = (AssetDatabase.LoadAssetAtPath(@"Assets\textures\objects\hydroponics\harvest\" + species + "_leaves.png", typeof(Texture2D)) as Texture2D);
            }
            if (produceSprite.Texture == null)
            {
                produceSprite         = new SpriteSheetAndData();
                produceSprite.Texture = (AssetDatabase.LoadAssetAtPath(@"Assets\textures\objects\hydroponics\harvest\" + species + "pod.png", typeof(Texture2D)) as Texture2D);
            }
            if (produceSprite.Texture == null)
            {
                produceSprite         = new SpriteSheetAndData();
                produceSprite.Texture = (AssetDatabase.LoadAssetAtPath(@"Assets\textures\objects\hydroponics\harvest\" + species + "s.png", typeof(Texture2D)) as Texture2D);
            }
            if (produceSprite.Texture == null)
            {
                produceSprite         = new SpriteSheetAndData();
                produceSprite.Texture = (AssetDatabase.LoadAssetAtPath(@"Assets\textures\objects\hydroponics\harvest\" + species + "pepper.png", typeof(Texture2D)) as Texture2D);
            }
            produceSprite.setSprites();



            var dead_sprite = (plat.ContainsKey("dead_Sprite")) ? (plat["dead_Sprite"] as string) : species + "-dead";

            plantdata.DeadSprite         = new SpriteSheetAndData();
            plantdata.DeadSprite.Texture = (AssetDatabase.LoadAssetAtPath(@"Assets\textures\objects\hydroponics\growing\" + dead_sprite + ".png", typeof(Texture2D)) as Texture2D);
            plantdata.DeadSprite.setSprites();

            plantdata.GrowthSprites = new List <SpriteSheetAndData>();
            foreach (var ListFile in ListFiles)
            {
                if (ListFile.Contains(species))
                {
                    var Namecheck = ListFile;

                    /*Namecheck = Namecheck.Replace("growing_flowers_", "");
                     * Namecheck = Namecheck.Replace("growing_fruits_", "");
                     * Namecheck = Namecheck.Replace("growing_mushrooms_", "");
                     * Namecheck = Namecheck.Replace("growing_vegetables_", "");
                     * Namecheck = Namecheck.Replace("growing_", "");*/
                    Namecheck = Namecheck.Split('-')[0];

                    if (Namecheck == species)
                    {
                        EditorUtility.DisplayProgressBar("Step 1/3 Setting Sprites", $"Loading sprite '{ListFile}' for plant {plantdata.Name}", progressbarState);
                        if (!ListFile.Contains("-dead"))
                        {
                            if (!ListFile.Contains("-harvest"))
                            {
                                //\Assets\Resources\textures\objects\hydroponics\growing\growing_ambrosia_gaia-grow6.png
                                var _SpriteSheetAndData = new SpriteSheetAndData();
                                _SpriteSheetAndData.Texture = (AssetDatabase.LoadAssetAtPath(@"Assets\textures\objects\hydroponics\growing\" + ListFile, typeof(Texture2D)) as Texture2D);
                                _SpriteSheetAndData.setSprites();
                                plantdata.GrowthSprites.Add(_SpriteSheetAndData);

                                //If not found do at end
                            }
                            else
                            {
                                var _SpriteSheetAndData = new SpriteSheetAndData();
                                _SpriteSheetAndData.Texture = (AssetDatabase.LoadAssetAtPath(@"Assets\textures\objects\hydroponics\growing\" + ListFile, typeof(Texture2D)) as Texture2D);
                                _SpriteSheetAndData.setSprites();
                                plantdata.FullyGrownSprite = _SpriteSheetAndData;
                            }
                        }
                    }
                }
                if (plantdata.FullyGrownSprite == null)
                {
                    if (plantdata.GrowthSprites.Count > 0)
                    {
                        //This seems to be normal
                        plantdata.FullyGrownSprite = plantdata.GrowthSprites[plantdata.GrowthSprites.Count - 1];
                    }
                }

                progressbarState += progressbarStep;
            }
            //check if sprites are missing
            if (plantdata.PacketsSprite.Texture == null)
            {
                AppendError(plantdata.Name, $"Unable to find seed packet sprite for plant {plantdata.Name}");
            }
            //if (plantdata.ProduceSprite.Texture == null) {  }
            if (plantdata.DeadSprite.Texture == null)
            {
                AppendError(plantdata.Name, $"Unable to find dead sprite");
            }
            if (plantdata.GrowthSprites.Count == 0)
            {
                AppendError(plantdata.Name, $"Unable to find growth sprites for plant {plantdata.Name}");
            }
            if (plantdata.FullyGrownSprite == null)
            {
                AppendError(plantdata.Name, $"Unable to find fully grown sprite");
            }



            plantdata.WeedResistance = int.Parse(plat["weed_resistance"].ToString());
            plantdata.WeedGrowthRate = int.Parse(plat["weed_growth_rate"].ToString());
            plantdata.Potency        = int.Parse(plat["potency"].ToString());
            plantdata.Endurance      = int.Parse(plat["endurance"].ToString());
            plantdata.Yield          = int.Parse(plat["plant_yield"].ToString());
            plantdata.Lifespan       = int.Parse(plat["lifespan"].ToString());
            plantdata.GrowthSpeed    = int.Parse(plat["production"].ToString());

            if (plat.ContainsKey("genes"))
            {
                var genes = JsonConvert.DeserializeObject <List <string> >(plat["genes"].ToString());

                foreach (var gene in genes)
                {
                    if (gene == "Perennial_Growth")
                    {
                        plantdata.PlantTrays.Add(PlantTrays.Perennial_Growth);
                    }
                    else if (gene == "Fungal Vitality")
                    {
                        plantdata.PlantTrays.Add(PlantTrays.Fungal_Vitality);
                    }
                    else if (gene == "Liquid Contents")
                    {
                        plantdata.PlantTrays.Add(PlantTrays.Liquid_Content);
                    }
                    else if (gene == "Slippery Skin")
                    {
                        plantdata.PlantTrays.Add(PlantTrays.Slippery_Skin);
                    }
                    else if (gene == "Bluespace Activity")
                    {
                        plantdata.PlantTrays.Add(PlantTrays.Bluespace_Activity);
                    }
                    else if (gene == "Densified Chemicals")
                    {
                        plantdata.PlantTrays.Add(PlantTrays.Densified_Chemicals);
                    }
                    else if (gene == "Capacitive Cell Production")
                    {
                        plantdata.PlantTrays.Add(PlantTrays.Capacitive_Cell_Production);
                    }
                    else if (gene == "Weed Adaptation")
                    {
                        plantdata.PlantTrays.Add(PlantTrays.Weed_Adaptation);
                    }
                    else if (gene == "Hypodermic Prickles")
                    {
                        plantdata.PlantTrays.Add(PlantTrays.Hypodermic_Needles);
                    }
                    else if (gene == "Shadow Emission")
                    {
                        plantdata.PlantTrays.Add(PlantTrays.Shadow_Emission);
                    }
                    else if (gene == "Red Electrical Glow")
                    {
                        plantdata.PlantTrays.Add(PlantTrays.Red_Electrical_Glow);
                    }
                    else if (gene == "Electrical Activity")
                    {
                        plantdata.PlantTrays.Add(PlantTrays.Electrical_Activity);
                    }
                    else if (gene == "Strong Bioluminescence")
                    {
                        plantdata.PlantTrays.Add(PlantTrays.Strong_Bioluminescence);
                    }
                    else if (gene == "Bioluminescence")
                    {
                        plantdata.PlantTrays.Add(PlantTrays.Bioluminescence);
                    }
                    else if (gene == "Separated Chemicals")
                    {
                        plantdata.PlantTrays.Add(PlantTrays.Separated_Chemicals);
                    }
                }
            }



            //Creating/updating food prefabs
            if (plat.ContainsKey("produce_name"))
            {
                //load existing prefab variant if possible
                GameObject prefabVariant = (GameObject)AssetDatabase.LoadAssetAtPath(@"Assets/Resources/Prefabs/Items/Botany/" + plantdata.Name + ".prefab", typeof(GameObject));

                if (prefabVariant == null)
                {
                    GameObject originalPrefab = (GameObject)AssetDatabase.LoadAssetAtPath(@"Assets/Resources/Prefabs/Items/Botany/food.prefab", typeof(GameObject));
                    prefabVariant = PrefabUtility.InstantiatePrefab(originalPrefab) as GameObject;
                }
                else
                {
                    prefabVariant = PrefabUtility.InstantiatePrefab(prefabVariant) as GameObject;
                }



                var itemAttr = prefabVariant.GetComponent <ItemAttributesV2>();

                //Commented since this are normally private
                //itemAttr.initialName = plat["produce_name"] as string;
                //itemAttr.initialDescription = plat["description"] as string;
                //itemAttr.itemSprites = (new ItemsSprites() { InventoryIcon = produceSprite });

                //add sprite to food
                var spriteRenderer = prefabVariant.GetComponentInChildren <SpriteRenderer>();
                spriteRenderer.sprite = SpriteFunctions.SetupSingleSprite(produceSprite).ReturnFirstSprite();

                var newFood = prefabVariant.GetComponent <GrownFood>();

                //Set plant data for food
                newFood.plantData = plantdata;

                var newReagents = prefabVariant.GetComponent <ReagentContainer>();

                //add reagents to food
                if (plat.ContainsKey("reagents_add"))
                {
                    var Chemicals = JsonConvert.DeserializeObject <Dictionary <string, float> >(plat["reagents_add"].ToString());

                    var reagents = new List <string>();
                    var amounts  = new List <float>();
                    foreach (var Chemical in Chemicals)
                    {
                        //ChemicalDictionary[Chemical.Key] = (((int)(Chemical.Value * 100)) * (plantdata.Potency / 100f));
                        reagents.Add(Chemical.Key);
                        amounts.Add(((int)(Chemical.Value * 100)) * (plantdata.Potency / 100f));
                    }

                    //newReagents.Reagents = reagents;
                    //newReagents.Amounts = amounts;
                }

                plantdata.ProduceObject = PrefabUtility.SaveAsPrefabAsset(prefabVariant, @"Assets/Resources/Prefabs/Items/Botany/" + plantdata.Name + ".prefab");
            }
            else
            {
                plantdata.ProduceObject = null;
            }

            var DefaultPlantData = ScriptableObject.CreateInstance <DefaultPlantData>();
            DefaultPlantData.plantData = plantdata;
            //\\ Creates the folder path


            //\\ Creates the file in the folder path
            Logger.Log(plantdata.Name + " < PlantDictionary");
            PlantDictionary[plantdata.Name] = DefaultPlantData;

            if (plat.ContainsKey("mutates_into"))
            {
                PlantDictionaryObject[plantdata.Name] = plat["mutates_into"];
            }


            //\\Logger.Log(plantdata.GrowthSprites.Count.ToString());
        }



        progressbarStep  = 1f / PlantDictionary.Count;
        progressbarState = 0;
        var mutationNameList = new List <string>();

        foreach (var pant in PlantDictionary)
        {
            EditorUtility.DisplayProgressBar("Step 2/3 Setting Mutations", "Loading mutations for: " + pant.Value.plantData.Name, progressbarState += progressbarStep);
            if (PlantDictionaryObject.ContainsKey(pant.Value.plantData.Name))
            {
                var Mutations = JsonConvert.DeserializeObject <List <string> >(PlantDictionaryObject[pant.Value.plantData.Name].ToString());
                foreach (var Mutation in Mutations)
                {
                    if (!mutationNameList.Contains(Mutation))
                    {
                        mutationNameList.Add(Mutation);
                    }
                    if (Mutation.Length != 0)
                    {
                        if (PlantDictionary.ContainsKey(Mutation))
                        {
                            MutationComparison(pant.Value, PlantDictionary[Mutation]);
                            pant.Value.plantData.MutatesInTo.Add((DefaultPlantData)AssetDatabase.LoadAssetAtPath(@"Assets\Resources\ScriptableObjects\Plant default\" + PlantDictionary[Mutation].plantData.Name + ".asset", typeof(DefaultPlantData)));



                            if (PlantDictionary[Mutation].plantData.DeadSprite?.Texture == null)
                            {
                                if (pant.Value.plantData.DeadSprite?.Texture != null)
                                {
                                    PlantDictionary[Mutation].plantData.DeadSprite         = new SpriteSheetAndData();
                                    PlantDictionary[Mutation].plantData.DeadSprite.Texture = pant.Value.plantData.DeadSprite.Texture;
                                    PlantDictionary[Mutation].plantData.DeadSprite.setSprites();
                                }
                            }

                            if (PlantDictionary[Mutation].plantData.GrowthSprites.Count == 0)
                            {
                                PlantDictionary[Mutation].plantData.GrowthSprites = pant.Value.plantData.GrowthSprites;
                            }
                        }
                    }
                }
            }
        }
        progressbarStep  = 1f / PlantDictionary.Count;
        progressbarState = 0;
        foreach (var pant in PlantDictionary)
        {
            DefaultPlantData defaultPlant = AssetDatabase.LoadMainAssetAtPath(@"Assets\Resources\ScriptableObjects\Plant default\" + pant.Value.plantData.Name + ".asset") as DefaultPlantData;
            if (defaultPlant != null)
            {
                EditorUtility.DisplayProgressBar("Step 3/3 Saving ScriptObjects", "Updating asset: " + pant.Value.plantData.Name, progressbarState += progressbarStep);
                EditorUtility.CopySerialized(pant.Value, defaultPlant);
                AssetDatabase.SaveAssets();
            }
            else
            {
                EditorUtility.DisplayProgressBar("Step 3/3 Saving ScriptObjects", "Creating asset: " + pant.Value.plantData.Name, progressbarState += progressbarStep);
                defaultPlant = ScriptableObject.CreateInstance <DefaultPlantData>();
                EditorUtility.CopySerialized(pant.Value, defaultPlant);
                AssetDatabase.CreateAsset(pant.Value, @"Assets\Resources\ScriptableObjects\Plant default\" + pant.Value.plantData.Name + ".asset");
            }

            if (dictonaryErrors.ContainsKey(pant.Value.plantData.Name))
            {
                if (mutationNameList.Contains(pant.Value.plantData.Name))
                {
                    dictonaryErrors[pant.Value.plantData.Name] = $"Mutation {pant.Value.plantData.Name} has some missing sprites\n{dictonaryErrors[pant.Value.plantData.Name]}";
                    Debug.LogWarning(dictonaryErrors[pant.Value.plantData.Name]);
                }
                else
                {
                    dictonaryErrors[pant.Value.plantData.Name] = $"Plant {pant.Value.plantData.Name} has some missing sprites\n{dictonaryErrors[pant.Value.plantData.Name]}";
                    Debug.LogError(dictonaryErrors[pant.Value.plantData.Name]);
                }
            }
        }


        EditorUtility.ClearProgressBar();
        EditorUtility.DisplayDialog("Complete", "Generating default plant ScriptObjects complete", "Close");
    }