Example #1
0
 private void Awake()
 {
     if (instance)
     {
         Destroy(this);
     }
     else
     {
         instance = this;
     }
 }
Example #2
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Example #3
0
    private void Awake()
    {
        if (instance == null)
        {
            DontDestroyOnLoad(gameObject);
            instance = this;
        }

        else if (instance != this)
        {
            Destroy(gameObject);
        }
    }
    void Awake()
    {
        //If an UILevelManager exists and it is not this...
        if (Instance != null && Instance != this)
        {
            Debug.LogError("Error with UILevelManager script components, 2 instances " + this);
            //...destroy this and exit. There can be only one UILevelManager.
            Destroy(gameObject);
            return;
        }

        //This is the Instance UILevelManager.
        Instance = this;
    }
Example #5
0
    UILevelManager InstantiateLevelManager(LevelConfig l, int i)
    {
        GameObject o = Instantiate <GameObject>(uiLevelManagerPrefab);

        o.GetComponent <RectTransform>().SetParent(this.canvas.GetComponent <RectTransform>(), false);

        this.SetPosition(o, i);

        UILevelManager mng = o.GetComponent <UILevelManager>();

        mng.Init(this, l, i, this.config.Levels.Count - 1);

        return(mng);
    }
Example #6
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;

            bombPanel.SetActive(true);
            goldPanel.SetActive(false);
            exitPanel.SetActive(false);

            awakeTimeStamp = Time.time;

            isLevelFinished = false;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
    }
Example #7
0
 private void SetStayingPosition(UILevelManager o, int i)
 {
     o.GetComponent <UILevelManager>().StayingPoint = this.nextPoint * (i - this.activeLevelManager);
 }