powerfun-unity/Assets/Scripts/Scenes/AR/OnlineVideoPlayer.cs

48 lines
1.5 KiB
C#
Raw Normal View History

2023-02-20 17:32:24 +08:00
using UnityEngine;
2022-03-10 18:32:53 +08:00
namespace Assets.Scripts.Scenes.VideoRide
{
public class OnlineVideoPlayer : AbstractVideoPlayer
{
public override void CreateHeadImage()
2022-07-06 17:48:55 +08:00
{
base.CreateHeadImage();
2022-12-08 19:17:34 +08:00
if (Diff < 0)
2023-05-15 15:11:50 +08:00
HideHeadRectTransform();
}
//隐藏其他玩家的头像
private void HideHeadRectTransform()
{
((RectTransform)head.transform).anchoredPosition = new Vector2(((RectTransform)head.transform).anchoredPosition.x, -800f);
2022-07-06 17:48:55 +08:00
}
2022-12-08 19:17:34 +08:00
public override void SetPlayer(string name, double speed, double preDistance, double endDistance, double cadance, double heartRate, double wkg, int userId, double power, double currentPlayerDistance, int frame)
2022-03-10 18:32:53 +08:00
{
2022-10-08 13:26:38 +08:00
if (manager == null)
{
manager = FindObjectOfType<VideoGameManager>();
}
this.wkg = wkg;
2022-12-05 18:29:49 +08:00
this.userName = name;
2022-03-24 09:36:59 +08:00
this.cadance = cadance;
2022-12-08 19:17:34 +08:00
this.totalDistance = endDistance;
2022-03-24 09:36:59 +08:00
this.heartRate = (int?)heartRate;
2022-12-05 18:29:49 +08:00
this.userId = userId;
this.power = power;
2022-12-08 19:17:34 +08:00
this.speed = speed;
2023-02-20 17:32:24 +08:00
this.Speed = speed;
this.OnlineSpeed = this.Speed/3.6f;
2022-12-08 19:17:34 +08:00
this.Diff = endDistance - currentPlayerDistance;
this.currentFrame = frame;
2022-12-08 19:17:34 +08:00
this.PreDistance = preDistance * 1000;
this.EndDistance = endDistance * 1000;
2023-02-20 17:32:24 +08:00
}
public override void ComputePlayer()
{
distance = this.speed;
2022-03-10 18:32:53 +08:00
}
}
}