Ejemplo n.º 1
0
 void Update()
 {
     gameManager.updateHealth(currentHealth);
     if (damage)
     {
         spriteRender.color = screenFadeColor;
     }
     else
     {
         spriteRender.color = Color.Lerp(spriteRender.color, Color.white, screenFadeSpeed * Time.deltaTime);
     }
     damage = false;
     if (isDead)
     {
         fader.FadeToDark();
         Physics2D.IgnoreLayerCollision(PLAYER_LAYER_MASK, ENEMY_LAYER_MASK, true);
         playerTransform.position = Vector2.Lerp(playerTransform.position,
                                                 new Vector2(playerTransform.position.x, playerTransform.position.y - 100f), 0.01f * Time.deltaTime);
         playerRdb2.isKinematic = true;
         if (!CameraUtility.IsRendererInFrustum(boxCollider, cam))
         {
             isDestroyed = true;
             Destroy(gameObject);
         }
     }
     if (!isDead)
     {
         if (temp1 != null && !level1Manager.goNextRound)
         {
             fader.FadeToClear();
         }
         if (temp2 != null && !level2Manager.goNextRound)
         {
             fader.FadeToClear();
         }
         if (temp3 != null && !level3Manager.goNextRound)
         {
             fader.FadeToClear();
         }
     }
 }