// Use this for initialization void Start() { nQuestion.gameObject.SetActive(false); //Find the Level Manager for scorekeeping levelManager = FindObjectOfType <LevelManager> (); //Find the Stat Tracker for stat tracking statTracking = FindObjectOfType <StatTracking>(); rs = GetComponentInParent <ReportSelf> (); //When panel opens, make sure no other panel can open. levelManager.noObjections = false; //dragAndSnap = GetComponent<DragAndSnap> (); //Set the feedback as empty. corInc.text = ""; //Find the name of the parent gameObject to figure out the state. //bPart changes the State which changes the correct answer. //correction texts are for displaying the correct answer if hint is used. readyHint(); //Setting up randomization of dropdown answers. answers4.gameObject.SetActive(false); answers5.gameObject.SetActive(false); answers6.gameObject.SetActive(false); rSeed = Random.Range(300f, 600f); if (this.name == "Q0") { displayQuestion0(); } else if (this.name == "Q1") { displayQuestion1(); } }
// Use this for initialization void Start() { //parentSprite = GetComponentInParent <SpriteRenderer> (); childSprite = GetComponent <SpriteRenderer> (); //Find the needed scripts. levelManager = FindObjectOfType <LevelManager> (); statTracking = FindObjectOfType <StatTracking> (); //Find the Stat Tracker. //statTracking = FindObjectOfType<StatTracking>(); //parentSprite.color = new Color (1f, 1f, 1f, 1f); polyCol = GetComponents <PolygonCollider2D> (); //Get number of questions for body part by getting the Length of the array. numQ = question.Length; //Count all body parts and questions piece = (this.tag == "unPlaced"); if (piece) { //levelManager.startObjects++; levelManager.addObjCount(numQ); } if (SceneManager.GetActiveScene().name == "Armbone0" || SceneManager.GetActiveScene().name == "Armbone1" || SceneManager.GetActiveScene().name == "Armbone2" || SceneManager.GetActiveScene().name == "Armbone3" || SceneManager.GetActiveScene().name == "Armbone4") { childSprite.color = new Color(0.9f, 0.5f, 0.5f, 1f); } if (statTracking.identifyLevel() == "Q0" || statTracking.identifyLevel() == "QC") { setCanvas(Qnum, true); isClickable = false; } }
// Use this for initialization void Start() { question = transform.FindChild("Question").GetComponent <Text>(); corInc = transform.FindChild("CorInc").GetComponent <Text> (); sAnswer = transform.FindChild("Answer Button").GetComponent <Button> (); nQuestion = transform.FindChild("Next Button").GetComponent <Button>(); hint = transform.FindChild("Hint Button").GetComponent <Button>(); //Set the size of the canvas rt = GetComponent <RectTransform> (); rt.sizeDelta = new Vector2(WIDTH, HEIGHT); nQuestion.gameObject.SetActive(false); //Find the Level Manager for scorekeeping levelManager = FindObjectOfType <LevelManager> (); //Find other components of this game object qr2 = GetComponent <QuizRandomQ2> (); quizPopup = GetComponentInParent <QuizPopup> (); //Find the Stat Tracker for stat tracking statTracking = FindObjectOfType <StatTracking>(); rs = GetComponentInParent <ReportSelf> (); //When panel opens, make sure no other panel can open. levelManager.noObjections = false; //dragAndSnap = GetComponent<DragAndSnap> (); setQuestion(); //Set the feedback as empty. corInc.text = ""; //Gather the set of correct answers as well as their values. answerSet = qr2.getAnswer(); StartCoroutine(setAnswers()); }
public bool resetted = false; //Used to reset StartPosition booleans. // Use this for initialization void Start() { //Text for Score, Timer, and Guesses from Main Canvas point = GameObject.Find("Score Count").GetComponent <Text>(); timer = GameObject.Find("Timer Count").GetComponent <Text>(); numAtt = GameObject.Find("Attempts Count").GetComponent <Text>(); //Find ALL of the components of the Win Canvas!! winCanvas = GameObject.Find("Win Canvas").GetComponent <Canvas> (); //Text Boxes from Win Canvas finalScore = GameObject.Find("High Score Content").GetComponent <Text> (); congratsText = GameObject.Find("Win Text").GetComponent <Text> (); accuracy = GameObject.Find("Accuracy Display").GetComponent <Text> (); speed = GameObject.Find("Speed Display").GetComponent <Text>(); finalS = GameObject.Find("Final Display").GetComponent <Text>(); targetText = GameObject.Find("Target Text").GetComponent <Text>(); targetTime = GameObject.Find("Target Time").GetComponent <Text>(); targetScore = GameObject.Find("Target Score").GetComponent <Text>(); accScore = GameObject.Find("Accuracy Score").GetComponent <Text>(); targetAcc = GameObject.Find("Accuracy Max").GetComponent <Text> (); timeScore = GameObject.Find("Time Score").GetComponent <Text>(); //graduation = GameObject.Find("Graduation Text").GetComponent <Text>(); //Sets up where to save player stats. statTracking = GetComponent <StatTracking>(); //Medal Images and Texts from Win Canvas if (statTracking.identifyLevel() != "Q0") { bronze = GameObject.Find("Bronze Info").GetComponent <Image> (); silver = GameObject.Find("Silver Info").GetComponent <Image> (); gold = GameObject.Find("Gold Info").GetComponent <Image> (); platinum = GameObject.Find("Platinum Info").GetComponent <Image> (); } //Buttons from Win Canvas restartButton = GameObject.Find("Restart Button").GetComponent <Button>(); improveScoreButton = GameObject.Find("Improve Score Button").GetComponent <Button> (); //The following is if the Player Manager exists. This should always be the case in practice, except when playtesting specific levels. if (GameObject.Find("Player Manager") != null) //See if the Player Manager exists in the level { playerManager = FindObjectOfType <PlayerManager> (); //Find the Player Manager userName = playerManager.getUserName(); //Get the Username levelName = SceneManager.GetActiveScene().name; //Get the name of the level name //Server URLS urlRetrieve = ("http://secs.oakland.edu/~nferman/retrieve.php?level=" + levelName); //Retrieves the high score urlUpload = ("http://secs.oakland.edu/~nferman/upload.php?level=" + levelName + "&Privatekey=j5G1L23@#"); //Upload's high score urlRetrieveGrade = ("http://secs.oakland.edu/~nferman/retrievegrades.php?level=" + levelName + "&Name=" + userName); //Retrieves grade for current user's current level urlUploadGrade = ("http://secs.oakland.edu/~nferman/uploadgrades.php?level=" + levelName + "&Privatekey=j5G1L23@#"); //Upload's grade of current level urlRetrieveMedals = ("http://secs.oakland.edu/~nferman/retrievemedals.php?level=" + levelName + "&Name=" + userName); //Retrieves the number of medals for current level ppM = FindObjectOfType <PlayerPrefsManager> (); // //Finds the Player Prefs Manager Script ic = FindObjectOfType <InstructionsCanvas> (); //Finds the Instructions Canvas Script StartCoroutine(retrieveMedals()); //Starts the Coroutine to retrieve the user's number of medals for the level StartCoroutine(dispPan()); //Displays the Instruction Canvas if (ppM.getLevelInst() == 0) //If the player has marked "Do not show this message again... { hasStarted = true; //Start the game immediately } } //NOTE: Everything referring to grade may not be needed anymore. //Initialize the following code... resetting = false; //Sets the resetting boolean to false (if the game was reset) restartButton.gameObject.SetActive(true); //Activates the restart button (if the game was reset) //nextLevel.gameObject.SetActive (false); //Sets the next level button to false. May not be needed anymore. attempts = 0; //Display the number of attempts objPlaced = 0; //Set the number of muscles placed so far to 0. //Display the timer timeSpent = 0f; seconds = 0f; minutes = 0f; calcScore(); //Refresh the score //This is a formula to adjust the allowed time allowedTime = BASETIME + (int.Parse(objCount.ToString()) * 10); roundTime(); //Rounds the allowed time to the nearest 5 seconds. }
// Use this for initialization void Start() { statTracking = FindObjectOfType <StatTracking> (); guesses = 0; //Makes sure that guesses starts off equal to 0. }
// Use this for initialization void Start() { //Find needed components in children. question = transform.FindChild("Question").GetComponent <Text>(); corInc = transform.FindChild("CorInc").GetComponent <Text> (); sAnswer = transform.FindChild("Answer Button").GetComponent <Button> (); nQuestion = transform.FindChild("Next Button").GetComponent <Button>(); hint = transform.FindChild("Hint Button").GetComponent <Button>(); answers1 = GetComponentInChildren <Dropdown> (); //Set the size of the canvas rt = GetComponent <RectTransform> (); rt.sizeDelta = new Vector2(WIDTH, HEIGHT); /*Set the functions of the buttons. Because Unity has a terrible prefab system. * // ***TO BE USED ONLY IF BUTTONS ARE NOT ALREADY ASSIGNED IN INSPECTOR*** * sAnswer.onClick.RemoveAllListeners (); * nQuestion.onClick.RemoveAllListeners (); * hint.onClick.RemoveAllListeners (); * if (statTracking.levelIdentity == "Q0") * sAnswer.onClick.AddListener (() => submitTestAnswer ()); * else * sAnswer.onClick.AddListener (() => submitAnswer()); * nQuestion.onClick.AddListener (() => nextQuestion()); * hint.onClick.AddListener (() => giveHint()); */ hint.gameObject.SetActive(false); //Make sure only one canvas is enabled nQuestion.gameObject.SetActive(false); //question2.gameObject.SetActive (false); //Find the Level Manager levelManager = FindObjectOfType <LevelManager> (); //Find the Quiz Popup Script. quizPopup = GetComponentInParent <QuizPopup> (); //Find the QuizRandomQ1 qr1 = GetComponent <QuizRandomQ1> (); //Set the Correct Answer to this string. correctAnswer = qr1.getAnswer(); //Find the Stat Tracker and ReportSelf scripts. statTracking = FindObjectOfType <StatTracking>(); if (statTracking.identifyLevel() == "Q0" || statTracking.identifyLevel() == "QC") { rs = transform.GetComponentInChildren <ReportSelf> (); } else { rs = GetComponentInParent <ReportSelf> (); } setQuestion(); //When panel opens, make sure no other panel can open. levelManager.noObjections = false; levelManager.canvasOpen = true; //Set the feedback as empty. corInc.text = ""; }
// Use this for initialization void Start() { //Get the position of the parent. //This is the correct position to place the object. xParent = transform.root.position.x; yParent = transform.root.position.y; //Set hint button toggles to inactive. hint2Toggle.gameObject.SetActive(false); //We may need to rework how this feature works. //Find the Sprite Renderer for fading/recoloring purposes. spriteRenderer = GetComponent <SpriteRenderer> (); //Find the box collider so it can be removed when object is placed. polyCol = GetComponent <PolygonCollider2D> (); //Sets a range of + or - the Offset within the correct position. xRangeHigh = xParent + OFFSET; xRangeLow = xParent - OFFSET; yRangeHigh = yParent + OFFSET; yRangeLow = yParent - OFFSET; //Set range for audio hint system. warmRange = 120; hotRange = 15; //Make the sprite hint invisible at the start. hintBox.enabled = false; hintBox.color = new Color(1f, 1f, 1f, 0f); //Find the Level Manager. levelManager = FindObjectOfType <LevelManager> (); //Find the Stat Tracking and ReportSelf Scripts. statTracking = FindObjectOfType <StatTracking>(); rs = GetComponentInChildren <ReportSelf> (); //Scaling objects to fit inside the box. This is probably not needed. releaseScale = 50f; snapScale = 50f; //Following is code for if we decide to have both drag and drop AND quiz questions in one level. //levelManager.noObjections = true; quizP = GetComponent <QuizPopup> (); //Make sure that myAttempt starts at 0 //guesses = 0; //NOTE: This is handled through ReportSelf now. //Count all body parts piece = (this.tag == "unPlaced"); if (piece) { levelManager.startObjects++; levelManager.incObjCount(); //This may no longer be needed. } }