Пример #1
0
    public void CheckSteps()
    {
        string s_best, s_curr;

        best_steps = 0;
        steps      = 0;
        if (game_master_script != null)
        {
            best_steps = achievement_script.GetSteps(game_master_script.b_index);
            steps      = game_master_script.undo_stack.Count;
        }

        s_best = "Previous Best: ";
        s_curr = "Steps: ";

        if (best_steps == 0)
        {
            s_best += "NA";
        }
        else
        {
            s_best += best_steps.ToString();
        }
        s_curr += steps;

        GameObject step_counter = GameObject.Find("nmbr_steps").gameObject;

        step_counter.GetComponentInChildren <Text>().text = s_best + ", " + s_curr;
    }
Пример #2
0
    // Start is called before the first frame update
    void Start()
    {
        nmr_scns           = SceneManager.sceneCountInBuildSettings;
        achievement_script = achievement.GetComponent <AchievementSystem>();

        for (int i = 1; i < nmr_scns; i++)
        {
            GameObject go = (GameObject)Instantiate(button_prefab);
            go.transform.SetParent(this.transform, false);

            Button btn = go.GetComponent <Button>();
            int    tmp = i;

            btn.onClick.AddListener(() => SelectLevel(tmp));
            string txt = tmp.ToString();
            txt += ("\n " + "Steps: " + achievement_script.GetSteps(i));
            btn.GetComponentInChildren <Text>().text = txt;
        }

        fade_script = fade_obj.GetComponent <Fade>();
        fade_obj.SetActive(false);
        selected_level = -1;
    }