public void backToGame() { GameObject scoreHelper = GameObject.Find("persistentObj"); persistentHelper ph = scoreHelper.GetComponent <persistentHelper>(); ph.firstTimeSetup = false; SceneManager.LoadScene(0); }
//public Text usernameText; // Use this for initialization void Start() { ph = FindObjectOfType <persistentHelper>(); sourceIsLocal = false; camRotScp = GetComponent <CamRotScp>(); if (!ph.firstTimeSetup) { GameObject.Find("UserStartCanvas").SetActive(false); } //loadUserName(); }
// Use this for initialization void Start() { //string fname = getFnames (); ph = GameObject.Find("persistentObj").GetComponent <persistentHelper>(); Texture2D tex = ph.imgTextures[id]; if (tex != null) { mat.SetTexture("_MainTex", ph.imgTextures[id]); } //setRewardSceneShader (gameObject, fname); }
private void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; } firstTimeSetup = false; DontDestroyOnLoad(this.gameObject); imgTextures = new Texture2D[9]; firstTimeSetup = true; rewardLevel = 0; }
// Use this for initialization void Start() { gm = gameObject.GetComponent <GuessManager>(); tm = gameObject.GetComponent <textureMod>(); ph = FindObjectOfType <persistentHelper>(); um = FindObjectOfType <userManager>(); // Initialize name and round indexes for (int i = 0; i < 3; i++) { // Deactivate all objects roundTextObjs[i].SetActive(false); } // Automatically setup the textures if this is not the first login // The Done button calls this fn the first time if (!ph.firstTimeSetup) { getNamesAndSetTextures(); ph.setAnimColor(); // also change the effect color of the animation button } }
// ========================================= VOID START ==================================================// void Start() { tm = gameObject.GetComponent <textureMod> (); ph = FindObjectOfType <persistentHelper>(); if (ph != null) { rewardLevel = ph.rewardLevel; } else { rewardLevel = 1; } // cycle over each stage and set up varibles for (int i = 0; i < numstages; i++) { // obtain speeds from distance and time specified stage_speed [i] = dist [i] / t_stage [i]; // all use simple cosine gradient norms [i] = PIover2; // Create and start delay+ state change croutines stagedelay[i] = DelayAndChangeStage(postStepDelays[i], i + 1); // All current distances are 0; current_dist[i] = 0f; stageComplete [i] = false; } stage_speed [5] = stage_speed [4]; t_stage [5] = stage_speed [5] / dist [5]; // Cycle over the number of image frames for (int i = 0; i < numframes; i++) { // Set up stage 5 routines. landscape frames rotate clockwise, portraits rotate anticlockwise if (i < 4) // landscape frames { stage5_routines [i] = stage_5_rotator(frames [i], i, -1, i * 90); } else { stage5_routines [i] = stage_5_rotator(frames [i], i, 1, 45f + (i - 4) * 90); } stage5Executed [i] = false; // Get the translation vectors. These are obtained with respect to the parent positions. the parent (landscapeCenter/ portraitCenter) // is responsible for z axis translation, while each fram is individually translated in the translation Vector direction in stage 1 translationVectors [i] = frames [i].transform.localPosition; // set the position of each frame w.r.t its parent to a certian fraction of the initial distance. The overridden initial distance is the // distance that the frames will reach at the end of stage 1 frames [i].transform.localPosition = translationVectors[i] * initialFraction; } /* Stage 5 has a special setup. I specify a desired angle of rotation (multiple of 90) * using a fraction of stage 4's speed as the desired speed, the script then calcualates how * long it would take for the desired rotation amount and assigns it. * This will be the speed used even in the carousel stages */ // Calculate amount of time for camera zoom to occur. This will occur until stage 2 begins float camZoomDelay = 0; // Add the amount of time between the start of stage 0 and the end of stage 2 // This includes the actual stage run time and the prestep stage delays. for (int i = 0; i < 2; i++) { camZoomDelay += postStepDelays [i] + t_stage [i]; } camRoutines [0] = CamZoomRoutine(camZoomDelay, initialFOV, 45); current_stage = 0; t_elapsed = 0; }