// Use this for initialization
    void Start()
    {
        Application.targetFrameRate = 60;
        // Make self a publicly available singleton
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
        // Never destroy gameManager (on scene changes)
        DontDestroyOnLoad(gameObject);

        //levelManager = Instantiate(levelManagerPrefab, new Vector3(0f, 0f, 0f), Quaternion.identity);

        // Set managers
        gameUIManager = GetComponent <GameUIManager>();
        gameUIManager.Setup();

        // Initialize planes generator
        planesGenerator = GetComponent <UnityARGeneratePlane>();

        // Initialize level manager (the game)
        levelManager      = Instantiate(levelManagerPrefab, new Vector3(0f, 0f, 0f), Quaternion.identity);
        levelManager.name = "LevelManager";
        levelManager.transform.SetParent(transform.root);
        levelManager.GetComponent <UIManager>().SetCanvasScale(2.0f);

        // Go to calibration mode
        SetCalibrationMode();
    }
Beispiel #2
0
    // Use this for initialization
    public void Init()
    {
        m_earthPrefab = GameObject.Instantiate(Resources.Load("Map/Earth_16K_linear") as GameObject);
        //m_chinaPrefab = GameObject.Instantiate(Resources.Load("Map/zhongguo") as GameObject);
        m_earthCopy   = GameObject.Instantiate(Resources.Load("Map/EarthControl") as GameObject);
        m_cameraEarth = m_earthCopy.transform.Find("Main_Camera1").gameObject;
        m_earthCopy.SetActive(false);
        m_earthPrefab.gameObject.SetActive(false);
        //m_chinaPrefab.gameObject.SetActive(false);
        m_hitParent = GameObject.Find("HitCubeParent");
        UGUIManager.GetInstance().GetUGUILogic <UI_EarthPanel>().InitPanel();
        m_camera = GameObject.Find("CameraParent/Main Camera").GetComponent <Camera>();
        //m_biaojiAni = m_earthPrefab.GetComponentInChildren<Animator>();
        //m_biaojiAni.SetBool("biaoji", false);
        //EventCenter.Regist(UI_EVENT.SUN_ROTATE.ToString(), RotateSun);
        //m_biaoji.gameObject.SetActive(false);
        m_sunEarth = m_earthPrefab.transform.Find("Sun");

        for (int i = 0; i < 3; i++)
        {
            string    dot = "dot" + i.ToString();
            Transform a   = m_earthPrefab.transform.Find(dot);
            dotList.Add(a);
        }
        m_light          = GameObject.Find("Directional light");
        m_generatePlanes = GameObject.Find("GeneratePlanes").GetComponent <UnityARGeneratePlane>();
        EventCenter.Regist(UI_EVENT.SHOW_EARTHTWO.ToString(), ShowEarthTwo);
        //EventCenter.Regist(UI_EVENT.SHOW_EARTHDISAPPEARFINISH.ToString(), ShowChina);
    }
Beispiel #3
0
        protected override void Awake()
        {
            base.Awake();

            if (Find.Any(out UnityARCameraManager camMgr))
            {
                camMgr.planeDetection = UnityARPlaneDetection.HorizontalAndVertical;
            }
            generatePlanes             = this.Ensure <UnityARGeneratePlane>();
            generatePlanes.planePrefab = planePrefab;
        }
Beispiel #4
0
    private void Awake()
    {
        Instance = this;

        //NOTE: Used to make sure that planes will not be visible if they shouldn't
#if UNITY_ANDROID
#elif UNITY_IOS
        UnityARGeneratePlane planeGenerator = FindObjectOfType <UnityARGeneratePlane>();
        if (planeGenerator != null && planeGenerator.planePrefab != null)
        {
            StudioPlane plane = planeGenerator.planePrefab.GetComponent <StudioPlane>();
            if (plane == null)
            {
                planeGenerator.planePrefab.AddComponent <StudioPlane>();
            }
        }
#else
#endif
    }