Пример #1
0
	// TODO: Rewrite this 'cause this animation looks pretty gross.
	IEnumerator CoLerpBPM(HeartRateTracker hrt, int newBPM)
	{
		int oldBPM = System.Int32.Parse(heartRateIndicator.text);


		if(oldBPM < newBPM)
		{
			// Find out how big a hit it was.
			int iterations = (newBPM - oldBPM) / 4;


			// Enlarge the text proportionally by the strength of the hit.
			heartRateIndicator.fontSize = startingFontSize + iterations;


			for(int i = 1; i <= iterations; i ++)
			{
				// Drop the size by a bit.
				heartRateIndicator.fontSize--;


				// Reset the count.
				heartRateIndicator.text = (oldBPM + i).ToString();


				// Reset the color.
				UpdateColor(hrt, oldBPM + i);


				yield return new WaitForSeconds(Time.fixedDeltaTime);
			}
		}


		UpdateColor(hrt, newBPM);
		heartRateIndicator.fontSize = startingFontSize;
		heartRateIndicator.text = newBPM.ToString();


		yield return null;
	}
Пример #2
0
	void HandlePlayerDeath(HeartRateTracker hrt, int finalHeartRate)
	{
		// TODO: HOOK UP PLAYER HEALTH
	}
Пример #3
0
	void UpdateColor(HeartRateTracker hrt, int newBPM)
	{
		float closenessToDead = (float)(newBPM - hrt.startingHeartRate) / (hrt.lethalHeartRate - hrt.startingHeartRate);
		heartRateIndicator.color = Color.Lerp(healthyColor, deadColor, closenessToDead);
	}
Пример #4
0
	void UpdateHeartRate(HeartRateTracker hrt, int newBPM)
	{
		StopAllCoroutines();
		StartCoroutine(CoLerpBPM(hrt, newBPM));
	}
Пример #5
0
	void Awake()
	{
		heartRateTracker = gameController.heartRateTracker;
		startingFontSize = heartRateIndicator.fontSize;
	}