void Start()
    {
        boxCollider2D = GetComponent <BoxCollider2D>();

        //furnace needs this as a reference
        theFurnace = GameObject.Find("Furnace").GetComponent <FurnaceScript>();
        //also spawning
        theSpawning = GameObject.Find("SpawningPoint").GetComponent <SpawningScript>();

        //the ingredients should fly towards this, if correct
        target = null;

        theChangeScene = GameObject.Find("Canvas").GetComponent <ChangeSceneScript>();

        theMoney = GameObject.Find("Money").GetComponent <MoneyScript>();

        theSPF = GameObject.Find("SpawningFoodLayer").GetComponent <SpawningFoodLayerScript>();
        theSPF.spawnfoodlayer();//

        foodlayerclone = GameObject.Find("FoodLayer(Clone)");

        theNextRecipe = GameObject.Find("NextRecipeButton").GetComponent <NextRecipeScript>();

        theGameMaster = GameObject.Find("GameMaster").GetComponent <GameMasterScript>();
    }
    // Start is called before the first frame update
    void Start()
    {
        theFurnace = GameObject.Find("Furnace").GetComponent <FurnaceScript>();

        //start by assigning spawning ingredients 'mostly' relevant to our current recipe
        if (theFurnace.recipe != null)
        {
            spawningredientsfromrecipe(ingredients);
        }
        else
        {
            foreach (GameObject ingr in ingredients)
            {
                ingredients_current.Add(ingr);
            }
        }

        //spawnallowed = false;//
        if (spawnallowed == true)
        {
            InvokeRepeating("SpawnIngredient", 0, 1 * gamespeed);
        }

        theGameMaster = GameObject.Find("GameMaster").GetComponent <GameMasterScript>();
    }
    // Start is called before the first frame update
    void Start()
    {
        recipenote = GetComponent <Text>();

        furnscript    = GameObject.Find("Furnace").GetComponent <FurnaceScript>();
        theGameMaster = GameObject.Find("GameMaster").GetComponent <GameMasterScript>();

        theNextRecipe = GameObject.Find("NextRecipeButton").GetComponent <NextRecipeScript>();

        speechbubble = GameObject.Find("SpeechBubble").GetComponent <SpriteRenderer>();

        firework     = Instantiate(firework);
        fireworkplay = firework.GetComponent <ParticleSystem>();

        if (GameObject.Find("IngredientsText") != null)
        {
            GameObject.Find("IngredientsText").GetComponent <Text>().text = theGameMaster.languagehandler["Ingredients"];
        }

        //assign smaller fontsize
        foreach (Image imagei in gameObject.GetComponent <RecipeCheckScript>().images)
        {
            imagei.GetComponentInChildren <Text>().fontSize = 20;
        }
    }
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
    // Start is called before the first frame update
    void Start()
    {
        renderer = GetComponent <SpriteRenderer>();

        theSPF = GameObject.Find("SpawningFoodLayer").GetComponent <SpawningFoodLayerScript>();

        target     = GameObject.Find("Furnace");
        movetoward = GameObject.Find("SpeechBubble");

        //load a base graphic
        //renderers[3].sprite = SpriteLayerBase(target.GetComponent<FurnaceScript>().recipe.name);

        theNextRecipe = GameObject.Find("NextRecipeButton").GetComponent <NextRecipeScript>();

        gameObject.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);

        theChangeScene = GameObject.Find("Canvas").GetComponent <ChangeSceneScript>();
        theFurnace     = GameObject.Find("Furnace").GetComponent <FurnaceScript>();

        theGameMaster = GameObject.Find("GameMaster").GetComponent <GameMasterScript>();

        theMoney = GameObject.Find("Money").GetComponent <MoneyScript>();

        gameObject.name = "FoodLayer(Clone)";

        /*make changes to the food layer for the following specific recipes*/

        //change ice cream's position to within the board's surface
        if (theFurnace.recipe.name.StartsWith("Salad"))
        {
            gameObject.transform.position = new Vector3(-0.3f, 0.2f, 0);
        }
        else if (theFurnace.recipe.name.StartsWith("IceCream"))
        {
            gameObject.transform.position = new Vector3(-0.3f, 0.8f, 0);
        }
        else if (theFurnace.recipe.name.StartsWith("Club"))//initialise club sandwich, if needed
        {
            int clchldrn;
            clchldrn = gameObject.transform.childCount;

            for (int i = 1; i < clchldrn; i++)
            {
                //Debug.Log("forloop");

                if (theFurnace.recipe.neededIngr.Count < i)
                {
                    gameObject.transform.GetChild(i - 1).GetComponent <Transform>().localPosition += new Vector3(0f, -0.175f * i + 0.05f * (i) + 0.1f, 0);
                    break;
                }
                // Debug.Log("i "+i+" neededingr "+theFurnace.recipe.neededIngr.Count);
                //Debug.Log(theFurnace.recipe.neededIngr[i-1]);

                //gameObject.transform.GetChild(i - 1).GetComponent<Transform>().localPosition = new Vector3(0f, 0.05f * (i-1), 0);
                gameObject.transform.GetChild(i - 1).GetComponent <Transform>().localPosition += new Vector3(0f, -0.175f * i + 0.05f * (i), 0);
                //Debug.Log("0.05*i-1=" + 0.05 * (i-1));

                if (theFurnace.recipe.neededIngr[i - 1] == "Potato")
                {
                    potatoeson = true;

                    //assign the base's position on potatoes
                    gameObject.transform.GetChild(i - 1).GetComponent <Transform>().localPosition = gameObject.transform.GetChild(clchldrn - 2).GetComponent <Transform>().localPosition;

                    gameObject.transform.GetChild(i - 1).GetComponent <SpriteRenderer>().sortingOrder = 4;
                }
            }
            for (int i = 1; i < clchldrn; i++)
            {
                gameObject.transform.GetChild(i - 1).GetComponent <Transform>().localPosition += new Vector3(0f, 0.175f, 0);
                if (potatoeson)
                {
                    gameObject.transform.GetChild(i - 1).GetComponent <SpriteRenderer>().sortingOrder++;
                    if (i == clchldrn - 1)
                    {
                        //gameObject.transform.GetChild(i).GetComponent<Transform>().localPosition += new Vector3(0f, -0.700f, 0);
                        gameObject.transform.GetChild(i).GetComponent <Transform>().localPosition = new Vector3(0f, theFurnace.recipe.neededIngr.Count * 0.05f, 0);
                    }
                }

                /*if ((i != (clchldrn - 2)))
                 * {
                 *  gameObject.transform.GetChild(i).GetComponent<Transform>().localPosition = new Vector3(0f, 0.05f * (i), 0);
                 *  if (theFurnace.recipe.neededIngr.Count>=i )
                 *  {
                 *      if (theFurnace.recipe.neededIngr[i] == "Potato")
                 *      {
                 *          Debug.Log("1");
                 *          if (i < clchldrn - 2)
                 *          {
                 *              Debug.Log("2");
                 *              gameObject.transform.GetChild(i).GetComponent<Transform>().localPosition = new Vector3(0f, 0f, 0);
                 *          }
                 *      }
                 *  }
                 * }*/
                /*else
                 * {
                 *  gameObject.transform.GetChild(i).GetComponent<Transform>().localPosition = new Vector3(0f, 0, 0);
                 * }*/

                //gameObject.transform.GetChild(i - 1).GetComponent<Transform>().localPosition += new Vector3(0f, 0.175f, 0);
            }

            gameObject.GetComponent <SpriteRenderer>().sprite       = theGameMaster.spriteslayers["Plate"];
            gameObject.GetComponent <SpriteRenderer>().sortingOrder = 4;
        }

        set_ingredient_distance();

        //Debug.Log("k");
    }