LearnWithTouch/Assets/scripts/EndScene.cs

45 lines
989 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class EndScene : MonoBehaviour
{
public Image image;
private int count = 0;
public Sprite[] intro;
public Animator animator;
public new AudioSource endtheme;
public new AudioSource ufo;
void Start() {
endtheme.Play();
}
// Update is called once per frame
void Update()
{
if (animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 1.0f)
{
if (count == 0) ufo.Play();
if (count == 2)
{
DontDestroyOnLoad(Gamestate.Instance);
Gamestate.Instance.menuState();
}
else
{
//background.texture.LoadImage();
image.sprite = intro[count];// newSprite;
}
count += 1;
animator.Play("End_Fader", -1, 0f);
}
}
}