public void _wm_spawnNoAnswerQuestion() { Vector3 playerPos = player.transform.position; playerPos.y = 2.5f; GameObject newNAQGO = (GameObject)Instantiate(noAnswerQuestionPrefab, playerPos + new Vector3(-1, 0.3f, -1.3f), Quaternion.Euler(50.0f, 0, 0)); NoAnswerQuestion newNAQ = newNAQGO.GetComponent <NoAnswerQuestion> (); string nextStr = bank.getNextStringId(); nextStr = rosetta.retrieveString(nextStr); newNAQ.transform.localScale = 0.2f * Vector2.one; newNAQ.initialize(); newNAQ.setText(nextStr); newNAQ.setAutoTransitionOut(3.0f + nextStr.Length * 0.05f); newNAQ.transitionIn(); floater [questionNumber++].GetComponent <MeshRenderer> ().enabled = false; }
void OnTriggerEnter(Collider other) { if (other.tag == "WorldStatic") { opacitySpeed = maxOpacitySpeed; } if (other.tag == "Player") { opacitySpeed = maxOpacitySpeed; } RedEyesController rec = GameObject.Find("RedEyesController").GetComponent <RedEyesController> (); if (other.tag == "Player") { if (!other.GetComponent <PlayerScript> ().blocked) { if (rec.canMakeText()) { Debug.Log("Player blink!!"); other.GetComponent <PlayerScript>().Blink(4.0f); Vector3 newPos = other.gameObject.transform.position; newPos.y = newPos.y + 2.5f; GameObject newText; newText = (GameObject)Instantiate(thoughtTextPrefab, newPos, Quaternion.Euler(0, 0, 0)); string sss = stringBank.getNextStringId(); sss = stringBank.getNextString(); newText.GetComponent <TextMesh> ().text = stringBank.getNextString(); rec.textMade(); //letter.decLetter (); letter.decStep(); letter.decStep(); //letter.decStep(); //letter.decStep(); //letter.decStep(); //letter.decStep(); } } } }
void OnTriggerEnter(Collider other) { if (state == WhirlwindState.dying) { return; } if (other.tag != "Player") { return; } else { parent.frozen = true; } // tell the player to spawn shadow. Will return bool value // if player.spawnShadow() returns true, continue spawning the shadow // otherwise, return doing nothing if (!other.gameObject.GetComponent <PlayerScript> ().spawnShadow()) { return; } string lvl = parent.level.locationName.Substring(0, 6); string key = lvl + "SpawnedShadows"; int nShadows = parent.level.retrieveIntValue(key); int control, strength; control = shadowSpawnController.getControl(); strength = shadowSpawnController.getStrength(); if (nShadows < 4) { shadowStringBank = shadowStringBanks.bank [nShadows]; redEyesStringBank = redEyesStringBanks.bank [nShadows]; GameObject newShadow; newShadow = (GameObject)Instantiate(shadowPrefab, other.gameObject.transform.position + new Vector3(0, 0.0f, 0), Quaternion.Euler(0, 0, 0)); // check spawn direction bool rightOK = false; bool leftOK = false; RaycastHit hit; rightOK = !Physics.Raycast(other.gameObject.transform.position, Vector3.right, 10.0f); leftOK = !Physics.Raycast(other.gameObject.transform.position, Vector3.left, 10.0f); if (leftOK && (!rightOK)) { newShadow.GetComponent <Shadow> ().spawnDirection = -1.0f; } shadowStringBank.rosetta = rosetta; placesStringBank.rosetta = rosetta; datesStringBank.rosetta = rosetta; string sssId = shadowStringBank.getNextStringId(); string sss = shadowStringBank.getNextString(); string pl = placesStringBank.getNextStringId(); pl = placesStringBank.getNextString(); string dt = datesStringBank.getNextStringId(); dt = datesStringBank.getNextString(); shadowSpawnController.phrase.setText(sss); shadowSpawnController.phrase.fadeIn(); shadowSpawnController.phrase.fadeOut(5.0f); shadowSpawnController.dates.setText(dt); shadowSpawnController.dates.fadeIn(); shadowSpawnController.dates.fadeOut(5.0f); shadowSpawnController.places.setText(pl); shadowSpawnController.places.fadeIn(); shadowSpawnController.places.fadeOut(5.0f); if (sssId.Contains("Familia")) { shadowSpawnController.iconAnimation [iconFamily].resetAnimation(); shadowSpawnController.iconFader[iconFamily].fadeIn(); shadowSpawnController.iconFader[iconFamily].fadeOut(5.0f); } if (sssId.Contains("Amigos")) { shadowSpawnController.iconAnimation [iconFriends].resetAnimation(); shadowSpawnController.iconFader[iconFriends].fadeIn(); shadowSpawnController.iconFader[iconFriends].fadeOut(5.0f); } if (sssId.Contains("Pareja")) { shadowSpawnController.iconAnimation [iconWork].resetAnimation(); shadowSpawnController.iconFader[iconCouple].fadeIn(); shadowSpawnController.iconFader[iconCouple].fadeOut(5.0f); } if (sssId.Contains("Trabajo")) { shadowSpawnController.iconAnimation [iconWork].resetAnimation(); shadowSpawnController.iconFader[iconWork].fadeIn(); shadowSpawnController.iconFader[iconWork].fadeOut(5.0f); } newShadow.GetComponent <Shadow> ().thoughtTextPrefab = thoughtTextPrefab; newShadow.GetComponent <Rigidbody> ().velocity = new Vector3(0, 0, 0); newShadow.GetComponent <Shadow> ().initialize(); newShadow.GetComponent <Shadow> ().eyesPrefab = redeyesPrefab; redEyesStringBank.rosetta = rosetta; newShadow.GetComponent <Shadow> ().id = nShadows; newShadow.GetComponent <Shadow> ().redEyesStringBank = redEyesStringBank; newShadow.GetComponent <Shadow> ().rosetta = rosetta; shadowSpawnController.addShadow(newShadow.GetComponent <Shadow> ()); parent.level.storeIntValue(key, ++nShadows); GameObject newCGaugeGO; GameObject newSGaugeGO; newCGaugeGO = (GameObject)Instantiate(shadowSpawnController.csGaugePrefab, other.gameObject.transform.position + new Vector3(-2.0f, 5.8f, 0), Quaternion.Euler(0, 0, 0)); newSGaugeGO = (GameObject)Instantiate(shadowSpawnController.csGaugePrefab, other.gameObject.transform.position + new Vector3(2.0f, 5.8f, 0), Quaternion.Euler(0, 0, 0)); ShadowPowerIndicator con = newCGaugeGO.GetComponent <ShadowPowerIndicator> (); ShadowPowerIndicator str = newSGaugeGO.GetComponent <ShadowPowerIndicator> (); con.initialize(true, control); str.initialize(false, strength); con.transform.SetParent(newShadow.transform); str.transform.SetParent(newShadow.transform); con.transform.localScale = new Vector3(2, 2, 2); str.transform.localScale = new Vector3(2, 2, 2); } this.state = WhirlwindState.dying; }