AR以及对战房间部分代码重构
This commit is contained in:
1 parent
fb4da81ce2
commit
a149a7c08e
13 files changed
+280
-262
No files matched your search
@@ -118,7 +118,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
if (animator != null)
|
||||
{
|
||||
animator.SetFloat(PreSpeed, (float)preSpeed);
|
||||
animator.SetFloat(AnimatorSpeed, (float)speed);
|
||||
animator.SetFloat(AnimatorSpeed, (float)OnlineSpeed);
|
||||
animator.SetFloat(Grade, (float)currentSlope);
|
||||
animator.SetFloat(Power, (float)power);
|
||||
}
|
||||
@@ -172,6 +172,10 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
}
|
||||
}
|
||||
public virtual void ComputeRecord() { }
|
||||
|
||||
private const double DoubleDelta = 1E-6;
|
||||
|
||||
private const double GradeFactor = 0.5f;
|
||||
//计算当前区段属性下一个区段属性
|
||||
public void ComputeNextSlope()
|
||||
{
|
||||
@@ -194,19 +198,20 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
break;
|
||||
}
|
||||
}
|
||||
var DOUBLE_DELTA = 1E-6;
|
||||
if (Math.Abs(totalDistance - mapData.TotalDistance) < DOUBLE_DELTA)
|
||||
|
||||
if (Math.Abs(totalDistance - mapData.TotalDistance) < DoubleDelta)
|
||||
{
|
||||
currentIndex = pointList.Count - 1;
|
||||
}
|
||||
Debug.Log(currentIndex);
|
||||
preIndex = currentIndex > 0 ? currentIndex - 1 : 0;//前一个索引
|
||||
int nextIndex = currentIndex == pointList.Count - 1 ? currentIndex : currentIndex + 1; //计算下一个点的坡度和距离
|
||||
|
||||
elevation = pointList[currentIndex].Elevation;
|
||||
currentSlope = pointList[currentIndex].Grade;
|
||||
currentSlope = pointList[currentIndex].Grade * GradeFactor;
|
||||
//CurrentDistance = pointList[currentIndex].Distance;
|
||||
//计算下一个海拔和坡度&当前区间距离
|
||||
nextSlope = pointList[nextIndex].Grade;
|
||||
nextSlope = pointList[nextIndex].Grade * GradeFactor;
|
||||
nextSlopeDistance = sumDistance - totalDistance * 1000;
|
||||
//NextSlopeTotalDistance = pointList[nextIndex].Distance;
|
||||
currentSlopeDistance = (totalDistance * 1000 - (sumDistance - pointList[currentIndex].Distance));
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Assets.Scenes.Ride.Scripts.Model;
|
||||
using Assets.Scenes.Ride.Scripts.Model.CyclingModels;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.Scripts.Scenes.VideoRide
|
||||
{
|
||||
@@ -16,11 +15,6 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
userName = App.CurrentUser.Nickname;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
}
|
||||
|
||||
public void SetEndDistance(double distance)
|
||||
{
|
||||
this.totalDistance = distance;
|
||||
@@ -39,11 +33,6 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
}
|
||||
}
|
||||
|
||||
public override void ComputeAnimator()
|
||||
{
|
||||
base.ComputeAnimator();
|
||||
}
|
||||
|
||||
public override void ComputePlayer()
|
||||
{
|
||||
heartRate = manager.UpDateHeart();
|
||||
@@ -77,7 +66,8 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
gameRoomHandled = true;
|
||||
var gap = model.FirstEndTime.Value - UIManager.Now.GetDateTime();
|
||||
var seconds = Math.Floor(gap.TotalSeconds);
|
||||
UIManager.ShowGameRoomCountDownPanel((int)seconds, () => {
|
||||
UIManager.ShowGameRoomCountDownPanel((int)seconds, () =>
|
||||
{
|
||||
Upload();
|
||||
var uiManager = FindObjectOfType<VideoUIManager>();
|
||||
uiManager.ShowResultPanel();
|
||||
@@ -85,10 +75,6 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
}
|
||||
}
|
||||
|
||||
public override void ComputeAnimatorSpeed()
|
||||
{
|
||||
base.ComputeAnimatorSpeed();
|
||||
}
|
||||
public override void ComputeRecord()
|
||||
{
|
||||
var mapData = manager.GetMapData();
|
||||
|
||||
Reference in new issue
Block a user