Esempio n. 1
0
 private async Task AddChildrenInList(IEnumerable <string> names, string lastName, string adultId)
 {
     foreach (var name in names)
     {
         if (!await _manager.ChildExists(name, lastName, adultId))
         {
             _children.Add(await _manager.AddChildForUser(name, lastName, adultId));
         }
         else
         {
             _children.Add(await _manager.GetChild(name, lastName, adultId));
         }
     }
 }
Esempio n. 2
0
    // Use this for initialization
    void Awake()
    {
        // Create the UIs for each child and hide them at the start
        for (int i = 0; i < ChildManager.MaxChildCount; ++i)
        {
            GameObject ui = Instantiate(ChildUI, transform, false);
            ui.transform.localPosition = new Vector3(Spacing * i, 0, 0);

            ChildUIScript uiScript = ui.GetComponentInChildren <ChildUIScript>();
            uiScript.Child = ChildManager.GetChild(i);
            uiScript.gameObject.SetActive(false);

            childUIs.Add(uiScript);
        }

        // Do this in Awake so we can hook into events immediately
        ChildManager.ChildAdded     += ChildManager_ChildAdded;
        ChildManager.ChildKilled    += ChildManager_ChildKilled;
        ChildManager.ChildGraduated += UpdateChildUI;
    }