//private DoorController npc;

    private void Awake()
    {
        //Check if instance already exists
        if (instance == null)
        {
            // If no set instance to this
            instance = this;
        }
        //If instance already exists and it's not this
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        //DontDestroyOnLoad(gameObject);
    }
示例#2
0
// Use this for initialization
    void Awake()
    {
//		LevelNum = 0;

        if (instance == null)
        {
            instance = this;
            DontDestroyOnLoad(this);
        }
        else
        {
            Destroy(gameObject);
        }
        //print the score from the static instance of Wk3GameManager
        //		Debug.Log("Current Score: " + Wk3GameManager.instance.Score);

        //start with max health
        Health = HEALTH_MAX;

//		ll = levelLoader.GetComponent<LevelLoader> ();
        //GameObject walls = Instantiate (Resources.Load ("Prefab/Walls")) as GameObject;
    }