48 lines
903 B
C#
48 lines
903 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
|
|
public class MainMenuController : MonoBehaviour {
|
|
public AudioClip newGameSound;
|
|
private AudioSource _source;
|
|
public GameObject fadeImage;
|
|
|
|
public void OnButtonExit(){
|
|
Application.Quit();
|
|
}
|
|
|
|
public void OnButtonNewGame(){
|
|
Invoke("NewGameLoad", 5);
|
|
if(_source != null & newGameSound != null){
|
|
_source.PlayOneShot(newGameSound);
|
|
}
|
|
|
|
//fadeImage.GetComponent<UnityEngine.image
|
|
try {
|
|
fadeImage.SetActive(true);
|
|
fadeImage.GetComponent<Animator>().SetTrigger("Fade");
|
|
}
|
|
catch {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
private void NewGameLoad(){
|
|
Debug.Log("Load level");
|
|
Application.LoadLevel("Level0");
|
|
}
|
|
|
|
// Use this for initialization
|
|
void Start () {
|
|
Time.timeScale = 1;
|
|
_source = GetComponent<AudioSource>();
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update () {
|
|
|
|
}
|
|
}
|