public static Recipe Random(int n, IngredientsManager mgr) { Recipe recipe = new Recipe(); recipe.Ingredients = mgr.GetRandomIngredients(n); return(recipe); }
private void Start() { GameManager gm = FindObjectOfType <GameManager>(); IngredientsManager ingredMgr = FindObjectOfType <IngredientsManager>(); List <Ingredient> spawns = new List <Ingredient>(); spawns.AddRange(ingredMgr.SpawnIngredients(gm.GoalRecipe.Ingredients)); spawns.AddRange(ingredMgr.SpawnIngredients(ingredMgr.GetRandomIngredients(n - spawns.Count))); Ingredient[] shuffled = ShuffleArray(spawns.ToArray()); for (int i = 0; i < n / 2; ++i) { shuffled[i].transform.position = spawnPointsLeft[0].position + Vector3.right * (3 * i); shuffled[i].GetComponent <Hover>().enabled = false; } for (int i = 0; i < n / 2; ++i) { shuffled[i + (n / 2)].transform.position = spawnPointsLeft[1].position + Vector3.right * (3 * i); shuffled[i + (n / 2)].GetComponent <Hover>().enabled = false; } }