void Update()
    {
        // Update date and time texts
        DateTime dateTime = sunRotation.GetDateTime();

        date_text.text = dateTime.ToString("d", CultureInfo.CreateSpecificCulture("en-US"));
        time_text.text = dateTime.ToString("t", CultureInfo.CreateSpecificCulture("fr-FR"));
    }
Beispiel #2
0
    public void ComputeShadowVariation(bool normalize)
    {
        float[,] intensities = new float[nbPointsParkX + 1, nbPointsParkZ + 1];

        DateTime time    = sunRotation.GetDateTime().Date;
        DateTime endTime = time.AddHours(endingHourSV);

        time = time.AddHours(beginningHourSV);
        float secondsStep = (float)endTime.Subtract(time).TotalSeconds / NB_SUN_POSITION;
        float caseWidth   = 1 / (float)nbPointsParkX;
        float caseHeight  = 1 / (float)nbPointsParkZ;

        for (int j = 0; j < nbPointsParkZ + 1; j++)
        {
            for (int i = 0; i < nbPointsParkX + 1; i++)
            {
                intensities[i, j] = GetAverageLightIntensity(transform.TransformPoint(new Vector3(i * caseWidth, 0, j * caseHeight)), time, secondsStep);
            }
        }
        if (normalize)
        {
            intensities = Normalize(intensities);
        }
        DisplayHeatmap(intensities);
    }
Beispiel #3
0
    private SceneData GetSceneData()
    {
        int n = transform.childCount;

        int[]        buildingsIndexes = new int[n];
        Vector3[]    positions        = new Vector3[n];
        Quaternion[] rotations        = new Quaternion[n];
        Vector3[]    scales           = new Vector3[n];
        Vector3      landmarkPosition = landmarkVisibility.GetLandmarkPosition();
        int          n_bar            = barParent.childCount;

        Vector3[] barPositions = new Vector3[n_bar];
        float     sunSpeed     = sunRotation.GetSpeed();
        double    latitude     = sunRotation.GetLatitude();
        double    longitude    = sunRotation.GetLongitude();
        float     UTCHours     = sunRotation.GetUTC();
        DateTime  dateTime     = sunRotation.GetDateTime();

        for (int i = 0; i < n; i++)
        {
            Transform child = transform.GetChild(i);
            int       index = child.name.IndexOf('(');
            string    indexStr;
            if (index != -1)
            {
                indexStr = child.name.Substring(0, index);
            }
            else
            {
                indexStr = child.name;
            }

            buildingsIndexes[i] = int.Parse(indexStr);
            positions[i]        = child.position;
            rotations[i]        = child.rotation;
            scales[i]           = child.localScale;
        }
        for (int i = 0; i < n_bar; i++)
        {
            barPositions[i] = barParent.GetChild(i).position;
        }

        return(new SceneData(buildingsIndexes, positions, rotations, scales, landmarkPosition, barPositions, sunSpeed, latitude, longitude, UTCHours, dateTime));
    }