void Update() { if (PlayerStat.isFinished == false) { return; } PlayerStat.PlayerStats[Stats.Life] -= Time.deltaTime * lifeDecreasingFactor; if (PlayerStat.PlayerStats[Stats.Life] > PlayerStat.PlayerStats[Stats.InitLife]) { PlayerStat.PlayerStats[Stats.Life] = PlayerStat.PlayerStats[Stats.InitLife]; } if (PlayerStat.PlayerStats[Stats.Life] <= 0 && isDying == false) { isDying = true; triggerDeath = true; } if (triggerDeath) { PlayerStat.PlayerStats[Stats.Dead] = 1; DeathCounter.DeathNb += 1; triggerDeath = false; _audio.PlayMusic("Death"); FadingController.onFadingFinished += OPENDEATH; PlayerController.isfreeze = true; fading.triggerIFading(); } if (PlayerStat.PlayerStats[Stats.Life] <= PlayerStat.PlayerStats[Stats.InitLife] * porcentageDeath / 100 && JustOnce == false) { JustOnce = true; JustOnce2 = false; _audio.PlayMusic(SpeedMusic); } else if (PlayerStat.PlayerStats[Stats.Life] >= PlayerStat.PlayerStats[Stats.InitLife] * porcentageDeath / 100 && JustOnce2 == false) { JustOnce2 = true; JustOnce = false; _audio.PlayMusic(NormalMusic); } if (PlayerStat.PlayerStats[Stats.Dead] == 1 && Input.GetKeyDown(KeyCode.Space)) { RESETGAME(); } }
public void PLAY() { DeathCounter.DeathNb = 0; FadingController.onFadingFinished += SHOWSTORY; fading.triggerIFading(); }