void Awake()
    {
        if (instance == null)
        {
            Debug.Log("Start MainController");
            instance = this;
            dijsktra = new DijsktraAlgorithm();
            ar       = new ARDisplayController();
            canvas   = GameObject.Find("Canvas").GetComponent <CanvasButtonScript>();
            canvas.StartCanvas();

            jsonReader = gameObject.GetComponent <JsonReader>();//new JsonReader();
            JsonReader.ReadState readState = jsonReader.ReadJsonData();
            Debug.Log("State " + readState);

            if (readState == JsonReader.ReadState.ReadOK)
            {
                GameObject.FindWithTag("Building").GetComponent <BuildingData>().GetAllFloorToList();
                canvas.StartNormalStateAppCanvas();
                stateDisplay = GameObject.Find("Canvas").GetComponent <StateDisplayController>();
            }
            else
            {
                canvas.ShowErrorCantReadFile(readState);
            }
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);
    }
Exemple #2
0
 void Awake()
 {
     if (instance == null)
     {
         Debug.Log("Start MainController");
         instance   = this;
         dijsktra   = new DijsktraAlgorithm();
         ar         = new ARDisplayController();
         jsonReader = new JsonReader();
         jsonReader.ReadJsonData();
         stateDisplay = GameObject.Find("Canvas").GetComponent <StateDisplayController>();
         GameObject.FindWithTag("Building").GetComponent <BuildingData>().GetAllFloorToList();
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }