private IEnumerator ShowScore() { //播放声音,不能勾选PlayOnAwake,否则声音比界面先来 audio.Play(); /*while (score < 10){ * score += Random.Range (1,3); * Score .text=score.ToString() ; * yield return null; * } * while (score < mScore){ * score += del; * Score .text=score.ToString() ; * yield return null; * }*/ //yield return null; //yield return null; time += Time.deltaTime; while (mSumScore < mScore) { if (mSumScore < 100) { speed = 100; } else if (mSumScore > 500) { speed = 5000; } else { speed = 2000; } mSumScore += Time.deltaTime * speed; if (mSumScore > mScore) { mSumScore = mScore; // DirectionalLight.SetActive(true); PointLight1.SetActive(true); PointLight2.SetActive(true); Cube.SetActive(true); } Score.text = ((int)mSumScore).ToString(); yield return(null); } //Score .text=mScore .ToString (); //分数数完了,停止金币声音,播放金币结束声音 audio.Stop(); //audio.PlayOneShot(AudioCoinEnd); //播放光线的声音 audio.PlayOneShot(AudioLight); }
/// <summary> /// Se llama una sola vez, al principio cuando se ejecuta el ejemplo. /// Escribir aquí todo el código de inicialización: cargar modelos, texturas, estructuras de optimización, todo /// procesamiento que podemos pre calcular para nuestro juego. /// Borrar el codigo ejemplo no utilizado. /// </summary> public override void Init() { FinishedLoading = false; crono = new Cronometro(tiempoJuego, this); //Device de DirectX para crear primitivas. var d3dDevice = D3DDevice.Instance.Device; GodModeOn = true; //cuando llamo a toggle lo pone en false sonidos = new Sonidos(MediaDir); CargarScenes(); ToggleGodCamera(); pointLuz = new PointLight2(this, new Vector3(100f, 100f, 100f)); pointLuz2 = new PointLight2(this, new Vector3(100f, 100f, 100f)); Vector3 posicion = new Vector3(800f, 20f, 250f); //Y=8 para q este cerca del piso float velocidad = dificultadJuego; float tiempEspera = 70f; float ang = 30f; autoOponente = new AutoOponente(this, AutoJugador, 0.1f * velocidad, ang, tiempEspera, posicion); }
void Start() { levelIndex = Application.loadedLevel; //Getting current level index for saving needs; //contadorDeColisoes = 0; rb = GetComponent <Rigidbody>(); playerPosition = GameObject.Find("Sphere").transform; //Acessa a variável integerToChange presente em MainCamera referenceScript = GameObject.FindWithTag("MainCamera").GetComponent <FollowingPlayer>(); referenceBool = GameObject.FindWithTag("MainCamera").GetComponent <FollowingPlayer>(); //Para acessar os scripts de controle anexados à esfera downReference = GameObject.Find("Sphere").GetComponent <DOWN_controller> (); upReference = GameObject.Find("Sphere").GetComponent <UP_controller> (); rightReference = GameObject.Find("Sphere").GetComponent <RIGHT_controller> (); leftReference = GameObject.Find("Sphere").GetComponent <LEFT_controller> (); pointLight1 = GameObject.Find("Point light").GetComponent <PointLight1> (); pointLight2 = GameObject.Find("Point light (1)").GetComponent <PointLight2> (); fiatLux1 = GameObject.FindWithTag("planetag").GetComponent <Fiat_Lux1> (); fiatLux2 = GameObject.FindWithTag("gem2").GetComponent <Fiat_Lux2> (); //lightningEmitter = GameObject.FindWithTag ("lightning_emitter"); lightningEmitter.SetActive(false); //show1Star.SetActive (false); //Mantem as estrelas apagadas até "timer=true" //show2Stars.SetActive (false); //show3Stars.SetActive (false); //Fade-in das estrelas / Seta cor transparente nos sprites //starColor = new Color (1, 1, 1, 0); //star1.color = starColor; //star2.color = starColor; //star3.color = starColor; source = GetComponent <AudioSource>(); }