public void CreateDeposit(bool Underground, int PercentageToReplace, string outputname, float minyield, float maxyield, string ItemToReplace)
 {
     if (Underground)
     {
         foreach (DepositLocationUnderground underground in depositunderground)
         {
             if (Random.Range(0, 100) <= PercentageToReplace)
             {
                 if ((ItemToReplace != null && underground.Ore == GetItem(ItemToReplace)) || ItemToReplace == null)
                 {
                     underground.Yield = UnityEngine.Random.Range(minyield, maxyield);
                     OreField.SetValue(underground, GetItem(outputname));
                 }
             }
         }
     }
     if (!Underground)
     {
         foreach (DepositLocationSurface surface in depositsurface)
         {
             if (Random.Range(0, 100) <= PercentageToReplace)
             {
                 if ((ItemToReplace != null && surface.Ore == GetItem(ItemToReplace)) || ItemToReplace == null)
                 {
                     surface.Yield = UnityEngine.Random.Range(minyield, maxyield);
                     OreField.SetValue(surface, GetItem(outputname));
                 }
             }
         }
     }
     QuestLog.Log("[Questing Update | Deposits]: Deposit Replacing " + ItemToReplace + " has been replaced with " + outputname);
 }
Пример #2
0
        ///-------------------------------------------------------------------------------------------------
        /// <summary>   Creates a deposit. </summary>
        ///
        /// <remarks>   MelodicAlbuild, 3/8/2021. </remarks>
        ///
        /// <param name="Underground">          If Deposit is Underground. </param>
        /// <param name="PercentageToReplace">  The percentage to replace. </param>
        /// <param name="outputname">           The outputname. </param>
        /// <param name="minyield">             The minyield. </param>
        /// <param name="maxyield">             The maxyield. </param>
        /// <param name="ItemToReplace">        The item to replace. </param>
        ///-------------------------------------------------------------------------------------------------

        public static void CreateDeposit(bool Underground, int PercentageToReplace, string outputname, float minyield, float maxyield, string ItemToReplace)
        {
            DepositLocationSurface[]     depositsurface     = Resources.FindObjectsOfTypeAll <DepositLocationSurface>();
            DepositLocationUnderground[] depositunderground = Resources.FindObjectsOfTypeAll <DepositLocationUnderground>();
            if (Underground)
            {
                foreach (DepositLocationUnderground underground in depositunderground)
                {
                    if (Random.Range(0, 100) <= PercentageToReplace)
                    {
                        if ((ItemToReplace != null && underground.Ore == GetItem(ItemToReplace)) || ItemToReplace == null)
                        {
                            underground.Yield = Random.Range(minyield, maxyield);
                            OreField.SetValue(underground, GetItem(outputname));
                        }
                    }
                }
            }
            if (!Underground)
            {
                foreach (DepositLocationSurface surface in depositsurface)
                {
                    if (Random.Range(0, 100) <= PercentageToReplace)
                    {
                        if ((ItemToReplace != null && surface.Ore == GetItem(ItemToReplace)) || ItemToReplace == null)
                        {
                            surface.Yield = Random.Range(minyield, maxyield);
                            OreField.SetValue(surface, GetItem(outputname));
                        }
                    }
                }
            }
        }