void PerformanceFormula() { PlayerScript PS = FindObjectOfType <PlayerScript>(); ScoreManager SM = FindObjectOfType <ScoreManager>(); PlatformGenerator1 PF = FindObjectOfType <PlatformGenerator1>(); collectedcoins = SM.coin; if (PS.time <= 0) { if (scanCoin != 0 && collectedcoins != 0) { performanceinCoin = ((scanCoin) / (collectedcoins)) * 10; } if (scanpowerups != 0 && collectedPowerups != 0) { performanceinPowerups = ((scanpowerups) / (collectedPowerups)) * 10; } if (performanceinCoin >= 64 && performanceinPowerups >= 64) { PS._speed += 1f; PF.theObjectPools[7] = PF.ChangeObject[2]; PF.theObjectPools[8] = PF.ChangeObject[2]; } else if (performanceinCoin <= 34 && performanceinPowerups <= 34) { PS._speed -= .1f; PF.theObjectPools[7] = PF.ChangeObject[0]; PF.theObjectPools[8] = PF.ChangeObject[0]; } scanCoin = 0; scanpowerups = 0; collectedcoins = 0; collectedPowerups = 0; } }
//disable a function when die void Die() { PlayerScript player = GameObject.FindObjectOfType <PlayerScript>(); ScoreManager s = GameObject.FindObjectOfType <ScoreManager>(); PlatformGenerator1 plat = FindObjectOfType <PlatformGenerator1>(); GameManager GM = FindObjectOfType <GameManager>(); plat.enabled = false; player.isdead = true; s.isdead = true; GM.isdead = true; player._speed = 0; animator.SetBool("IsCrouching", false); animator.SetBool("IsJumping", false); animator.SetBool("IsDead", true); }