Beispiel #1
0
        public static void Add(SandboxTile tile, int tier, int index)
        {
            string[][] recipes = reflectionCache.GetValue <string[][]>(tile.type.ToString());

            if (recipes.Length > tier)
            {
                string[] tierRecipes = recipes[tier];
                if (tierRecipes.Length > index)
                {
                    tile.productionOptions.Add(tierRecipes[index]);
                }
            }
        }
Beispiel #2
0
        public static string AddRandom(SandboxTile tile)
        {
            string[][] recipes = reflectionCache.GetValue <string[][]>(tile.type.ToString());

            string[] tierRecipes = recipes[Math.Min(Rng.Next(0, tile.tier), recipes.Length - 1)];
            string   s           = Utils.RandomElement(tierRecipes);

            if (tile.productionOptions.Contains(s))
            {
                return(null);
            }
            tile.productionOptions.Add(s);
            return(s);
        }