Exemplo n.º 1
0
    private IEnumerator UpdateRoutine()
    {
        while (m_IsRunning)
        {
            var items = m_Layer.UIItems;
            for (int i = 0; i < items.Count; i++)
            {
                var item = items[i].Origin;
                item.time = DateTime.Now;

                var maxEnergy          = 0.0f;
                var maxAngleToSouth    = 0.0f;
                var maxAngleToHorisont = 0.0f;

                SolarMathController.GetEnergyMaxNow(MIN_ANGLE_TO_HORISONT, MAX_ANGLE_TO_HORISONT,
                                                    MIN_ANGLE_TO_SOUTH, MAX_ANGLE_TO_SOUTH,
                                                    item,
                                                    out maxEnergy,
                                                    out maxAngleToSouth,
                                                    out maxAngleToHorisont);

                var energy = maxEnergy;

                var row = m_Table.CreateRow();
                row[COORDINATES_COLUMN_NAME].text = item.Coordinates.ToString();
                row[ENERGY_COLUMN_NAME].text      = energy.ToString();
                row[AREA_COLUMN_NAME].text        = item.square.ToString();
                row[ClOUDS_COLUMN_NAME].text      = (1 - item.cloudiness).ToString();
                row[POWER_COLUMN_NAME].text       = item.power.ToString();
            }
            yield return(new WaitForSeconds(UPDATE_RATE));

            m_Table.Clear();
        }
    }
    private IEnumerator UpdateRoutine()
    {
        while (m_IsRunning)
        {
            var items = m_Layer.UIItems;
            for (int i = 0; i < items.Count; i++)
            {
                var item = items[i].Origin;
                item.time = DateTime.Now;

                var energy = WindMathController.GetEnergyNow(item);

                var row = m_Table.CreateRow();
                row[COORDINATES_COLUMN_NAME].text = item.Coordinates.ToString();
                row[ENERGY_COLUMN_NAME].text      = energy.ToString();
                row[HEIGHT_COLUMN_NAME].text      = item.heightWindmill.ToString();
                row[RADIUS_COLUMN_NAME].text      = item.radius.ToString();
                row[SPEED_COLUMN_NAME].text       = item.windSpeed.ToString();
            }
            yield return(new WaitForSeconds(UPDATE_RATE));

            m_Table.Clear();
        }
    }