private IEnumerator ShootBubble(BubbleAimTarget aimTarget, BubbleAmmoView ammoView) { if (aimTarget.Bounces()) { yield return(StartCoroutine(MoveTo(aimTarget.BouncePosition(), ammoView))); } yield return(StartCoroutine(MoveTo(aimTarget.BubbleSlotView().transform.position, ammoView))); OnBubbleAdded(aimTarget.BubbleSlotView(), ammoView.BubbleConfig()); yield return(null); Destroy(ammoView.gameObject); }
void Update() { if (_bubbleBoard.IsLevelCompleted() || _waitForBubbleToArrive) { return; } if (IsAiming()) { aimLineRenderer.positionCount = 3; _aimTarget = null; HandleAim(); } else if (FinishedAiming()) { if (_aimTarget != null) { _aimTarget.BubbleSlotView().Reserve(); OnBubbleShot(); _bubbleShoot.Shoot(_aimTarget); _aimTarget = null; _waitForBubbleToArrive = true; } OnNoBubbleSlotPreviewActivated(); } else { aimLineRenderer.positionCount = 1; OnNoBubbleSlotPreviewActivated(); } }