92 lines
2.4 KiB
C#
92 lines
2.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class LogoManager : MonoBehaviour
|
|
{
|
|
public Image fader;
|
|
|
|
public List<GameObject> logoList = new List<GameObject>();
|
|
|
|
public int currentLogo;
|
|
|
|
public float logoTime = 3f;
|
|
|
|
public float scaleTarget = 1.1f;
|
|
|
|
public bool changeScene = true;
|
|
|
|
public Camera splashCamera;
|
|
|
|
private void Start()
|
|
{
|
|
if (VRManager.IsVROn())
|
|
{
|
|
GetComponent<Canvas>().renderMode = RenderMode.WorldSpace;
|
|
GetComponent<RectTransform>().localScale *= VRManager.GetUIResolutionFactor();
|
|
splashCamera.GetComponent<CameraFilterPack_Distortion_Water_Drop>().enabled = false;
|
|
Object.DestroyImmediate(splashCamera.GetComponent<CameraFilterPack_Distortion_Water_Drop>());
|
|
}
|
|
fader.color = new Color(0f, 0f, 0f, 1f);
|
|
foreach (GameObject logo in logoList)
|
|
{
|
|
logo.SetActive(false);
|
|
}
|
|
StartCoroutine(ChangeLogo());
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (VRManager.IsVROn())
|
|
{
|
|
if (OVRInput.GetUp(OVRInput.Button.PrimaryIndexTrigger) || OVRInput.GetUp(OVRInput.Button.SecondaryIndexTrigger) || OVRInput.GetUp(OVRInput.Button.PrimaryHandTrigger) || OVRInput.GetUp(OVRInput.Button.SecondaryHandTrigger))
|
|
{
|
|
LoadScene();
|
|
}
|
|
}
|
|
else if (Input.anyKeyDown)
|
|
{
|
|
LoadScene();
|
|
}
|
|
}
|
|
|
|
public IEnumerator ChangeLogo()
|
|
{
|
|
float fadeSpeed = 3f;
|
|
if (currentLogo >= logoList.Count)
|
|
{
|
|
LeanTween.color(fader.rectTransform, new Color(0f, 0f, 0f, 1f), fadeSpeed - 0.1f).setEaseInOutQuad();
|
|
Debug.Log("ChangeLogo 1");
|
|
yield return new WaitForSeconds(fadeSpeed);
|
|
yield return new WaitForSeconds(1f);
|
|
LoadScene();
|
|
yield break;
|
|
}
|
|
if (currentLogo > 0)
|
|
{
|
|
LeanTween.color(fader.rectTransform, new Color(0f, 0f, 0f, 1f), fadeSpeed - 0.1f).setEaseInOutQuad();
|
|
Debug.Log("ChangeLogo 2");
|
|
yield return new WaitForSeconds(fadeSpeed);
|
|
yield return new WaitForSeconds(1f);
|
|
logoList[currentLogo - 1].SetActive(false);
|
|
}
|
|
logoList[currentLogo].SetActive(true);
|
|
LeanTween.color(fader.rectTransform, new Color(0f, 0f, 0f, 0f), fadeSpeed - 0.1f).setEaseInOutQuad();
|
|
LeanTween.scale(logoList[currentLogo], Vector3.one * scaleTarget, 7f);
|
|
Debug.Log("ChangeLogo 3");
|
|
yield return new WaitForSeconds(fadeSpeed);
|
|
yield return new WaitForSeconds(logoTime);
|
|
currentLogo++;
|
|
StartCoroutine(ChangeLogo());
|
|
}
|
|
|
|
public void LoadScene()
|
|
{
|
|
if (changeScene)
|
|
{
|
|
LoadingManager.LoadScene("MainMenu");
|
|
}
|
|
}
|
|
}
|