void Start() { rocketLauncher.enabled = photonView.IsMine; if (photonView.IsMine) { gameObject.layer = PLAYER_LAYER; HUD.Singleton.SetPlayer(this); } onHealthChanged.Invoke(currentHealth); }
public void TakeDamage(float damage) { HealthSystemSystem.TakeDamage(damage); OnHealthChangedEvent?.Invoke(this, GetPercentageHealth()); if (HealthSystemSystem.HealthPoints == 0 && IsAlive) { TriggerDeath(); } }
public void TakeDamage(float damage) { if (damage < 0f) { return; //Can't to negative damage } currentHealth -= damage; onHealthChanged.Invoke(currentHealth, maxHealth); if (currentHealth <= 0.0f) { GameManager.ScoreSystem.AddScore(pointsValue); onDeath.Invoke(); Destroy(healthBar.gameObject); Destroy(gameObject); } }
public void TakeDamage(int damage) { //If invincible or dead, don't take damage if (isInvincible || currentHealth <= 0) { return; } currentHealth -= damage; if (currentHealth <= 0) { enabled = false; onDeath.Invoke(); } StartCoroutine(InvincibilityFrame()); onHealthChanged.Invoke(currentHealth); }
protected virtual void Start() { healthAmount = StartingHealthAmount; OnHealthChanged.Invoke((int)this.healthAmount); }
protected void HealDamage(float amountToHeal) { HealthSystemSystem.Heal(amountToHeal, stats.GetStat(Stat.Health)); OnHealthChangedEvent?.Invoke(this, GetPercentageHealth()); }