/// <summary> /// Reloads the player's hat that is currently equipped /// </summary> public void LoadHat() { if (EquippedHat == null) { return; } if (Hat != null) { Destroy(Hat); } Hat = Instantiate(Resources.Load("Hats/" + EquippedHat)) as GameObject; Hat.transform.SetParent(head, false); HatScript h = Hat.GetComponent <HatScript>(); Hat.transform.localPosition = h.pos; Hat.transform.localRotation = h.rot; if (h.hideshair) { Hair.transform.GetChild(0).GetComponent <SkinnedMeshRenderer>().enabled = false; //Hair.SetActive(false); } else { Hair.transform.GetChild(0).GetComponent <SkinnedMeshRenderer>().enabled = true; //Hair.SetActive(true); } }
private IEnumerator shuffle() { for (int i = 0; i < shuffleTime; i++) { int firstHat = Random.Range(0, 3); int secondHat = Random.Range(0, 3); while (secondHat == firstHat) { secondHat = Random.Range(0, 3); } StartCoroutine(hats[firstHat].moveTo(positions[secondHat].transform.position, 1f - 0.07f * i)); StartCoroutine(hats[secondHat].moveTo(positions[firstHat].transform.position, 1f - 0.07f * i)); HatScript hat = hats[firstHat]; hats[firstHat] = hats[secondHat]; hats[secondHat] = hat; yield return(new WaitForSeconds(1 - 0.07f * i)); } flagPole.transform.position = goodHat.transform.position; flagPole.SetActive(true); GameObject.FindGameObjectWithTag("Robot").GetComponent <RobotScheduler>().playNextAction(); }
private void UseHatProperty(GameObject newRobot, bool isImposter, GameObject selectedSphere) { HatScript script = newRobot.AddComponent <HatScript> (); script.arCamera = arCamera; script.isImposter = isImposter; script.resultText = resultText; script.gestureButtonScript = holdButton.GetComponent <GestureButton> (); script.selectedSphere = selectedSphere; script.hatPrefab = hatPrefab; }
public IEnumerator unravel(HatScript chosenHat) { StartCoroutine(hats[0].moveTo(new Vector3(hats[0].transform.position.x, hats[0].transform.position.y + 50, hats[0].transform.position.z), 1f)); StartCoroutine(hats[1].moveTo(new Vector3(hats[1].transform.position.x, hats[1].transform.position.y + 50, hats[1].transform.position.z), 1f)); StartCoroutine(hats[2].moveTo(new Vector3(hats[2].transform.position.x, hats[2].transform.position.y + 50, hats[2].transform.position.z), 1f)); yield return(new WaitForSeconds(1f)); if (chosenHat != goodHat) { bottomPit.SetActive(false); RobotScheduler robot = GameObject.FindGameObjectWithTag("Robot").GetComponent <RobotScheduler>(); robot.stringContainersQueue.Enqueue(new RobotScheduler.stringContainer() { strings = new List <string>() { "Ohhh...too bad !" }, expressions = new List <RobotScheduler.stringContainer.faceExpression> { RobotScheduler.stringContainer.faceExpression.FRUSTR } }); robot.queueAc.Enqueue(RobotScheduler.EventAction.TALK); robot.playNextAction(); } else { RobotScheduler robot = GameObject.FindGameObjectWithTag("Robot").GetComponent <RobotScheduler>(); robot.stringContainersQueue.Enqueue(new RobotScheduler.stringContainer() { strings = new List <string>() { "Well done !" }, expressions = new List <RobotScheduler.stringContainer.faceExpression> { RobotScheduler.stringContainer.faceExpression.HAPPY } }); robot.queueAc.Enqueue(RobotScheduler.EventAction.TALK); robot.playNextAction(); RenderSettings.ambientIntensity = 1.2f; } }
public void startEvent() { goodHat = hats[0]; StartCoroutine(letsMagic()); }
// Use this for initialization void Start() { hatScript = colliderHat.GetComponent <HatScript>(); doorScript = timsDoor.GetComponent <DoorScript>(); animator = GetComponent <Animator>(); }