Esempio n. 1
0
 private void Update()
 {
     if (mover.speed == 0 && ballData.type != -1)    //Only still balls, and not center
     {
         Collider2D[] chainColliders = Physics2D.OverlapCircleAll(new Vector2(transform.position.x, transform.position.y), 1.1f);
         foreach (Collider2D collision in chainColliders)
         {
             GameObject colObject = collision.gameObject;
             if (colObject == gameObject)
             {
                 break;                          //Don't collide with yourself
             }
             BallData colData = colObject.GetComponent <BallData>();
             if (colData != null)
             {
                 if (colData.type == ballData.type)
                 {
                     if (colData.type == ballData.type)
                     {
                         ballData.MergeChain(colData.chain);
                     }
                 }
             }
         }
     }
 }