示例#1
0
    void Start()
    {
        rocketLauncher.enabled = photonView.IsMine;
        if (photonView.IsMine)
        {
            gameObject.layer = PLAYER_LAYER;
            HUD.Singleton.SetPlayer(this);
        }

        onHealthChanged.Invoke(currentHealth);
    }
示例#2
0
        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);
        }
    }
示例#4
0
    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);
    }
示例#5
0
 protected virtual void Start()
 {
     healthAmount = StartingHealthAmount;
     OnHealthChanged.Invoke((int)this.healthAmount);
 }
示例#6
0
 protected void HealDamage(float amountToHeal)
 {
     HealthSystemSystem.Heal(amountToHeal, stats.GetStat(Stat.Health));
     OnHealthChangedEvent?.Invoke(this, GetPercentageHealth());
 }