예제 #1
0
 private void CheckCollision( )
 {
     for (int i = 0; i < bullets.Count; i++)
     {
         float   collDist   = (bullets[i].size + bc.size) / 2;
         Vector2 collVector = TransformToV2(bullets[i].myTransform.position) - TransformToV2(bc.myTransform.position);
         Debug.Log(collVector.magnitude + ", " + collDist);
         if (collDist >= collVector.magnitude)
         {
             Bullet b = bullets[i];
             bullets.Remove(b);
             bc.IncreaseSize(GetActualIncrease(bc.size, b.size));
             bc.AddSpeed(b.velocity.magnitude / 10f);
             Destroy(b.gameObject);
         }
     }
 }