Esempio n. 1
0
        // Use this for initialization
        void Start()
        {
            SourceVersion = VPETVersion.version;

            if (CacheNameOut == null || CacheNameOut == "" || CacheNameOut == CacheName)
            {
                CacheNameOut = CacheName + "_out";
            }

            // Register plugins
            VPETRegister.RegisterNodeParser();
            VPETRegister.RegisterNodeBuilder();
            VPETRegister.RegisterObjectSender();



            ImportCache();

            ExportCache();
        }
Esempio n. 2
0
        private void Awake()
        {
            if (sceneRoot == null)
            {
                sceneRoot = GameObject.Find("root");
            }

            serverAdapter = GameObject.Find("ServerAdapter").GetComponent <ServerAdapter>();

            if (sceneRoot == null)
            {
                Debug.LogError(string.Format("{0}: Cant find Scene Root: 'root'.", this.GetType()));
            }

            lodLowLayer   = LayerMask.NameToLayer("LodLow");
            lodHighLayer  = LayerMask.NameToLayer("LodHigh");
            lodMixedLayer = LayerMask.NameToLayer("LodMixed");

            VPETRegister.RegisterObjectSender();
            serverAdapter.initServerAdapterTransfer();
        }
Esempio n. 3
0
        //!
        //! Use this for pre initialization
        //!
        void Awake()
        {
            QualitySettings.vSyncCount  = 0;
            Application.targetFrameRate = 40;

            // read settings from inspector values
            VPETSettings.mapValuesFromObject(this);

            // read settings from config file if wanted
            if (!ignoreConfig)
            {
                string filePath = Application.dataPath + "/VPET/editing_tool.cfg";
                if (!File.Exists(filePath))
                {
                    filePath = Application.persistentDataPath + "/editing_tool.cfg";
                }

                VPETSettings.mapValuesFromConfigFile(filePath);
            }

            // read settings from user preferences
            VPETSettings.mapValuesFromPreferences();


            // check if scene dump file available
            if (Directory.Exists(Application.dataPath + "/Resources/VPET/SceneDumps"))
            {
                VPETSettings.Instance.sceneDumpFolderEmpty = (Directory.GetFiles(Application.dataPath + "/Resources/VPET/SceneDumps", "*.bytes").Length == 0);
                // print("PETSettings.Instance.sceneDumpFolderEmpty " + VPETSettings.Instance.sceneDumpFolderEmpty);
            }

            VPETSettings.Instance.sceneDumpFolderEmpty = false;

            // Register plugins
            VPETRegister.RegisterNodeParser();
            VPETRegister.RegisterNodeBuilder();
            VPETRegister.RegisterObjectSender();

            // get all adapters and add them if missing
            //
            // get scene adapter
            GameObject refObject = GameObject.Find("SceneAdapter");

            if (refObject == null)
            {
                Debug.LogWarning(string.Format("{0}: No SceneAdapter Object found. Create.", this.GetType()));
                refObject = new GameObject("SceneAdapter");
            }
            sceneAdapter = refObject.GetComponent <SceneLoader>();
            if (sceneAdapter == null)
            {
                Debug.LogWarning(string.Format("{0}: No SceneAdapter Component found. Create", this.GetType()));
                sceneAdapter = refObject.AddComponent <SceneLoader>();
            }

            // get server adapter
            refObject = GameObject.Find("ServerAdapter");
            if (refObject == null)
            {
                Debug.LogWarning(string.Format("{0}: No ServerAdapter Object found. Create.", this.GetType()));
                refObject = new GameObject("ServerAdapter");
            }
            serverAdapter = refObject.GetComponent <ServerAdapter>();
            if (serverAdapter == null)
            {
                Debug.LogWarning(string.Format("{0}: No ServerAdapter Component found. Create", this.GetType()));
                serverAdapter = refObject.AddComponent <ServerAdapter>();
            }

            // copy cache name to settings
            VPETSettings.Instance.sceneFileName = serverAdapter.sceneFileName;

            // set properties
            serverAdapter.SceneLoader = sceneAdapter;

            // get animation adapter
            refObject = GameObject.Find("AnimationController");
            if (refObject == null)
            {
                Debug.LogWarning(string.Format("{0}: No AnimationController Object found. Create.", this.GetType()));
                refObject = new GameObject("AnimationAdapter");
            }
            animationController = refObject.GetComponent <AnimationController>();
            if (animationController == null)
            {
                Debug.LogWarning(string.Format("{0}: No AnimationController Component found. Create", this.GetType()));
                animationController = refObject.AddComponent <AnimationController>();
            }


            // get JoystickAdapter adapter
            refObject = GameObject.Find("JoystickAdapter");
            if (refObject == null)
            {
                Debug.LogWarning(string.Format("{0}: No JoystickAdapter Object found. Create.", this.GetType()));
                refObject = new GameObject("JoystickAdapter");
            }
            joystickAdapter = refObject.GetComponent <JoystickInput>();
            if (joystickAdapter == null)
            {
                Debug.LogWarning(string.Format("{0}: No JoystickAdapter Component found. Create", this.GetType()));
                joystickAdapter = refObject.AddComponent <JoystickInput>();
            }

            // set properties
            joystickAdapter.SceneLoader = sceneAdapter;

            // get InputAdapter adapter
            refObject = GameObject.Find("InputAdapter");
            if (refObject == null)
            {
                Debug.LogWarning(string.Format("{0}: No InputAdapter Object found. Create.", this.GetType()));
                refObject = new GameObject("InputAdapter");
            }
            inputAdapter = refObject.GetComponent <InputAdapter>();
            if (inputAdapter == null)
            {
                Debug.LogWarning(string.Format("{0}: No InputAdapter Component found. Create", this.GetType()));
                inputAdapter = refObject.AddComponent <InputAdapter>();
            }
            // inputAdapter.MainController = this;


            // get ui adapter
            refObject = GameObject.Find("GUI/Canvas/UI");
            if (refObject == null)
            {
                Debug.LogWarning(string.Format("{0}: No GUI/Canvas/UI Object found. Create.", this.GetType()));
                refObject = new GameObject("UI");
                GameObject refParent = GameObject.Find("GUI/Canvas");
                refObject.transform.SetParent(refParent.transform, false);
            }
            ui = refObject.GetComponent <UI>();
            if (ui == null)
            {
                Debug.LogWarning(string.Format("{0}: No UI Component found. Create", this.GetType()));
                ui = refObject.AddComponent <UI>();
            }

            // get move camera component camera Adapter
            cameraAdapter = Camera.main.GetComponent <MoveCamera>();
            if (cameraAdapter == null)
            {
                Debug.LogWarning(string.Format("{0}: No CameraAdapter Component found. Create", this.GetType()));
                cameraAdapter = Camera.main.gameObject.AddComponent <MoveCamera>();
            }

#if USE_TANGO
            GameObject tangoObject = GameObject.Find("Tango Manager");
            if (tangoObject)
            {
                tangoApplication = tangoObject.GetComponent <Tango.TangoApplication>();
            }
#endif
        }