骑行数据逻辑调整

This commit is contained in:
lishuo committed 2021-04-27 20:28:03 +08:00
1 parent 8226b8a7c2
commit 00b9c7e796
15 files changed
+4173 -21344

No files matched your search

+7 -20
View File
@@ -110,6 +110,7 @@ namespace Assets.Scenes.Ride.Scripts
timer = 1.0f;
}
}
public bool stopRecord = false;
//骑行中
protected virtual void Run()
{
@@ -146,13 +147,14 @@ namespace Assets.Scenes.Ride.Scripts
{
distance = totalDistance - mapData.TotalDistance;
totalDistance = mapData.TotalDistance;
stopRecord = true;
StartCoroutine("LateUpload");
}
//数据处理
currentlatlong = Along(totalDistance);//下一个坐标
nextPos = map.GeoToWorldPosition(currentlatlong);//下一个点
nextPos.y += 0.6f;//提高y轴让人物站在地图上面
nextPos.y += 1f;//提高y轴让人物站在地图上面
prePos = transform.localPosition;//当前点
thisRotation = transform.localRotation;
//移动动画控制
@@ -169,10 +171,7 @@ namespace Assets.Scenes.Ride.Scripts
//计算功率 速度 当前骑行总里程(M)心率 踏频 等
protected virtual void Compute()
{
//power = 900;//功率
//speed = Helper.CalculateSpeed(elevation, 0, power, 65, 7);
//distance = Math.Round(speed / 3600, 6);
//totalDistance += distance;
}
//当前用户调用来上传骑行记录
public virtual void Upload()
@@ -224,24 +223,12 @@ namespace Assets.Scenes.Ride.Scripts
nextSlope = pointList[nextIndex].Grade;
nextSlopeDistance = sumDistance - totalDistance * 1000;
NextSlopeTotalDistance = pointList[nextIndex].Distance;
currentSlopeDistance = totalDistance * 1000 - (sumDistance - pointList[index].Distance);
currentSlopeDistance = CurrentDistance-( totalDistance * 1000 - (sumDistance - pointList[index].Distance));
}
public double PreElevation;
public double PreSlope;
//根据距离计算坐标
Vector2d Along(double endDistance)
{
if (mapData != null)
{
var list = mapData.List.Select(p => new GeoJSON.Net.Geometry.GeographicPosition(p.Point[0], p.Point[1]));
LineString lineString = new LineString(list);
var pt1 = Turf.Along(lineString, endDistance);
var ll = ((GeographicPosition)((GeoJSON.Net.Geometry.Point)pt1.Geometry).Coordinates);
return new Vector2d(ll.Latitude, ll.Longitude);
}
return currentlatlong;
}
#endregion
#region 人物移动与转向控制