/*private void UpdateTexts(String s) * { * String[] coln = s.Split('\t'); * * locationManager curr_loc = new locationManager(double.Parse(coln[(int)gpslogger.lat]), double.Parse(coln[(int)gpslogger.lng]), 0); * * if (strt_loc.lat > 0 && strt_loc.lng > 0) * { * curr_loc.dst = GetDistance(strt_loc.lat, strt_loc.lng, curr_loc.lat, curr_loc.lng); * * if (curr_loc.dst >= dist_100) * { * //Console.WriteLine("Id:" + a[0] + " strLat:" + start_lat + " strLng:" + start_lng + " curLat:" + currn_lat + " curLng:" + currn_lng + " curDis:" + currn_dst + " preDis:" + prevs_dst); * * String[] time = coln[(int)gpslogger.tim].Split('.'); // Separate the timestamp in GPS logger into second and milli * * double euclidean = Math.Abs(curr_loc.dst - dist_100) - Math.Abs(prev_loc.dst - dist_100); * if (euclidean > 0) * { * timeStamp info = new timeStamp(listGPS.Count, int.Parse(time[0]), int.Parse(time[1]), prev_loc, new inclinoMeter(double.Parse(coln[(int)gpslogger.acx]), double.Parse(coln[(int)gpslogger.acy])), true); * listGPS.Add(info); * * strt_loc = prev_loc; * strt20m_loc = prev_loc; * * dist_100 = 100 + (dist_100 - prev_loc.dst); * * Console.WriteLine(">> Save Previous GPS Record. distance:" + prev_loc.dst + " next interval:" + dist_100); * } * else * { * timeStamp info = new timeStamp(listGPS.Count, int.Parse(time[0]), int.Parse(time[1]), curr_loc, new inclinoMeter(double.Parse(coln[(int)gpslogger.acx]), double.Parse(coln[(int)gpslogger.acy])), true); * listGPS.Add(info); * * strt_loc = curr_loc; * strt20m_loc = curr_loc; * * dist_100 = 100 + (dist_100 - curr_loc.dst); * * Console.WriteLine(">> Save Current GPS Record. distance:" + curr_loc.dst + " next interval:" + dist_100); * } * * curr_loc.dst = GetDistance(strt_loc.lat, strt_loc.lng, curr_loc.lat, curr_loc.lng); * } * else * { * double currn20m_dst = GetDistance(strt20m_loc.lat, strt20m_loc.lng, curr_loc.lat, curr_loc.lng); * * if ((currn20m_dst >= dist_020) && (curr_loc.dst < 90.0)) * { * String[] time = coln[(int)gpslogger.tim].Split('.'); // Separate the timestamp in GPS logger into second and milli * * double euclidean = Math.Abs(currn20m_dst - dist_020) - Math.Abs(prev20m_loc.dst - dist_020); * * if (euclidean > 0) * { * timeStamp info = new timeStamp(listGPS.Count, int.Parse(time[0]), int.Parse(time[1]), prev_loc, 0, 0, false); * listGPS.Add(info); * * strt20m_loc = prev_loc; * * dist_020 = 20 + (dist_020 - prev20m_loc.dst); * Console.WriteLine(" - Save Previous GPS Record. distance:" + prev20m_loc.dst + " next interval:" + dist_020); * } * else * { * timeStamp info = new timeStamp(listGPS.Count, int.Parse(time[0]), int.Parse(time[1]), curr_loc, 0, 0, false); * listGPS.Add(info); * * strt20m_loc = curr_loc; * * dist_020 = 20 + (dist_020 - currn20m_dst); * Console.WriteLine(" - Save Current GPS Record. distance:" + currn20m_dst + " next interval:" + dist_020); * } * //Console.WriteLine(" - Id:" + coln[0] + " strLat:" + start20m_lat + " strLng:" + start20m_lng + " curLat:" + currn_lat + " curLng:" + currn_lng + " curDis:" + currn20m_dst + " preDis:" + prevs20m_dst); * currn20m_dst = GetDistance(strt20m_loc.lat, strt20m_loc.lng, curr_loc.lat, curr_loc.lng); * } * * prev20m_loc.dst = currn20m_dst; * } * prev_loc = curr_loc; * } * else * { * String[] time = coln[(int)gpslogger.tim].Split('.'); // Separate the timestamp in GPS logger into second and milli * dateSurvey = FromUnixTime(long.Parse(time[0])); * * strt_loc = curr_loc; * prev_loc = curr_loc; * strt_loc.dst = 0; * prev_loc.dst = 0; * * strt20m_loc = curr_loc; * prev20m_loc = curr_loc; * strt20m_loc.dst = 0; * prev20m_loc.dst = 0; * } * }*/ private void UpdateTexts(String s) { String[] coln = s.Split('\t'); locationManager curr_loc = new locationManager(double.Parse(coln[(int)gpslogger.lat]), double.Parse(coln[(int)gpslogger.lng]), double.Parse(coln[(int)gpslogger.bea]), double.Parse(coln[(int)gpslogger.acx]), double.Parse(coln[(int)gpslogger.acy])); if (strt_loc.lat > 0 && strt_loc.lng > 0) { curr_loc.dst = GetDistance(strt_loc.lat, strt_loc.lng, curr_loc.lat, curr_loc.lng); if (curr_loc.dst >= dist_50m) { String[] time = coln[(int)gpslogger.tim].Split('.'); // Separate the timestamp in GPS logger into second and milli double euclidean = Math.Abs(curr_loc.dst - dist_50m) - Math.Abs(prev_loc.dst - dist_50m); if (euclidean > 0) { timeStamp info = new timeStamp(listGPS.Count, int.Parse(time[0]), int.Parse(time[1]), prev_loc, !Convert.ToBoolean(listGPS.Count % 2)); listGPS.Add(info); strt_loc = prev_loc; dist_50m = 50.0 + (dist_50m - prev_loc.dst); Console.WriteLine(">> Save Previous GPS Record. distance:" + prev_loc.dst + " next interval:" + dist_50m + " is100m:" + Convert.ToBoolean(0 % 2) + " is100m:" + Convert.ToBoolean(1 % 2) + " is100m:" + Convert.ToBoolean(2 % 2)); } else { timeStamp info = new timeStamp(listGPS.Count, int.Parse(time[0]), int.Parse(time[1]), curr_loc, !Convert.ToBoolean(listGPS.Count % 2)); listGPS.Add(info); strt_loc = curr_loc; dist_50m = 50.0 + (dist_50m - curr_loc.dst); Console.WriteLine(">> Save Current GPS Record. distance:" + curr_loc.dst + " next interval:" + dist_50m + " is100m:" + Convert.ToBoolean(listGPS.Count % 2)); } curr_loc.dst = GetDistance(strt_loc.lat, strt_loc.lng, curr_loc.lat, curr_loc.lng); } prev_loc = curr_loc; } else { String[] time = coln[(int)gpslogger.tim].Split('.'); // Separate the timestamp in GPS logger into second and milli dateSurvey = FromUnixTime(long.Parse(time[0])); strt_loc = curr_loc; prev_loc = curr_loc; strt_loc.dst = 0; prev_loc.dst = 0; } }
IEnumerator popMonitor(timeStamp input) { yield return(new WaitForSeconds(input.startTime)); if (!input.isFake) { yemeOn[input.monitor] = true; } messages[input.monitor].SetActive(true); messages[input.monitor].GetComponent <Image>().sprite = input.sprite; yield return(new WaitForSeconds(input.holdingTime)); messages[input.monitor].SetActive(false); messages[input.monitor].GetComponent <Image>().sprite = null; yield return(new WaitForSeconds(0.03f)); yemeOn[input.monitor] = false; }
private List <timeStamp> makeTimeStamp(TKTLevel level) { List <timeStamp> tempStemps = new List <timeStamp>(); //chance만큼 진짜를 만듬 for (int i = 0; level.chance > i; i++) { timeStamp temp = new timeStamp(); temp.holdingTime = level.holdingTime; temp.isFake = false; temp.sprite = sprites[0]; tempStemps.Add(temp); } //페이크가 있으면 만듬 if (level.fake) { for (int i = 0; level.chance / 2 > i; i++) { timeStamp temp = new timeStamp(); temp.holdingTime = level.holdingTime; temp.isFake = true; temp.sprite = sprites[Random.Range(1, sprites.Count)]; tempStemps.Add(temp); } } List <timeStamp> output = new List <timeStamp>(); output = tempStemps; //순서 랜덤섞기 ShuffleList <timeStamp>(output); // 번호 붙이고 시간 매기기, 어떤 모니터에 나올지 결정 int order = 0; int postMonitor = Random.Range(0, level.monitorNum); foreach (timeStamp i in output) { while (true) { int currMonitor = Random.Range(0, level.monitorNum); if (!(postMonitor == currMonitor)) { i.monitor = currMonitor; postMonitor = currMonitor; break; } } i.order = order; i.startTime = ((gameTime - 1.0f) / (output.Count + 1)) * (order) + 1.0f; order++; } output.Sort(delegate(timeStamp a, timeStamp b) // 내림차순 정렬 { if (a.order < b.order) { return(-1); } else if (a.order > b.order) { return(1); } return(0); }); /* * foreach (timeStamp i in output) * { * Debug.Log(i.startTime + " : " + i.holdingTime + " : " + i.monitor + " : " + i.isFake + " : " + i.sprite + " : " + i.order); * } */ return(output); }