void OnBreathEnded(object sender, ExhalationCompleteEventArgs e) { breathing = false; if (e.BreathQuality >= 4) { canJump = true; } powerBar.fillAmount = e.BreathQuality / 4f; HealthControl.deductLife(); if (HealthControl.lives == 0) { FizzyoFramework.Instance.Recogniser.BreathStarted -= OnBreathStarted; FizzyoFramework.Instance.Recogniser.BreathComplete -= OnBreathEnded; } }
// Update is called once per frame void Update() { // When egg drops - If drop below certain distance if (transform.position.y < (mCamera.position.y - 15f)) { if (HealthControl.lives != 0) { HealthControl.deductLife(); AchievementControl.consectJump = 0; if (HealthControl.lives > 0) { SoundControl.playReappearSound(); transform.position = new Vector3(OnCollision.lastCollidedPlatform.position.x, OnCollision.lastCollidedPlatform.position.y + 1.5f, OnCollision.lastCollidedPlatform.position.z); OnCollision.lastCollidedPlatform.gameObject.GetComponent <EdgeCollider2D>().enabled = true; transform.parent = OnCollision.lastCollidedPlatform.gameObject.transform; } } } }