public void ActivationThresholdCheck() { if (PowerMeterIcon_DinoFeast.IsInSweetSpot() == PowerMeterPosition.InSweetSpot) { enteredSweetSpot = true; currentTimeInSweetSpot += Time.deltaTime; if (currentTimeInSweetSpot >= neededTimeInSweetSpot) { OnJump(); } } else { if (true == enteredSweetSpot) { OnJump(); } } }
public void OnJump() { Vector3 jumpVelocity; #region No isolation Bar if (isolationBar == null) // If the game does not have an Isolation bar (Lvl 1 or 2) { switch (PowerMeterIcon_DinoFeast.IsInSweetSpot()) { case PowerMeterPosition.InSweetSpot: { jumpVelocity = GetNeededHamVelocity(); break; } case PowerMeterPosition.AboveSweetSpot: { jumpVelocity = GetNeededHamVelocity() * 1.5f; break; } case PowerMeterPosition.BelowSweetSpot: default: { jumpVelocity = GetNeededHamVelocity() * 0.75f; break; } } } #endregion else { switch (PowerMeterIcon_DinoFeast.IsInSweetSpot()) { case PowerMeterPosition.InSweetSpot: { jumpVelocity = GetNeededHamVelocity(); break; } case PowerMeterPosition.AboveSweetSpot: { if (levelManager.isLevelEndless) { levelFourManager.LoseLife(); } jumpVelocity = GetNeededHamVelocity() * 1.5f; break; } case PowerMeterPosition.BelowSweetSpot: default: { if (levelManager.isLevelEndless) { levelFourManager.LoseLife(); } jumpVelocity = GetNeededHamVelocity() * 0.75f; break; } } //Threshold Failed but Power Checked = FAIL if (IsolationCheck() == false && PowerMeterIcon_DinoFeast.IsInSweetSpot() == PowerMeterPosition.InSweetSpot) { if (levelManager.isLevelEndless) { levelFourManager.LoseLife(); } jumpVelocity = GetNeededHamVelocity() * 0.75f; } } //Dont think this is needed. //else //{ // if (levelManager.isLevelEndless) // levelFourManager.LoseLife(); // jumpVelocity = GetNeededHamVelocity() * 0.75f; //} JumpForceCallback.Invoke(jumpVelocity.y); enteredSweetSpot = false; currentPower = 0.0f; currentIsolation = 0.0f; currentTimeInIsolation = 0; currentTimeInSweetSpot = 0.0f; PowerMeterCallback.Invoke(currentPower); isolationReady = false; onGround = false; }