Ejemplo n.º 1
0
        public void RecieveDamage(float damage)
        {
            if (isShielding)
            {
                currentShieldHealth -= damage;
                if (currentShieldHealth <= 0)
                {
                    isShielding = false;
                    shieldObject.SetActive(false);
                    shieldTimer = 0;

                    currentShieldHealth = shieldHealth;
                }
            }

            else
            {
                currentHealth -= damage;
                SDP.Damage(maxHealth, currentHealth);
                if (currentHealth <= 0)
                {
                    isDestroyed = true;
                    FindObjectOfType <AudioManager>().Stop(AudioList.gameplayMusic);
                    FindObjectOfType <AudioManager>().Stop(AudioList.playerDestroyed);
                    playerController.ResetVelocity();
                    GM.StartGameOver();
                }
                else
                {
                    FindObjectOfType <AudioManager>().Play(AudioList.playerDamaged);
                }
            }
        }
Ejemplo n.º 2
0
 private void Update()
 {
     currentFuel -= Time.deltaTime * fuelCostPerSecond;
     SB.UpdateBatteryFill(fuelTank, currentFuel);
     if (currentFuel <= 0)
     {
         noFuel = true;
         GM.StartGameOver();
         FindObjectOfType <AudioManager>().Stop(AudioList.gameplayMusic);
     }
 }