void Start() { // Check whether being in cliffScene (for the trailer animation) or in mainAIScene (for demonstrating/testing) trailerAnim = (Global.GetCurrentScene() == Global.cliffScene); PrepareComponents(); if (trailerAnim) { // Create dialogue windows GameObject TextFieldObj = (GameObject)Resources.Load("DragonWorld/GUI/TextFieldObj"); titleTextfield = (TextFieldScript)Instantiate(TextFieldObj).GetComponent(typeof(TextFieldScript)); titleTextfield.InitializeTextField(-50, -125, Screen.width + 100, 200, 10, 8, false, new Color(1f, 1f, 1), 150, FontStyle.Bold); titleTextfield.AddTextLine(""); titleTextfield.AddTextLine(""); titleTextfield.AddTextLine(""); titleTextfield.AddTextLine(" Genisys Of Dragons"); dragonTextfield = (TextFieldScript)Instantiate(TextFieldObj).GetComponent(typeof(TextFieldScript)); dragonTextfield.InitializeTextField(2000, 400, 600, 50, 10, 2, false, new Color(0.8f, 1, 0.8f), 35, FontStyle.BoldAndItalic); tamerTextfield = (TextFieldScript)Instantiate(TextFieldObj).GetComponent(typeof(TextFieldScript)); tamerTextfield.InitializeTextField(10, Screen.height + 200, Screen.width - 40, 50, 10, 2, false, new Color(0.8f, 0.8f, 1), 35, FontStyle.Bold); } else { SwitchGravity(false); } followerOffset = new Vector3(0, -2.25f, -1); }
void Start() { // Some coordinates for the GUI int fy = 10; int fw = 400; int btx = 275; int fh = 25; int offs = 7; VSphere sphere = GameObject.Find("SphereControler").GetComponent <VSphere>(); // Create the title textfield with displaying the FPS and running time titleTF = (TextFieldScript)Instantiate(Global.TextFieldObject).GetComponent(typeof(TextFieldScript)); titleTF.InitializeTextField(10, fy, fw, fh, offs, 5, true, Color.cyan, 18, FontStyle.Bold); titleTF.AddTextLine("VR Sphere "); titleTF.AddAutoUpdateLine("Current render FPS: ", () => { return(currentFPS.ToString()); }); titleTF.AddAutoUpdateLine("Total running time: ", () => { return(Time.realtimeSinceStartup.ToString("F2")); }); titleTF.AddAutoUpdateLine("3D camera position: ", () => { return(Global.mainCameraScr.getPosition().ToString()); }); titleTF.AddAutoUpdateLine("Current polygons: ", () => { return(sphere.getPolygonCount().ToString()); }); fy += 5 * fh + 3 * offs; controlsTF = (TextFieldScript)Instantiate(Global.TextFieldObject).GetComponent(typeof(TextFieldScript)); controlsTF.InitializeTextField(10, fy, fw, fh, offs, 5); controlsTF.InitializedActiveLineSettings(btx, offs, () => { Global.mainCameraScr.doubleClick = 0; }); controlsTF.AddTextLine("<color=#00ffffff>Controls</color> "); controlsTF.AddTextLine("<Double-Click> screen for mouse control"); controlsTF.AddTextLine("Free camera movement with <WASD> keys"); controlsTF.AddTextLine("Camera zoom out with <Q>. In with <E>. Or <Scrollwheel>"); controlsTF.AddTextLine("Loop through predefined points with <Spacebar>"); fy += 5 * fh + 3 * offs; functionsTF = (TextFieldScript)Instantiate(Global.TextFieldObject).GetComponent(typeof(TextFieldScript)); functionsTF.InitializeTextField(10, fy, fw, fh, offs, 3); functionsTF.InitializedActiveLineSettings(btx, offs, () => { Global.mainCameraScr.doubleClick = 0; }); functionsTF.AddTextLine("<color=#00ffffff>Settings</color> "); functionsTF.AddActiveLine("Rays: ", "Whether the whole rays should be drawn or the actual desired model.", "", new string[] { "Object", "Full" }, new System.Action[] { () => { sphere.FullRays = false; }, () => { sphere.FullRays = true; } }, () => { return(sphere.FullRays ? "Full" : "Object"); }, KeyCode.U); functionsTF.AddActiveLine("Paused: ", "Model updating is paused or not.", "", new string[] { "Yes", "No" }, new System.Action[] { () => { sphere.Paused = true; }, () => { sphere.Paused = false; } }, () => { return(sphere.Paused ? "Yes" : "No"); }, KeyCode.P); fy += 3 * fh + 3 * offs; previewTF = (TextFieldScript)Instantiate(Global.TextFieldObject).GetComponent(typeof(TextFieldScript)); previewTF.InitializeTextField(10, fy, fw, fh, offs, 4); previewTF.InitializedActiveLineSettings(btx, offs, () => { Global.mainCameraScr.doubleClick = 0; }); previewTF.AddTextLine("<color=#00ffffff>Preview</color> "); /* * previewTF.AddActiveLine("Preview Window: ", "The camera input preview is visible or not.", "", * new string[] { "OFF", "ON" }, new System.Action[] {()=>{sphere.PreviewEnabled = false;}, * ()=>{sphere.PreviewEnabled = true;} }, * () => { return (sphere.PreviewEnabled ? "ON" : "OFF"); }, * KeyCode.P); */ previewTF.AddActiveLine("Preview Mode: ", "Type of preview mode.", "", new string[] { "Last", "Next" }, new System.Action[] { () => { sphere.nextPreviewType(); }, () => { sphere.lastPreviewType(); } }, () => { return(sphere.PreviewType.ToString()); }, KeyCode.M, KeyCode.DownArrow, KeyCode.UpArrow); previewTF.AddActiveLine("Separated Windows: ", "The camera input preview is separated into multiple windows.", "", new string[] { "OFF", "ON" }, new System.Action[] { () => { sphere.PreviewWindowVariant = 2; }, () => { sphere.PreviewWindowVariant = 1; } }, () => { return(sphere.PreviewWindowVariant == 1 ? "ON" : "OFF"); }, KeyCode.I); previewTF.AddActiveLine("Preview focus: ", "Which camera is in focus in the non-separated preivew window.", "", new string[] { "Last", "Next" }, new System.Action[] { () => { sphere.lastPreviewWindowOrderOffset(); }, () => { sphere.nextPreviewWindowOrderOffset(); } }, () => { return(sphere.PreviewWindowOrderOffset.ToString()); }, KeyCode.F, KeyCode.UpArrow, KeyCode.DownArrow); }