Ejemplo n.º 1
0
 public void OnShipReset(InputAction.CallbackContext context)
 {
     if (isDead)
     {
         return;
     }
     isDead = true;
     ShipHasDied?.Invoke(isDead);
     StartCoroutine(HandleRespawn(0.5f));
 }
Ejemplo n.º 2
0
    public void TakeDamage(float rawDamage)
    {
        health -= Mathf.RoundToInt(rawDamage * damageMultiplier);

        if (health <= 0)
        {
            health = 0;
            isDead = true;
            ShipHasDied?.Invoke(isDead);
            StartCoroutine(HandleRespawn(respawnTime));
        }

        ShipHealthUpdated?.Invoke(health);
    }