40 lines
723 B
C#
40 lines
723 B
C#
using UnityEngine;
|
|
using UnityEngine.Video;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class PrologVideoController : MonoBehaviour
|
|
{
|
|
public VideoPlayer videoPlayer;
|
|
|
|
void Start()
|
|
{
|
|
videoPlayer.loopPointReached += OnVideoEnd;
|
|
}
|
|
|
|
void OnVideoEnd(VideoPlayer vp)
|
|
{
|
|
SceneManager.LoadScene("StorySelect");
|
|
}
|
|
|
|
// Optional: skip pakai klik / tombol
|
|
private float timer = 0f;
|
|
public float allowSkipAfter = 10f;
|
|
|
|
void Update()
|
|
{
|
|
timer += Time.deltaTime;
|
|
|
|
if (timer > allowSkipAfter)
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.Space))
|
|
{
|
|
SkipVideo();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void SkipVideo()
|
|
{
|
|
SceneManager.LoadScene("StorySelect");
|
|
}
|
|
} |