Пример #1
0
 // Controls the rate of flashing for an enemy
 private void FlashUnitRegularily()
 {
     if (timeBetweenFlashes > 0.0f)
     {
         if (lastFlash <= 0.0f)
         {
             flashController.Flash();
             lastFlash = timeBetweenFlashes;
         }
         else
         {
             lastFlash -= Time.deltaTime;
         }
     }
 }
Пример #2
0
 private void FlashBoss()
 {
     if (lastFlashTime <= 0.0f)
     {
         myColorFlash.Flash();
         lastFlashTime = timeBetweenFlashes;
     }
     else
     {
         lastFlashTime -= Time.deltaTime;
     }
 }
Пример #3
0
    public void DamagePlayer(int damage)
    {
        if (isDead || invincibilityCounter > 0)
        {
            return;
        }

        health -= damage;
        invincibilityCounter = invincibilityTime;
        flashController.Flash();
        UpdateScore(-200);
        // play the sound for the player being hit

        guiManager.UpdateHealthDisplay(health, maxHealth);

        if (health <= 0)
        {
            KillPlayer();
        }
    }