Skip to content

Instantly share code, notes, and snippets.

@ellisonleao
Created January 30, 2015 18:40
Show Gist options
  • Save ellisonleao/e584f3406cd80e08962e to your computer and use it in GitHub Desktop.
Save ellisonleao/e584f3406cd80e08962e to your computer and use it in GitHub Desktop.
Intro Scene
using UnityEngine;
using System.Collections;
public class Intro : MonoBehaviour {
SimpleGameManager GM;
void Awake () {
GM = SimpleGameManager.Instance;
GM.OnStateChange += HandleOnStateChange;
Debug.Log("Current game state when Awakes: " + GM.gameState);
}
void Start () {
Debug.Log("Current game state when Starts: " + GM.gameState);
GM.SetGameState(GameState.MAIN_MENU);
}
public void HandleOnStateChange ()
{
Debug.Log("Handling state change to: " + GM.gameState);
Invoke("LoadLevel", 3f);
}
public void LoadLevel(){
Debug.Log("Invoking LoadLevel");
Application.LoadLevel("Menu");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment