示例#1
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));
    }
 /*
  * Inputs
  */
 private void UpdateInputs(GameObject panel)
 {
     if (panel == location_panel)
     {
         location_inputs[0].text = sunRotation.GetLatitude().ToString();
         location_inputs[1].text = sunRotation.GetLongitude().ToString();
         location_inputs[2].text = sunRotation.GetUTC().ToString();
     }
     else if (panel == date_panel)
     {
         DateTime dateTime = sunRotation.GetDateTime();
         date_inputs[0].text = dateTime.Day.ToString();
         date_inputs[1].text = dateTime.Month.ToString();
         date_inputs[2].text = dateTime.Year.ToString();
     }
     else
     {
         DateTime dateTime = sunRotation.GetDateTime();
         time_inputs[0].text = dateTime.Hour.ToString();
         time_inputs[1].text = dateTime.Minute.ToString();
     }
 }