39 lines
986 B
C#
39 lines
986 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;
|
|
public int videoID = 0;
|
|
|
|
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 = Application.streamingAssetsPath + "/" + videoID + ".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() {
|
|
}
|
|
}
|