// ################
    // ## mise a jour des infos du repas
    // ################
    public void updateInfosRepas()
    {
        float totalPortions = 0.0f;

        foreach (GameObject obj in Plateau.GetComponent <scriptPlateau>().aliments)
        {
            PlateBlocAliment al = obj.GetComponent <PlateBlocAliment>();
            totalPortions += al.al.portions * al.nbSlices / al.al.slices;
        }

        infos.transform.GetChild(0).gameObject.GetComponent <Text>().text = "- nombre d'aliments : " + Plateau.GetComponent <scriptPlateau>().aliments.Count;
        infos.transform.GetChild(1).gameObject.GetComponent <Text>().text = "- nombre de portions : " + totalPortions.ToString();
    }
Exemple #2
0
    public void AddEatenAliment()
    {
        bool             alreadyAdd = false;
        string           testName   = MedicalAppManager.Instance().selectedAliment.GetComponent <PlateBlocAliment>().al.name;
        PlateBlocAliment temp;

        foreach (PlateBlocAliment al in EatenAliments)
        {
            if (al.al.name == testName)
            {
                alreadyAdd   = true;
                al.nbSlices += 1;
            }
        }
        if (!alreadyAdd)
        {
            temp          = new PlateBlocAliment();
            temp.al       = MedicalAppManager.Instance().selectedAliment.GetComponent <PlateBlocAliment>().al;
            temp.nbSlices = 1;
            EatenAliments.Add(temp);
        }
    }