public void Damage(float damage) { //subtract damage from health CurrentHealth = Mathf.Min(CurrentHealth - damage, MaxHealth); //Post processing effects on hit LeftEyePPE.DoDamage(); //Vibrations in controllers LeftHand.GetComponent <MotionController>().Hit(); RightHand.GetComponent <MotionController>().Hit(); if (lightManager != null) { lightManager.ChangeToHitColour(); } //Player death if (CurrentHealth <= 0.0f) { //Clear screen LeftEyePPE.ClearBlood(); LeftHand.GetComponent <MotionController>().StopVibration(); RightHand.GetComponent <MotionController>().StopVibration(); gameStateScript.KillPlayer(); Destroy(this); } }
public void Pause() { paused = true; LeftEyePPE.ClearBlood(); //RightEyePPE.ClearBlood(); timeScaleSaved = Time.timeScale; savedState = GetComponent <gameState>().playerState; GetComponent <gameState>().playerState = gameState.GameStates.Paused; for (int i = 0; i < DisableOnPause.Count; i++) { DisableOnPause[i].SetActive(false); } PauseMenu.SetActive(true); Time.timeScale = 0; }