private IEnumerator ConfigureNewOrder() { // Generate the recipe Recipe recipe = recipes[Random.Range(0, recipes.Count)]; // Instantiate game objects GameObject card = RecipesContainer.GetInstance().AddCard(); GameObject plate = Instantiate(platePrefab); // Wait for objects to instantiate yield return(new WaitForEndOfFrame()); // Configure plate plate.transform.position = spawnPositions[Random.Range(0, spawnPositions.Count)]; plate.GetComponent <PlateController>().SetCard(card.GetComponent <RecipeCard>()); plate.GetComponent <PlateController>().SetRecipe(recipe); plate.GetComponent <PlateMovement>().SetSpeed(plateSpeed); // Configure recipe card card.GetComponent <RecipeCard>().SetOrderNumber(currentOrderNumber); card.GetComponent <RecipeCard>().SetPlate(plate.GetComponent <PlateController>()); card.GetComponent <RecipeCard>().SetRecipe(recipe); currentOrderNumber++; currentlyOpenOrders++; }
private IEnumerator DestroyOrder() { card.NotifyCompleted(); Destroy(card.gameObject); yield return(new WaitForSeconds(0.1f)); RecipesContainer.GetInstance().ReorderCards(); Destroy(gameObject); }