Example #1
0
        /// <summary>
        /// This functions returns a json string : id, scene id, date, frequency, list of spheres' coordinates
        /// </summary>
        /// <param name="List of sphere"></param>
        private static string ParseSoundToJson(IReadOnlyList <GameObject> spheresList)
        {
            var spheresCoord = new List <string>();

            foreach (var sphere in spheresList)
            {
                SphereCoords sphereCoords = new SphereCoords(sphere.GetComponent <Sphere>().Coordinates);
                spheresCoord.Add(JsonUtility.ToJson(sphereCoords));
            }

            var newSound = new Sound(SceneManager.GetActiveScene().buildIndex, SoundData.Instance.Frequency, spheresCoord);
            var json     = JsonUtility.ToJson(newSound);

            return(json);
        }
Example #2
0
        private static string ParseSoundToJson(List <GameObject> spheresList, int frequency)
        {
            var spheresCoord = new List <string>();

            for (var i = 0; i < spheresList.Count; i++)
            {
                SphereCoords sphereCoords = new SphereCoords(spheresList[i].GetComponent <Sphere>().WaveCoordData);
                spheresCoord.Add(JsonUtility.ToJson(sphereCoords));
            }

            var newSound = new Sound(SceneManager.GetActiveScene().buildIndex, SoundData.Instance.Frequency, spheresCoord);
            var json     = JsonUtility.ToJson(newSound);

            return(json);
        }
 // Use this for initialization
 void Start()
 {
     coords = GetComponent <SphereCoords>();
     cam    = GetComponent <Camera>();
 }