Example #1
0
    IEnumerator GraphObjectsIndexedGradient()
    {
        parent = new GameObject {
            name = "DataPoints"
        };
        parent.transform.position = Vector3.zero;
        parent.AddComponent <PointPositionHandler>();
        int currIndex = this.startIndex;

        while (!indexedAnimStopped)
        {
            while (MapStore.Instance.iconGOs.Count < numberOfValues)
            {
                SData   sData    = DataStore.Instance.sDataRecords.ElementAt(currIndex);
                Vector3 position = MapStore.Instance.map.GeoToWorldPosition(sData.latLon);
                position = sData.AdjustPosForDepth(position);
                GameObject go = Instantiate(dataPointPrefab, position, Quaternion.identity);
                go.transform.parent = parent.transform;
                MapStore.Instance.iconGOs.Add(go);
                LerpAnimation lA = go.GetComponent <LerpAnimation>();
                lA.Setup(sData, true, gradient);
                if (currIndex < DataStore.Instance.sDataRecords.Count - 1)
                {
                    currIndex++;
                }
                else
                {
                    currIndex = 0;
                }
            }
            yield return(new WaitForSeconds(secondsPerHour));
        }
    }
Example #2
0
    public void HandleScrubbing(List <DateTime> startAndEndTimes)
    {
        DateTime          startTime   = startAndEndTimes[0];
        DateTime          endTime     = startAndEndTimes[1];
        List <SData>      newDataList = DataStore.Instance.SliceTimes(startTime, endTime).dataList;
        List <GameObject> newIconList = new List <GameObject>();

        // Remove the previous go's since we don't do this is in the
        // lerp animation since we are scrubbing. We should find a better
        // solution for handling animations on data points
        foreach (GameObject go in MapStore.Instance.iconGOs)
        {
            Destroy(go);
        }

        foreach (SData sData in newDataList)
        {
            Vector3 position = MapStore.Instance.map.GeoToWorldPosition(sData.latLon);
            position = sData.AdjustPosForDepth(position);
            GameObject go = Instantiate(dataPointPrefab, position, Quaternion.identity);
            go.transform.parent = this.parent.transform;
            newIconList.Add(go);
            LerpAnimation lA = go.GetComponent <LerpAnimation>();
            lA.Setup(sData, false, gradient);
        }

        MapStore.Instance.iconGOs = newIconList;
    }
Example #3
0
    IEnumerator GraphObjectsTime()
    {
        parent = new GameObject {
            name = "DataPoints"
        };
        parent.transform.position = Vector3.zero;
        parent.AddComponent <PointPositionHandler>();
        int       currIndex  = DataStore.Instance.GetIndexTime(this.startTime);
        float     hoursToAdd = 3;
        DataSlice dataSlice;

        while (!timeAnimStopped)
        {
            dataSlice = DataStore.Instance.SliceIndexTime(currIndex, hoursToAdd);
            foreach (SData sData in dataSlice.dataList)
            {
                Vector3    position = MapStore.Instance.map.GeoToWorldPosition(sData.latLon);
                Vector3    adjPos   = sData.AdjustPosForDepth(position);
                GameObject go       = Instantiate(dataPointPrefab, adjPos, Quaternion.identity);
                go.transform.parent = parent.transform;
                MapStore.Instance.iconGOs.Add(go);
                LerpAnimation lA = go.GetComponent <LerpAnimation>();
                lA.Setup(sData, true, gradient);
            }
            if (dataSlice.lastIndex < DataStore.Instance.sDataRecords.Count)
            {
                currIndex = dataSlice.lastIndex;
            }
            else
            {
                currIndex = 0;
            }
            yield return(new WaitForSeconds(secondsPerHour));
        }
    }