void Awake()
    {
        if (instance == null)
        {
            instance = this;

            if (Application.isPlaying)
            {
                DontDestroyOnLoad(gameObject);
            }
        }
        else
        {
            //can only be one tk2dUIManager at one-time, if another one is found Destroy it
            if (instance != this)
            {
                CustomDebug.Log("Discarding unnecessary tk2dUIManager instance.");

                if (uiCamera != null)
                {
                    HookUpLegacyCamera(uiCamera);
                    uiCamera = null;
                }

                Destroy(this);

                return;
            }
        }

        tk2dUITime.Init();
        Setup();
    }
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         if (instance.transform.childCount != 0)
         {
             Debug.LogError("You should not attach anything to the tk2dUIManager object. The tk2dUIManager will not get destroyed between scene switches and any children will persist as well.");
         }
         if (Application.isPlaying)
         {
             UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
         }
     }
     else if (instance != this)
     {
         Debug.Log("Discarding unnecessary tk2dUIManager instance.");
         if (this.uiCamera != null)
         {
             this.HookUpLegacyCamera(this.uiCamera);
             this.uiCamera = null;
         }
         UnityEngine.Object.Destroy(this);
         return;
     }
     tk2dUITime.Init();
     this.Setup();
 }
Example #3
0
    void Awake()

    {
        if (instance == null)

        {
            instance = this;



            if (instance.transform.childCount != 0)
            {
                Debug.LogError("You should not attach anything to the tk2dUIManager object. " +

                               "The tk2dUIManager will not get destroyed between scene switches and any children will persist as well.");
            }



            if (Application.isPlaying)
            {
                DontDestroyOnLoad(gameObject);
            }
        }

        else

        {
            //can only be one tk2dUIManager at one-time, if another one is found Destroy it

            if (instance != this)

            {
                Debug.Log("Discarding unnecessary tk2dUIManager instance.");



                if (uiCamera != null)
                {
                    HookUpLegacyCamera(uiCamera);

                    uiCamera = null;
                }



                Destroy(this);



                return;
            }
        }



        tk2dUITime.Init();

        Setup();
    }
Example #4
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         //can only be one tk2dUIManager at one-time, if another one is found Destroy it
         if (instance != this)
         {
             Destroy(gameObject);
             return;
         }
     }
     tk2dUITime.Init();
     Setup();
 }
Example #5
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;

            if (instance.transform.childCount != 0) {
                Debug.LogError("You should not attach anything to the tk2dUIManager object. " +
                    "The tk2dUIManager will not get destroyed between scene switches and any children will persist as well.");
            }

            if (Application.isPlaying) {
                DontDestroyOnLoad( gameObject );
            }
        }
        else
        {
            //can only be one tk2dUIManager at one-time, if another one is found Destroy it
            if (instance != this)
            {
                Debug.Log("Discarding unnecessary tk2dUIManager instance.");

                if (uiCamera != null) {
                    HookUpLegacyCamera(uiCamera);
                    uiCamera = null;
                }

                Destroy(this);

                return;
            }
        } 

        tk2dUITime.Init();
        Setup();
    }
Example #6
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
            if (Application.isPlaying) {
                DontDestroyOnLoad( gameObject );
            }
        }
        else
        {
            //can only be one tk2dUIManager at one-time, if another one is found Destroy it
            if (instance != this)
            {
                Debug.Log("Discarding unnecessary tk2dUIManager instance.");
                return;
            }
        } 

        tk2dUITime.Init();
        Setup();
    }
Example #7
0
    // Use this for initialization
    void Start()
    {
        //loadLevelMax = Application.levelCount - 1;
        DontDestroyOnLoad(this.gameObject);

        for (loadingLevel = 1; loadingLevel <= levelsToLoad; loadingLevel ++){

            int index = Random.Range(0, roomsPerLevel);

            Application.LoadLevelAdditive(roomString + loadingLevel.ToString() + "_" + index.ToString());

        }

        if (TextBox.bubble == null){
            Instantiate(Resources.Load("textBox"));
        }

        tk2dUI = GetComponent<tk2dUIManager>();

            //-------------------------------setting layer variables-------------------------------
        docLayer = LayerMask.NameToLayer("danger");
        brickLayer = LayerMask.NameToLayer("brickBlock");
    }
Example #8
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         //can only be one tk2dUIManager at one-time, if another one is found Destroy it
         if (instance != this)
         {
             Destroy(gameObject);
             return;
         }
     }   
     tk2dUITime.Init();
     Setup();
 }