Nevar pievienot vairāk kā 25 tēmas
Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
|
- using System.Collections;
- using System.Collections.Generic;
- using Unity.VisualScripting;
- using UnityEngine;
- using UnityEngine.Video;
-
- public class Coltroller : MonoBehaviour
- {
- public VideoPlayer player;
- public List<VideoClip> clips = new List<VideoClip>();
- public List<GameObject> buttons = new List<GameObject>();
-
- int currentIndex = 0;
- List<int>[] jumpList = new List<int>[9];
-
- public List<int> endButtons_0 = new List<int>();
- public List<int> endButtons_1 = new List<int>();
- public List<int> endButtons_2 = new List<int>();
- public List<int> endButtons_3 = new List<int>();
- public List<int> endButtons_4 = new List<int>();
- public List<int> endButtons_5 = new List<int>();
- public List<int> endButtons_6 = new List<int>();
- public List<int> endButtons_7 = new List<int>();
- public List<int> endButtons_8 = new List<int>();
-
- private void Awake()
- {
- jumpList[0] = endButtons_0;
- jumpList[1] = endButtons_1;
- jumpList[2] = endButtons_2;
- jumpList[3] = endButtons_3;
- jumpList[4] = endButtons_4;
- jumpList[5] = endButtons_5;
- jumpList[6] = endButtons_6;
- jumpList[7] = endButtons_7;
- jumpList[8] = endButtons_8;
- }
-
- private void Start()
- {
- foreach (GameObject g in buttons)
- {
- if (g != null)
- {
- g.SetActive(false);
- }
- }
-
- buttons[0].SetActive(true);
- }
-
- void Update()
- {
- if (player.isPlaying)
- {
- double timeLeft = player.clip.length - player.time;
- if (timeLeft < 0.3)
- {
- player.Pause();
-
- foreach (int i in jumpList[currentIndex])
- {
- if (buttons[i] != null)
- {
- buttons[i].SetActive(true);
- }
- }
-
- }
- }
- }
-
-
- public void PlayVideo(int _index)
- {
- currentIndex = _index;
-
- player.clip = clips[_index];
- player.Play();
-
- foreach (GameObject g in buttons)
- {
- g.SetActive(false);
- }
- }
-
- public void Close()
- {
- Application.Quit();
- }
- }
|