IEnumerator GraphObjectsIndexed() { parent = new GameObject { name = "DataPoints" }; parent.transform.position = Vector3.zero; parent.AddComponent <PointPositionHandlerDelete>(); int currIndex = this.startIndex; indexedAnimStopped = false; while (!indexedAnimStopped) { while (MapStore.Instance.secondaryIconGOs.Count < numberOfValues) { SData sData = DataStore.Instance.sDataRecords.ElementAt(currIndex); Vector3 pos = MapStore.Instance.secondaryMap.GeoToWorldPosition(sData.latLon); Vector3 adjPos = sData.AdjustPosForDepth(pos); GameObject go = Instantiate(dataPointPrefab, adjPos, Quaternion.identity); go.transform.parent = parent.transform; MapStore.Instance.secondaryIconGOs.Add(go); LerpAnimationDelete lA = go.GetComponent <LerpAnimationDelete>(); lA.Setup(sData, true, gradient); if (currIndex < DataStore.Instance.sDataRecords.Count - 1) { currIndex++; } else { currIndex = 0; } } yield return(new WaitForSeconds(secondsPerHour)); } }
/* * 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); * } * } */ 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.secondaryIconGOs) { Destroy(go); } foreach (SData sData in newDataList) { Vector3 position = MapStore.Instance.secondaryMap.GeoToWorldPosition(sData.latLon); position = sData.AdjustPosForDepth(position); GameObject go = Instantiate(dataPointPrefab, position, Quaternion.identity); go.transform.parent = this.parent.transform; newIconList.Add(go); LerpAnimationDelete lA = go.GetComponent <LerpAnimationDelete>(); lA.Setup(sData, false, gradient); } MapStore.Instance.secondaryIconGOs = newIconList; }
IEnumerator GraphObjectsTime() { parent = new GameObject { name = "DataPoints" }; parent.transform.position = Vector3.zero; parent.AddComponent <PointPositionHandlerDelete>(); 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.secondaryMap.GeoToWorldPosition(sData.latLon); Vector3 adjPos = sData.AdjustPosForDepth(position); GameObject go = Instantiate(dataPointPrefab, adjPos, Quaternion.identity); go.transform.parent = parent.transform; MapStore.Instance.secondaryIconGOs.Add(go); LerpAnimationDelete lA = go.GetComponent <LerpAnimationDelete>(); lA.Setup(sData, true, gradient); } if (dataSlice.lastIndex < DataStore.Instance.sDataRecords.Count) { currIndex = dataSlice.lastIndex; } else { currIndex = 0; } yield return(new WaitForSeconds(secondsPerHour)); } }