powerfun-unity/Assets/Scripts/Scenes/AR/OnlineVideoPlayer.cs
2023-06-28 15:59:34 +08:00

48 lines
1.6 KiB
C#

using UnityEngine;
namespace Assets.Scripts.Scenes.VideoRide
{
public class OnlineVideoPlayer : AbstractVideoPlayer
{
protected override void CreateHeadImage()
{
base.CreateHeadImage();
if (Diff < 0)
HideHeadRectTransform();
}
//隐藏其他玩家的头像
private void HideHeadRectTransform()
{
((RectTransform)head.transform).anchoredPosition = new Vector2(((RectTransform)head.transform).anchoredPosition.x, -800f);
}
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)
{
if (manager == null)
{
manager = FindObjectOfType<VideoGameManager>();
}
this.wkg = wkg;
this.userName = name;
this.cadance = cadance;
this.totalDistance = endDistance;
this.heartRate = (int?)heartRate;
this.userId = userId;
this.power = power;
this.speed = speed;
this.Speed = speed;
this.OnlineSpeed = this.Speed/3.6f;
this.Diff = endDistance - currentPlayerDistance;
this.currentFrame = frame;
this.PreDistance = preDistance * 1000;
this.EndDistance = endDistance * 1000;
}
protected override void ComputePlayer()
{
distance = this.speed;
}
}
}