Newer
Older
Dreamsturbia-Project-IADE-Unity3D / Assets / Scripts / IntroLogoAnim.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.Video;

public class IntroLogoAnim : MonoBehaviour
{
    public Image image;
    public GameObject panel;
    public VideoPlayer vp;
    public Sprite offSprite;
    public Sprite onSprite;
    // Start is called before the first frame update
    void Start()
    {
        StartCoroutine(RunAnim());
        StartCoroutine(NextAnim());

    }

    IEnumerator RunAnim()
    {
        vp.Prepare();
        image.sprite = offSprite;
        yield return new WaitForSeconds(1);
        image.sprite = onSprite;

    }
    IEnumerator NextAnim()
    {
        yield return new WaitForSeconds(3);
        panel.SetActive(false);
        vp.loopPointReached += Vp_loopPointReached;
        vp.Play();

    }

    private void Vp_loopPointReached(VideoPlayer source)
    {
     
        SceneManager.LoadScene(1);
    }


    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            SceneManager.LoadScene(1);
        }
    }

}