gold_sprint_lpr/Assets/Scripts/GameScene/VideoManager.cs

38 lines
916 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;
public class VideoManager : MonoBehaviour {
private VideoPlayer videoPlayer;
public float speed {get; set; }
public float raceFinishTime = 30.0f;
void Start () {
speed = 0.0f;
videoPlayer = gameObject.AddComponent<VideoPlayer>();
// TODO: Aspect Ratio is not working?
videoPlayer.aspectRatio = VideoAspectRatio.FitOutside;
Debug.Log(videoPlayer.aspectRatio);
videoPlayer.url = "../video.webm";
videoPlayer.isLooping = true;
videoPlayer.playOnAwake = false;
videoPlayer.Prepare();
videoPlayer.Pause();
//videoPlayer.Play();
Run();
}
void Update () {
videoPlayer.playbackSpeed = speed;
}
void Run() {
videoPlayer.Play();
}
void WheelImpulse() {
}
}