// Calculates the time bonus from difference between the mission time and the par time private void CalculateTimeBonus() { float difference = levelData.parTime.FGetTimeInSeconds() - missionTimer.CurrentTime; if (difference > 0) { iTimeBonus = Mathf.RoundToInt(difference * fTimeBonusScore); } else { iTimeBonus = 0; } missionScore.AddScore(iTimeBonus); }
public void OnTriggerEnter(Collider other) { //check if the Trigger Participant is the Player and if he has a PlayerCargo Component if (other.CompareTag("Player") && other.transform.parent.GetComponent <PlayerCargo>() is PlayerCargo cargo) { int cargoAmount = cargo.m_spaceOccupied; m_scoreUI.AddScore(cargoAmount * 10); //clear all cargo cargo.ClearCargo(); } }
private void OnClickVictory() { m_ScoreUI.AddScore(m_MovesUI.m_Value + m_ChronometerUI.RemainingTime); var nextLevel = m_Map.Level + 1; if (nextLevel > m_FinishLevel) { ScreenManager.Instance.LoadLevelLoading("Congratulations"); } else { PlayerPrefs.SetInt("level", nextLevel); ScreenManager.Instance.LoadLevelLoading("Gameplay"); } }
public void Damage(int v) { enemyGO.DoDamage(v); if (enemyGO.Health <= 0) { PlayExplosion(); Destroy(gameObject); if (!addedScore) { addedScore = true; scoreUI.AddScore(score); } } }
public void Release() { if (!button.ableToHit) { return; } float percentage; if (cough) { Debug.Log("Cough... cough"); //play cough audio coughSound.Play(); percentage = .8f; } else { percentage = (hitBar.transform.localPosition.x - hitBarStart.x) / perfectLength; } score = (int)(percentage * 420); ui.AddScore(score); Reset(); }