Пример #1
0
 void FallBubble(Vector2Int position)
 {
     if (IsInsideBoard(position) && _bubblesGrid[position.x, position.y] != null)
     {
         score.AddToScore(GetBubbleAtPosition(position)._exponent);
         BubbleBehaviour fallingBubble = pool.CreateFallingBubble(GetBubbleAtPosition(position).transform.position);
         fallingBubble.CopyValuesFromBubble(GetBubbleAtPosition(position));
         fallingBubble.GetComponent <Rigidbody2D>().AddForce(Random.insideUnitCircle, ForceMode2D.Impulse);
         DestroyBubble(position, true);
     }
 }
Пример #2
0
 void VisualMergeBubble(Vector2Int original, Vector2Int objective)
 {
     if (IsInsideBoard(original) && IsInsideBoard(objective) && _bubblesGrid[original.x, original.y] != null && _bubblesGrid[objective.x, objective.y] != null)
     {
         BubbleBehaviour movingBubble = pool.CreateMovingBubble(GetBubbleAtPosition(original).transform.position);
         movingBubble.CopyValuesFromBubble(GetBubbleAtPosition(original));
         _movingBubbles.Add(new MovingBubble(
                                movingBubble,
                                GetBubbleAtPosition(original).transform.position,
                                GetBubbleAtPosition(objective).transform.position,
                                0
                                ));
     }
 }