示例#1
0
    public void Update()
    {
        // game time handling
        if (m_data == null)
        {
            return;
        }
        m_data.m_timeElapsed += Time.deltaTime;
        if (m_data.m_timeElapsed > m_data.secondsPerDay)
        {
            m_data.days++;
            if (m_data.days % m_data.daysPerMonth == 0)
            {
                M_SettlersManager.STriggerMonth(m_data.days / m_data.daysPerMonth);
                M_BuildingManager.STriggerMonth(m_data.days / m_data.daysPerMonth);
            }
            if (m_data.days > m_data.daysPerMonth * m_data.monthsPerSeason * 4 &&
                m_data.year < m_data.maxYears)
            {
                m_data.year++;
                m_data.days = 0;

                M_BuildingManager.STriggerYear(m_data.year);
            }
            M_SettlersManager.STriggerDay(m_data.days);
            M_BuildingManager.STriggerDay(m_data.days);

            m_dayText.text        = m_data.days.ToString();
            m_data.m_timeElapsed -= m_data.secondsPerDay;
        }
    }