Example #1
0
	public IEnumerator Intro (Gate gateSpawn) 
	{
		// Start

		fx = GameObject.FindObjectOfType<FX>();
		voice = GameObject.FindObjectOfType<Voice>();

		voice.Cough();
		yield return new WaitForSeconds(1f);
		
		fx.Match();
		yield return new WaitForSeconds(3f);

		// Update

		float timeElapsed = 0f;
		float timeRatio = 0f;
		float duration = 2f;
		while (timeElapsed < duration) {
			timeRatio = timeElapsed / duration;
			materialTitle.SetFloat("_Alpha", timeRatio);
			timeElapsed += Time.deltaTime;
			yield return 0;
		}

		yield return new WaitForSeconds(1f);

		timeElapsed = 0f;

		while (timeElapsed < duration) {
			timeRatio = timeElapsed / duration;
			materialTitle.SetFloat("_Alpha", 1f - timeRatio);
			timeElapsed += Time.deltaTime;
			yield return 0;
		}

		fx.BookFall();

		yield return new WaitForSeconds(1f);

		StartCoroutine(Goto(gateSpawn));

		player.started = true;
	}