예제 #1
0
    public void Plus_Age()
    {
        //+Месяц и проверка возраста
        foreach (Human item in main_family_list)
        {
            if (item.alive)
            {
                item.age.month++;
                item.age.age_check();
                item.Death();
            }
        }
        Debug.Log(protagonist.education.current_education.name);
        main_screen_script.New_Age(protagonist.age.years, protagonist.age.month);
        main_screen_script.Add_TextCode("2", protagonist.mother);
        foreach (Human item in main_family_list)
        {
            if (item.alive)
            {
                Education_Func(item);
            }
        }

        intelligence.text = protagonist.stats.intelligence + " " + protagonist.stats.intelligence_limit;
    }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        main_screen_script = GameObject.Find("Main Screen").GetComponent <Main_screen_Script>();

        GameObject.Find("Plus age Button").GetComponent <Button>().onClick.AddListener(Plus_Age);
        GameObject.Find("EL up Button").GetComponent <Button>().onClick.AddListener(Text_Up);
        GameObject.Find("EL down Button").GetComponent <Button>().onClick.AddListener(Text_Down);

        mark         = GameObject.Find("Mark_debug").GetComponent <Text>();
        intelligence = GameObject.Find("Intelligence_debug").GetComponent <Text>();


        string       line;
        StreamReader reader;
        TextAsset    reader_file = Resources.Load <TextAsset>("Education_places");

        if (reader_file != null)
        {
            using (reader = new StreamReader(new MemoryStream(reader_file.bytes)))
            {
                int i = 0;
                int g = 0;
                //-------------------------------------------------------
                while ((line = reader.ReadLine()) != null)
                {
                    education_places.Add(new Education_Place());
                    education_places[i].name            = line;
                    education_places[i].education_given = int.Parse(reader.ReadLine());
                    education_places[i].education_level = int.Parse(reader.ReadLine());
                    education_places[i].sphere          = reader.ReadLine();
                    education_places[i].months          = int.Parse(reader.ReadLine());
                    education_places[i].break_school    = int.Parse(reader.ReadLine());
                    g = 0;
                    if (education_places[i].education_given == 4)
                    {
                        g = 2;
                    }
                    for (int j = 0; j < g; ++j)
                    {
                        education_places[i].exams.Add(new Main_Exam());
                        string temp = reader.ReadLine();
                        for (int k = 0; k < temp.IndexOf("-"); ++k)
                        {
                            education_places[i].exams[j].name += temp[k];
                        }
                        temp = temp.Remove(0, temp.IndexOf("-") + 1);


                        education_places[i].exams[j].mark = int.Parse(temp);
                    }

                    g = 0;
                    if (education_places[i].education_given == 1)
                    {
                        g = 4;
                    }
                    else if (education_places[i].education_given == 2)
                    {
                        g = 4;
                    }
                    else if (education_places[i].education_given == 3)
                    {
                        g = 4;
                    }
                    else if (education_places[i].education_given == 4)
                    {
                        g = 4;
                    }
                    else
                    {
                        g = 0;
                    }
                    for (int j = 0; j < g; ++j)
                    {
                        education_places[i].schedule.Add(new Subject());
                        education_places[i].schedule[j].name = reader.ReadLine();
                    }
                    i++;
                }
                //-------------------------------------------------------
            }
        }



        protagonist = new Human(new Human(null, null, "father"), new Human(null, null, "mother"), "protagonist");
        main_family_list.Add(protagonist);
        main_family_list.Add(protagonist.father);
        main_family_list.Add(protagonist.mother);

        main_screen_script.New_Age(protagonist.age.years, protagonist.age.month);
        main_screen_script.Add_TextCode("2", protagonist.mother);
    }