Ejemplo n.º 1
0
 private void Die()
 {
     this.currentHealth = this.maxHealth;
     //Destroy(gameObject);
     Debug.Log("Player dead. Reset health");
     UIEventHandler.HealthChanged(this.currentHealth, this.maxHealth);
 }
Ejemplo n.º 2
0
 private void Awake()
 {
     PlayerLevel    = GetComponent <PlayerLevel>();
     CurrentHealth  = MaxHealth;
     CharacterStats = new CharacterStats(10, 10, 10);
     UIEventHandler.HealthChanged(MaxHealth, CurrentHealth);
 }
Ejemplo n.º 3
0
    private void Die()
    {
        print("Player dead. Reset health.");

        this.currentHealth = this.maxHealth;

        UIEventHandler.HealthChanged(this.currentHealth, this.maxHealth);
    }
Ejemplo n.º 4
0
    private void Start()
    {
        this.currentHealth = this.maxHealth;

        characterStats = new CharacterStats(2, 5, 8);

        UIEventHandler.HealthChanged(this.currentHealth, this.maxHealth);
    }
Ejemplo n.º 5
0
 void Start()
 {
     PlayerLevel        = GetComponent <PlayerLevel>();
     this.currentHealth = this.maxHealth;
     characterStats     = new CharacterStats(10, 10, 10);
     UIEventHandler.HealthChanged(this.currentHealth, this.maxHealth);
     //UIEventHandler.PlayerLevelChanged(this.PlayerLevel.CurrentExperience, this.PlayerLevel.RequiredExperience);
 }
Ejemplo n.º 6
0
 public void TakeDamage(int amount)
 {
     currentHealth -= amount;
     if (currentHealth <= 0)
     {
         Die();
     }
     UIEventHandler.HealthChanged(this.currentHealth, this.maxHealth);
 }
Ejemplo n.º 7
0
    // ============================================================================================================================================
    // Health Bar Functionality
    // Source: https://www.youtube.com/watch?v=9W0xLonwbLo // CURRENTLY NOT USING THIS SCRIPT
    // ============================================================================================================================================
    // public void PlayerHealthBar()
    // {
    //      UIEventHandler.HealthChanged(currentHealth, maxHealth);
    // }

    public void TakeDamage(int amount)
    {
        Debug.Log("Player takes: " + amount + " damage");
        currentHealth -= amount;
        if (currentHealth <= 0)
        {
            Die();
        }
        UIEventHandler.HealthChanged(this.currentHealth, this.maxHealth); // Updates the UI from damage taken
    }
Ejemplo n.º 8
0
 public void OnTriggerStay(Collider collider)
 {
     if (collider.tag == "Player")
     {
         if (isDamaging)
         {
             player.currentHealth = (int)(player.currentHealth - (damage * Time.deltaTime));
         }
         UIEventHandler.HealthChanged(this.player.currentHealth, this.player.currentHealth);
     }
 }
Ejemplo n.º 9
0
 public void AddHealth(int amount)
 {
     if (CurrentHealth + amount > Stats.MaxHealth)
     {
         CurrentHealth = Stats.MaxHealth;
     }
     else
     {
         CurrentHealth += amount;
     }
     UIEventHandler.HealthChanged();
 }
Ejemplo n.º 10
0
    public void TakeDamage(int amount)
    {
        currentHealth -= amount;

        Debug.Log("Player took " + amount + " Damage");

        if (currentHealth <= 0)
        {
            Die();
        }

        UIEventHandler.HealthChanged(this.currentHealth, this.maxHealth);
    }
Ejemplo n.º 11
0
 public void TakeDamage(int amount)
 {
     CurrentHealth -= amount;
     if (CurrentHealth < 0)
     {
         CurrentHealth = 0;
     }
     if (CurrentHealth <= 0)
     {
         Die();
     }
     UIEventHandler.HealthChanged(MaxHealth, CurrentHealth);
 }
Ejemplo n.º 12
0
 public override void TakeDamage(Damage dmg)
 {
     if (OnTakeDamage != null)
     {
         dmg = OnTakeDamage(dmg);
     }
     if (dmg.DamageAmount > 0)
     {
         Stats.CurrentHealth -= dmg.DamageAmount;
         if (Stats.CurrentHealth <= 0)
         {
             Die();
         }
         StatusBar.Instance.HealthBarFlash();
         UIEventHandler.HealthChanged();
     }
     StartCoroutine(GotHitFlashing());
 }
Ejemplo n.º 13
0
 private void Die()
 {
     Debug.Log("Player Dead. Reset Health.");
     this.currentHealth = this.maxHealth;
     UIEventHandler.HealthChanged(this.currentHealth, this.maxHealth);
 }
Ejemplo n.º 14
0
 void Start()
 {
     UIEventHandler.HealthChanged(this.currentHealth, this.maxHealth);
 }
Ejemplo n.º 15
0
 public void HealFullHP()
 {
     Stats.CurrentHealth = Stats.MaxHealth;
     UIEventHandler.HealthChanged();
 }
Ejemplo n.º 16
0
 public void StatsUpdate()
 {
     Stats.UpdateStats(PlayerLevel.Level);
     UIEventHandler.HealthChanged();
     UIEventHandler.ManaChanged();
 }
Ejemplo n.º 17
0
 public override void Die()
 {
     Debug.Log("Player dead. reset health");
     Stats.CurrentHealth = Stats.MaxHealth;
     UIEventHandler.HealthChanged();
 }
Ejemplo n.º 18
0
 private void Die()
 {
     Debug.Log("Revived!");
     this.currentHealth = this.maxHealth;
     UIEventHandler.HealthChanged(this.currentHealth, this.maxHealth);
 }
Ejemplo n.º 19
0
 private void Die()
 {
     CurrentHealth = MaxHealth;
     UIEventHandler.HealthChanged(MaxHealth, CurrentHealth);
 }
Ejemplo n.º 20
0
 public void RegainHealth(int amount)
 {
     this.currentHealth = this.currentHealth + amount;
     UIEventHandler.HealthChanged(this.currentHealth, this.maxHealth);
 }