Added Start Animation Video ..

posted in: Weekly Progress | 0

In Start of Game Animation video is added and  Skip button is also added for skipping this video .

 

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class PlayIntroVideo : MonoBehaviour
{
public GameObject GameManager;

#if UNITY_ANDROID
// nothing
#else
public MovieTexture MovieIntro;
private AudioSource _audioSrc;
#endif

void Start ()
{

#if UNITY_ANDROID
Handheld.PlayFullScreenMovie (“intro.mp4”, Color.black, FullScreenMovieControlMode.CancelOnInput);
#else
_audioSrc = GameManager.GetComponent<AudioSource>();
GetComponent<RawImage>().texture = MovieIntro as MovieTexture;
_audioSrc.clip = MovieIntro.audioClip;
MovieIntro.Play();
_audioSrc.Play();
#endif
GameManager.GetComponent<GameManager>().OpenStartupScene();
}

void Update ()
{

#if UNITY_ANDROID
// nothing
#else
// if movie is completed, change scene
if(!MovieIntro.isPlaying)
{
GameManager.GetComponent<GameManager>().OpenStartupScene();
}
#endif
}
}

Leave a Reply