private void Die()
 {
     state = PlayerHealthState.Dead;
     ManageDeathParticles();
     GetComponent <SpriteRenderer>().enabled = false;
     Time.timeScale = 0.1f;
     Invoke("LoadFirstLevel", 0.2f);
 }
Beispiel #2
0
    void Awake()
    {
        maxHP = 121;
        currentHP = maxHP;

        playerState = PlayerHealthState.Alive;

        playerMovement = GetComponent<Movement>();
        anim = GetComponent<Animator>();
    }
 // Use this for initialization
 void Start()
 {
     //reserting playerHealth in the ScriptableObject
     currentHealth.RuntimeValue = currentHealth.initialValue; // 6
     currentState       = PlayerState.walk;
     currentHealthState = PlayerHealthState.normal;
     animator           = GetComponent <Animator>();
     myRigidbody        = GetComponent <Rigidbody2D>();
     animator.SetFloat("moveX", 0);
     animator.SetFloat("moveY", -1);
     transform.position = startingPosition.initialValue;
 }
Beispiel #4
0
    void Death()
    {
        playerState = PlayerHealthState.Dead;

        isDead = true;
        SendMessage("ToggleInputCursor", true);
        print("deaded is " + isDead);

        HealthText.text = "YOU ARE DEAD";
        HealthText.color = Color.white;

        //anim.SetTrigger("Die");
        //playerAudio.clip = deathSound;
        //playerAudio.Play();

        //Movement.enabled = false;
    }
 private void Start()
 {
     state = PlayerHealthState.Alive;
     healthDisplay.SetHealth(healthPoints);
 }
Beispiel #6
0
 public void ResetHealth()
 {
     _healthbarSlider.value = 1.0f;
     _playerHealth          = PlayerHealthState.Alive;
 }
Beispiel #7
0
 // Always between 1 or 0 health
 public void DepleteHealth()
 {
     _playerHealth = PlayerHealthState.Dead;
 }