Beispiel #1
0
 private void Die(Leukocyte killer)
 {
     _isAlife = false;
     killer.ChangeColor(color);
     _flockAgent.RemoveFromFlock();
     Destroy(gameObject);
 }
Beispiel #2
0
        private void ReceiveDamage(Leukocyte leukocyte)
        {
            int damage = leukocyte.CurrentColorName == color ? 3 : 1;

            _currentLifePoints -= damage;

            if (_currentLifePoints <= 0)
            {
                Die(leukocyte);
            }
        }
Beispiel #3
0
 void FixedUpdate()
 {
     Collider2D[] neighbors = Physics2D.OverlapCircleAll(transform.position, _circleCollider.radius);
     foreach (var neighbor in neighbors)
     {
         Leukocyte leukocyte = neighbor.GetComponent <Leukocyte>();
         if (!(leukocyte is null))
         {
             ReceiveDamage(leukocyte);
         }
     }
 }