public void CheckResult() { RobotLight.GetComponent <Light>().enabled = true; if (resultBox.GetComponent <InputField>().text.Equals("even", System.StringComparison.CurrentCultureIgnoreCase) || resultBox.GetComponent <InputField>().text.Equals("odd", System.StringComparison.CurrentCultureIgnoreCase)) { bool even = resultBox.GetComponent <InputField>().text.Equals("even", System.StringComparison.CurrentCultureIgnoreCase) ? true : false; if (even == evenState) { correct.SetActive(true); RobotEye.GetComponent <MeshRenderer>().material = correctMat; RobotLight.GetComponent <Light>().color = correctColor; StartCoroutine(OtherQuestion()); RobotBody.GetComponent <Animation>().clip = RobotBody.GetComponent <Animation>().GetClip("Good"); RobotBody.GetComponent <Animation>().Play(); } else { wrong.SetActive(true); RobotEye.GetComponent <MeshRenderer>().material = wrongMat; RobotLight.GetComponent <Light>().color = wrongColor; StartCoroutine(OtherQuestion()); RobotBody.GetComponent <Animation>().clip = RobotBody.GetComponent <Animation>().GetClip("Wrong"); RobotBody.GetComponent <Animation>().Play(); } } else { confused.SetActive(true); RobotEye.GetComponent <MeshRenderer>().material = confusedMat; RobotLight.GetComponent <Light>().color = confusedColor; StartCoroutine(QuestionAgain()); RobotBody.GetComponent <Animation>().clip = RobotBody.GetComponent <Animation>().GetClip("Confused"); RobotBody.GetComponent <Animation>().Play(); } }
public void CheckResult() { RobotLight.GetComponent <Light>().enabled = true; resultBox.GetComponent <InputField>().text = resultBox.GetComponent <InputField>().text.ToLower(); if (resultBox.GetComponent <InputField>().text.Contains("give") && resultBox.GetComponent <InputField>().text.Contains("butter") || resultBox.GetComponent <InputField>().text.Contains("make") && resultBox.GetComponent <InputField>().text.Contains("questions")) { correct.SetActive(true); RobotEye.GetComponent <MeshRenderer>().material = correctMat; RobotLight.GetComponent <Light>().color = correctColor; StartCoroutine(OtherQuestion()); RobotBody.GetComponent <Animation>().clip = RobotBody.GetComponent <Animation>().GetClip("Good"); RobotBody.GetComponent <Animation>().Play(); } else { wrong.SetActive(true); RobotEye.GetComponent <MeshRenderer>().material = wrongMat; RobotLight.GetComponent <Light>().color = wrongColor; StartCoroutine(OtherQuestion()); RobotBody.GetComponent <Animation>().clip = RobotBody.GetComponent <Animation>().GetClip("Wrong"); RobotBody.GetComponent <Animation>().Play(); } if (resultBox.GetComponent <InputField>().text.Equals("be my friend", System.StringComparison.CurrentCultureIgnoreCase)) { confused.SetActive(true); RobotEye.GetComponent <MeshRenderer>().material = confusedMat; RobotLight.GetComponent <Light>().color = confusedColor; StartCoroutine(QuestionAgain()); RobotBody.GetComponent <Animation>().clip = RobotBody.GetComponent <Animation>().GetClip("Confused"); RobotBody.GetComponent <Animation>().Play(); } }
public void CheckResult() { RobotLight.GetComponent <Light>().enabled = true; if (int.TryParse(resultBox.GetComponent <InputField>().text, out result)) { if (result == X * Y) { correct.SetActive(true); RobotEye.GetComponent <MeshRenderer>().material = correctMat; RobotLight.GetComponent <Light>().color = correctColor; StartCoroutine(OtherQuestion()); RobotBody.GetComponent <Animation>().clip = RobotBody.GetComponent <Animation>().GetClip("Good"); RobotBody.GetComponent <Animation>().Play(); } else { wrong.SetActive(true); RobotEye.GetComponent <MeshRenderer>().material = wrongMat; RobotLight.GetComponent <Light>().color = wrongColor; StartCoroutine(OtherQuestion()); RobotBody.GetComponent <Animation>().clip = RobotBody.GetComponent <Animation>().GetClip("Wrong"); RobotBody.GetComponent <Animation>().Play(); } } else { confused.SetActive(true); RobotEye.GetComponent <MeshRenderer>().material = confusedMat; RobotLight.GetComponent <Light>().color = confusedColor; StartCoroutine(QuestionAgain()); RobotBody.GetComponent <Animation>().clip = RobotBody.GetComponent <Animation>().GetClip("Confused"); RobotBody.GetComponent <Animation>().Play(); } }
IEnumerator QuestionAgain() { yield return new WaitForSeconds(3); confused.SetActive(false); RobotLight.GetComponent<Light>().enabled = false; RobotEye.GetComponent<MeshRenderer>().material = normalMat; RobotBody.GetComponent<Animation>().Stop(); }
public void CheckResult() { RobotLight.GetComponent <Light>().enabled = true; if (!resultBox.GetComponent <InputField>().text.Contains("1") && !resultBox.GetComponent <InputField>().text.Contains("2") && !resultBox.GetComponent <InputField>().text.Contains("3") && !resultBox.GetComponent <InputField>().text.Contains("4") && !resultBox.GetComponent <InputField>().text.Contains("5") && !resultBox.GetComponent <InputField>().text.Contains("6") && !resultBox.GetComponent <InputField>().text.Contains("7") && !resultBox.GetComponent <InputField>().text.Contains("8") && !resultBox.GetComponent <InputField>().text.Contains("9") && !resultBox.GetComponent <InputField>().text.Contains("0")) { switch (index) { case 0: response = "Act"; break; case 1: response = "Eon"; break; case 2: response = "Be Re"; break; case 3: response = "God"; break; case 4: response = "Rec Of"; break; case 5: response = "Lube"; break; } if (resultBox.GetComponent <InputField>().text.Equals(response, System.StringComparison.CurrentCultureIgnoreCase)) { correct.SetActive(true); RobotEye.GetComponent <MeshRenderer>().material = correctMat; RobotLight.GetComponent <Light>().color = correctColor; StartCoroutine(OtherQuestion()); RobotBody.GetComponent <Animation>().clip = RobotBody.GetComponent <Animation>().GetClip("Good"); RobotBody.GetComponent <Animation>().Play(); } else { wrong.SetActive(true); RobotEye.GetComponent <MeshRenderer>().material = wrongMat; RobotLight.GetComponent <Light>().color = wrongColor; StartCoroutine(OtherQuestion()); RobotBody.GetComponent <Animation>().clip = RobotBody.GetComponent <Animation>().GetClip("Wrong"); RobotBody.GetComponent <Animation>().Play(); } } else { confused.SetActive(true); RobotEye.GetComponent <MeshRenderer>().material = confusedMat; RobotLight.GetComponent <Light>().color = confusedColor; StartCoroutine(QuestionAgain()); RobotBody.GetComponent <Animation>().clip = RobotBody.GetComponent <Animation>().GetClip("Confused"); RobotBody.GetComponent <Animation>().Play(); } }
public void CheckResult() { RobotLight.GetComponent<Light>().enabled = true; if (!resultBox.GetComponent<InputField>().text.Contains("1") && !resultBox.GetComponent<InputField>().text.Contains("2") && !resultBox.GetComponent<InputField>().text.Contains("3") && !resultBox.GetComponent<InputField>().text.Contains("4") && !resultBox.GetComponent<InputField>().text.Contains("5") && !resultBox.GetComponent<InputField>().text.Contains("6") && !resultBox.GetComponent<InputField>().text.Contains("7") && !resultBox.GetComponent<InputField>().text.Contains("8") && !resultBox.GetComponent<InputField>().text.Contains("9") && !resultBox.GetComponent<InputField>().text.Contains("0")) { switch (index) { case 0: capital = "Santiago"; break; case 1: capital = "Lima"; break; case 2: capital = "La Paz"; break; case 3: capital = "Buenos Aires"; break; case 4: capital = "Brasilia"; break; case 5: capital = "Mexico"; break; } if (resultBox.GetComponent<InputField>().text.Equals(capital,System.StringComparison.CurrentCultureIgnoreCase)) { correct.SetActive(true); RobotEye.GetComponent<MeshRenderer>().material = correctMat; RobotLight.GetComponent<Light>().color = correctColor; StartCoroutine(OtherQuestion()); RobotBody.GetComponent<Animation>().clip = RobotBody.GetComponent<Animation>().GetClip("Good"); RobotBody.GetComponent<Animation>().Play(); } else { wrong.SetActive(true); RobotEye.GetComponent<MeshRenderer>().material = wrongMat; RobotLight.GetComponent<Light>().color = wrongColor; StartCoroutine(OtherQuestion()); resultBox.GetComponent<InputField>().text = ""; RobotBody.GetComponent<Animation>().clip = RobotBody.GetComponent<Animation>().GetClip("Wrong"); RobotBody.GetComponent<Animation>().Play(); } } else { confused.SetActive(true); RobotEye.GetComponent<MeshRenderer>().material = confusedMat; RobotLight.GetComponent<Light>().color = confusedColor; StartCoroutine(QuestionAgain()); RobotBody.GetComponent<Animation>().clip = RobotBody.GetComponent<Animation>().GetClip("Confused"); RobotBody.GetComponent<Animation>().Play(); } }
public void BuildRobot() { // wave.AddToRobotCount(1); GameObject mover = Instantiate( movers[Random.Range(0, movers.Length)], transform.position, Quaternion.identity); // Debug.Log(mover.transform.position); mover.transform.parent = transform; mover.transform.localPosition = new Vector3(0, 0, 0); int bodyIndex = Random.Range(0, bodies.Length); GameObject body = Instantiate( bodies[bodyIndex], Vector3.zero, bodies[bodyIndex].transform.rotation); body.transform.parent = mover.transform; body.transform.localPosition = Vector3.zero; RobotBody robotBody = body.GetComponent <RobotBody>(); robotBody.SetRobotParent(mover); robotBody.SetRobotBuilder(this); robotBody.SetRobotWaveGenerator(wave); robotBody.SetHealth(health); if (addFood) { GameObject food = Instantiate(foods[Random.Range(0, foods.Length)], robotBody.foodPosition.position, robotBody.foodPosition.rotation); food.transform.parent = robotBody.foodPosition; } if (addShooter) { GameObject shooter = Instantiate(shooters[Random.Range(0, shooters.Length)], robotBody.shooterPosition.position, robotBody.shooterPosition.rotation); shooter.transform.parent = robotBody.shooterPosition; } if (addFace) { GameObject eye = Instantiate(eyes[Random.Range(0, eyes.Length)], robotBody.eyesPosition.position, robotBody.eyesPosition.rotation); eye.transform.parent = robotBody.eyesPosition; GameObject nose = Instantiate(noses[Random.Range(0, noses.Length)], robotBody.nosePosition.position, robotBody.nosePosition.rotation); nose.transform.parent = robotBody.nosePosition; GameObject mouth = Instantiate(mouths[Random.Range(0, mouths.Length)], robotBody.mouthPosition.position, robotBody.mouthPosition.rotation); mouth.transform.parent = robotBody.mouthPosition; } }
public void SetBody(RobotBody body) { robot_body_ = body; if (body == null) { GetComponent<ChangeColorOnGrab>().Disconnect(); // audio.Stop(); } else { GetComponent<ChangeColorOnGrab>().Connect(); // audio.Play(); } }
IEnumerator OtherQuestion() { yield return new WaitForSeconds(3); wrong.SetActive(false); correct.SetActive(false); RobotLight.GetComponent<Light>().enabled = false; RobotEye.GetComponent<MeshRenderer>().material = normalMat; QuestionManager.TextChange(); resultBox.GetComponent<InputField>().text = ""; RobotBody.GetComponent<Animation>().Stop(); Start(); }
public void SetBody(RobotBody body) { robot_body_ = body; if (body == null) { GetComponent <ChangeColorOnGrab>().Disconnect(); // audio.Stop(); } else { GetComponent <ChangeColorOnGrab>().Connect(); // audio.Play(); } }
// Use this for initialization void Start() { m_scientistButtonNo = Random.Range(0, 8); m_aiButtonNo = Random.Range(0, 8); m_blackoutScript = blackoutCanvas.GetComponent <Blackout>(); m_doorControllerScript = ai.GetComponent <DoorController>(); m_aiPowerScript = ai.GetComponent <AIPower>(); m_robotBodyScript = robotBody.GetComponent <RobotBody>(); m_timerScript = gameController.GetComponent <Timer>(); m_hackingDocumentScript = ai.GetComponent <HackingDocuments>(); m_aiButtonPressedText = aiButtonPressedGO.GetComponent <Text>(); m_scientistButtonPressedText = scientistButtonPressedGO.GetComponentInChildren <Text>(); TextWriteUp(); }
// Use this for initialization void Start() { m_blackoutScript = blackoutCanvas.GetComponent <Blackout>(); m_doorControllerScript = ai.GetComponent <DoorController>(); m_lightControllerScript = ai.GetComponent <LightController>(); m_cameraController = ai.GetComponent <CameraController>(); m_aiPowerScript = ai.GetComponent <AIPower>(); m_robotBodyScript = robotBody.GetComponent <RobotBody>(); m_timerScript = gameController.GetComponent <Timer>(); m_hackingDocumentScript = ai.GetComponent <HackingDocuments>(); m_buttonAudioSource = switchesButton.GetComponent <AudioSource>(); m_buttonAnimator = switchesButton.GetComponent <Animator>(); m_randObjects = Random.Range(0, 3); m_randPower = Random.Range(0, 3); for (int i = 0; i < m_actionNumber.Length; i++) { m_numberList.Add(i); } for (int i = 0; i < m_actionNumber.Length; i++) { int randomNo = Random.Range(0, m_numberList.Count); m_actionNumber[i] = m_numberList[randomNo]; m_numberList.Remove(m_numberList[randomNo]); if (m_actionNumber[i] != 7) { m_actionMessages[i] = string.Format("Switches on {0} will {1}", m_switchPositions[i], m_actions[m_actionNumber[i]]); } else { m_actionMessages[i] = string.Format("Switches on {0} will increase {1} by {2} power", m_switchPositions[i], m_poweredObjects[m_randObjects], m_powerIncreased[m_randPower]); } if (i == 0) { m_currentNumber = m_actionNumber[i]; //print(m_currentNumber); } if (m_actionNumber[i] == 3) { robotBodySwitches.text = string.Format("Switches are required to be at: {0}", m_switchPositions[i]); } } ScientistSwitchInfo(); AISwitchInfo(); }
public void CheckResult() { RobotLight.GetComponent <Light>().enabled = true; if (!resultBox.GetComponent <InputField>().text.Contains("1") && !resultBox.GetComponent <InputField>().text.Contains("2") && !resultBox.GetComponent <InputField>().text.Contains("3") && !resultBox.GetComponent <InputField>().text.Contains("4") && !resultBox.GetComponent <InputField>().text.Contains("5") && !resultBox.GetComponent <InputField>().text.Contains("6") && !resultBox.GetComponent <InputField>().text.Contains("7") && !resultBox.GetComponent <InputField>().text.Contains("8") && !resultBox.GetComponent <InputField>().text.Contains("9") && !resultBox.GetComponent <InputField>().text.Contains("0")) { char[] charArray = resultBox.GetComponent <InputField>().text.ToCharArray(); Array.Reverse(charArray); string reversedString = new string(charArray); if (resultBox.GetComponent <InputField>().text.Equals(reversedString, StringComparison.CurrentCultureIgnoreCase)) { correct.SetActive(true); RobotEye.GetComponent <MeshRenderer>().material = correctMat; RobotLight.GetComponent <Light>().color = correctColor; StartCoroutine(OtherQuestion()); RobotBody.GetComponent <Animation>().clip = RobotBody.GetComponent <Animation>().GetClip("Good"); RobotBody.GetComponent <Animation>().Play(); } else { wrong.SetActive(true); RobotEye.GetComponent <MeshRenderer>().material = wrongMat; RobotLight.GetComponent <Light>().color = wrongColor; StartCoroutine(OtherQuestion()); RobotBody.GetComponent <Animation>().clip = RobotBody.GetComponent <Animation>().GetClip("Wrong"); RobotBody.GetComponent <Animation>().Play(); } } else { confused.SetActive(true); RobotEye.GetComponent <MeshRenderer>().material = confusedMat; RobotLight.GetComponent <Light>().color = confusedColor; StartCoroutine(QuestionAgain()); RobotBody.GetComponent <Animation>().clip = RobotBody.GetComponent <Animation>().GetClip("Confused"); RobotBody.GetComponent <Animation>().Play(); } }
// Update is called once per frame void Update() { if (started && IsAllFinished() && !ended) { for (int i = 0; i < winObjectsActivate.Length; i++) { winObjectsActivate[i].SetActive(true); } for (int i = 0; i < winObjectsDeactivate.Length; i++) { winObjectsDeactivate[i].SetActive(false); } //PlayerPrefs.SetInt("Wave", PlayerPrefs.GetInt("Wave, 1") + 1); PlayerPrefs.SetInt("Money", PlayerPrefs.GetInt("Money", 0) + RobotBody.GetTotalMoneyEarnedThisWave()); RobotBody.ResetTotalMoneyEarnedThisWave(); ended = true; } }
public void CheckResult(int id) { RobotLight.GetComponent <Light>().enabled = true; if (id == 3) { correct.SetActive(true); RobotEye.GetComponent <MeshRenderer>().material = correctMat; RobotLight.GetComponent <Light>().color = correctColor; StartCoroutine(OtherQuestion()); RobotBody.GetComponent <Animation>().clip = RobotBody.GetComponent <Animation>().GetClip("Good"); RobotBody.GetComponent <Animation>().Play(); } else { wrong.SetActive(true); RobotEye.GetComponent <MeshRenderer>().material = wrongMat; RobotLight.GetComponent <Light>().color = wrongColor; StartCoroutine(OtherQuestion()); RobotBody.GetComponent <Animation>().clip = RobotBody.GetComponent <Animation>().GetClip("Wrong"); RobotBody.GetComponent <Animation>().Play(); } }
public void childInjectorDoesntReturnToParentAfterUsingParentInjectorForMissingMappings() { injector.Map(typeof(RobotAnkle)); injector.Map(typeof(RobotFoot)); injector.Map(typeof(RobotToes)); InjectionMapping leftFootMapping = injector.Map(typeof(RobotLeg), "leftLeg"); Injector leftChildInjector = injector.CreateChildInjector(); leftChildInjector.Map(typeof(RobotFoot)).ToType(typeof(LeftRobotFoot)); leftFootMapping.SetInjector(leftChildInjector); InjectionMapping rightFootMapping = injector.Map(typeof(RobotLeg), "rightLeg"); Injector rightChildInjector = injector.CreateChildInjector(); rightChildInjector.Map(typeof(RobotFoot)).ToType(typeof(RightRobotFoot)); rightFootMapping.SetInjector(rightChildInjector); RobotBody robotBody = injector.InstantiateUnmapped <RobotBody>(); Assert.IsInstanceOf <RightRobotFoot>(robotBody.rightLeg.ankle.foot, "Right RobotFoot should have RightRobotFoot"); Assert.IsInstanceOf <LeftRobotFoot>(robotBody.leftLeg.ankle.foot, "Left RobotFoot should have LeftRobotFoot"); }
public void InjectorUsesChildInjectorForSpecifiedMapping() { injector.Map(typeof(RobotFoot)); InjectionMapping leftFootMapping = injector.Map(typeof(RobotLeg), "leftLeg"); Injector leftChildInjector = injector.CreateChildInjector(); leftChildInjector.Map(typeof(RobotAnkle)); leftChildInjector.Map(typeof(RobotFoot)).ToType(typeof(LeftRobotFoot)); leftFootMapping.SetInjector(leftChildInjector); InjectionMapping rightFootMapping = injector.Map(typeof(RobotLeg), "rightLeg"); Injector rightChildInjector = injector.CreateChildInjector(); rightChildInjector.Map(typeof(RobotAnkle)); rightChildInjector.Map(typeof(RobotFoot)).ToType(typeof(RightRobotFoot)); rightFootMapping.SetInjector(rightChildInjector); RobotBody robotBody = injector.InstantiateUnmapped <RobotBody>(); Assert.IsInstanceOf <RightRobotFoot>(robotBody.rightLeg.ankle.foot, "Right RobotLeg should have a RightRobotFoot"); Assert.IsInstanceOf <LeftRobotFoot>(robotBody.leftLeg.ankle.foot, "Left RobotLeg should have a LeftRobotFoot"); }
public void ChildInjectorUsesParentForMissingMappings() { injector.Map(typeof(RobotFoot)); injector.Map(typeof(RobotToes)); InjectionMapping leftFootMapping = injector.Map(typeof(RobotLeg), "leftLeg"); Injector leftChildInjector = injector.CreateChildInjector(); leftChildInjector.Map(typeof(RobotAnkle)); leftChildInjector.Map(typeof(RobotFoot)).ToType(typeof(LeftRobotFoot)); leftFootMapping.SetInjector(leftChildInjector); InjectionMapping rightFootMapping = injector.Map(typeof(RobotLeg), "rightLeg"); Injector rightChildInjector = injector.CreateChildInjector(); rightChildInjector.Map(typeof(RobotAnkle)); rightChildInjector.Map(typeof(RobotFoot)).ToType(typeof(RightRobotFoot)); rightFootMapping.SetInjector(rightChildInjector); RobotBody robotBody = injector.InstantiateUnmapped <RobotBody>(); Assert.IsInstanceOf <RobotToes>(robotBody.rightLeg.ankle.foot.toes, "Right RobotFoot should have toes"); Assert.IsInstanceOf <RobotToes>(robotBody.leftLeg.ankle.foot.toes, "Right RobotFoot should have toes"); }
// Use this for initialization void Start() { waveBuilders = new List <RobotBuilder>(); ClearAllWaveBuilders(); RobotBody.ResetTotalMoneyEarnedThisWave(); }
public RobotFacade() { rc = new RobotColor(); rh = new RobotHands(); rb = new RobotBody(); }
// Update is called once per frame void Update() { text.text = prefix + RobotBody.GetTotalMoneyEarnedThisWave() + suffix; }
public RobotFacade(RobotType robotType, string color = "steel") { _robotBody = new RobotBody(robotType); _robotColor = new RobotColor(color); }
public RobotFacade() { rc = new RobotColor(); rm = new RoboMetal(); rb = new RobotBody(); }