Exemple #1
0
    void Start()
    {
        EventCenter.GetInstance().AddEventListener("TransitData", () => {
            _protagonist.UpdateHabbitSelect(_eatSelection.text, _sleepSelection.text, _sportSelection.text, _workSelection.text);
        });

        _protagonist = GameManager.instance.playerAgent.GetComponent <Protagonist>();
        _selector    = new Dictionary <string, HorizontalSelector>();

        HorizontalSelector[] viewers = transform.Find("Content").GetComponentsInChildren <HorizontalSelector>();
        foreach (var item in viewers)
        {
            _selector.Add(item.name, item);
        }

        for (int i = 0; i < 3; i++)
        {
            _selector["EatSelector"].itemList[i].itemTitle   = _protagonist.habbits.habbitDic["Eat"][i]._name;
            _selector["WorkSelector"].itemList[i].itemTitle  = _protagonist.habbits.habbitDic["Work"][i]._name;
            _selector["SleepSelector"].itemList[i].itemTitle = _protagonist.habbits.habbitDic["Sleep"][i]._name;
            _selector["SportSelector"].itemList[i].itemTitle = _protagonist.habbits.habbitDic["Sport"][i]._name;
        }
    }