60 lines
1.5 KiB
C#
60 lines
1.5 KiB
C#
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
using UnityEngine.UI;
|
||
|
|
using UnityEngine.Video;
|
||
|
|
|
||
|
|
public class GuiderEx : MonoBehaviour
|
||
|
|
{
|
||
|
|
public RectTransform tranGuider;
|
||
|
|
|
||
|
|
public VideoPlayer vpGuider;
|
||
|
|
|
||
|
|
public string urlGuider;
|
||
|
|
|
||
|
|
public string imgGuiderPath;
|
||
|
|
|
||
|
|
public RawImage rawMaskGuider;
|
||
|
|
|
||
|
|
public RawImage rawGuiderBG;
|
||
|
|
|
||
|
|
private void Start()
|
||
|
|
{
|
||
|
|
// StartCoroutine(ImageLoader<RawImage>.LoadImage(CommonData.UIImageFullPath + imgGuiderPath, rawGuiderBG));
|
||
|
|
// StartCoroutine(ImageLoader<RawImage>.LoadImage(CommonData.UIImageFullPath + imgGuiderPath, rawMaskGuider));
|
||
|
|
}
|
||
|
|
|
||
|
|
private void OnTriggerEnter(Collider other)
|
||
|
|
{
|
||
|
|
if (!vpGuider.isPlaying)
|
||
|
|
{
|
||
|
|
AudioManager.Instance.PauseBackgroundMusic();
|
||
|
|
vpGuider.targetTexture.Release();
|
||
|
|
vpGuider.url = CommonData.VideoFullPath + urlGuider;
|
||
|
|
vpGuider.Play();
|
||
|
|
rawGuiderBG.gameObject.SetActive(false);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private void OnTriggerExit(Collider other)
|
||
|
|
{
|
||
|
|
if (vpGuider.isPlaying)
|
||
|
|
{
|
||
|
|
rawGuiderBG.gameObject.SetActive(true);
|
||
|
|
vpGuider.Stop();
|
||
|
|
vpGuider.targetTexture.Release();
|
||
|
|
AudioManager.Instance.ResumeBackgroundMusic();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
Vector3 rot = Vector3.zero;
|
||
|
|
|
||
|
|
void Update()
|
||
|
|
{
|
||
|
|
tranGuider.LookAt(CommonData.MainCamera.transform);
|
||
|
|
rot.y = tranGuider.eulerAngles.y;
|
||
|
|
rot.x = 0;
|
||
|
|
tranGuider.eulerAngles = rot;
|
||
|
|
}
|
||
|
|
}
|