Advertisement
SizilStank

Untitled

Oct 10th, 2022
846
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | Gaming | 0 0
  1. if (collision.CompareTag("EnemyA") || collision.CompareTag("EnemyLaser"))
  2.         {    
  3.             if (_isShieldActive == false)
  4.             {
  5.                 Damage();
  6.             }
  7.  
  8.             if (_isShieldActive == true)
  9.             {
  10.                 _countTimesHit.Add(_intToAdd++);
  11.  
  12.  
  13.                 if (_isShieldActive == true && _countTimesHit.Count == 1)
  14.                 {
  15.                     _shieldSpriteRenderer.color = Color.red;
  16.                 }
  17.                 else if (_isShieldActive == true && _countTimesHit.Count == 2)
  18.                 {
  19.                     _shieldSpriteRenderer.color = Color.black;
  20.                 }
  21.                 else
  22.                 {
  23.                     _shieldSpriteRenderer.color = Color.white;
  24.                     _isShieldActive = false;
  25.                     _shieldPrefab.SetActive(false);
  26.                     _countTimesHit.Clear();
  27.                     _audioSource.Stop(); _audioSource.loop = false;
  28.                     _audioSource.clip = _shieldOnPlayerActive;
  29.                     _audioSource.PlayOneShot(_shieldIsOver, 3);
  30.                    // return;
  31.                 }
  32.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement