/// <summary> /// Method to shoot the first dot and moving the other. This method check if the list of dots to shoot is empty or not. If the list is empty, this method triggered the success for this level. /// </summary> void ShootDot(DotManager d) { playerCanShoot = false; StopCoroutine("PositioningDots"); StopCoroutine("MoveStartPositionDot"); d.GetComponent <Collider2D>().enabled = true; soundManager.PlaySoundBeep(); Dots.Remove(d); PositioningDotsToShoot(); d.GetComponent <Collider2D>().enabled = true; d.transform.position = new Vector3(0, -positionTouchBorder + (-0 - 2) * sizeDot, 0); d.transform.DOKill(); d.transform.DOMoveY(-positionTouchBorder, 0.1f).SetEase(Ease.Linear) .OnUpdate(() => { playerCanShoot = false; if (isGameOver) { DOTween.Kill(d.transform); } }) .OnComplete(() => { d.ActivateLine(); d.transform.parent = CircleBorder; playerCanShoot = true; if (Dots.Count == 0 && !isGameOver) { isSuccess = true; } if (isSuccess && !isGameOver) { AnimationCameraSuccess(); } PositioningDotsToShoot(); }); #if VS_SHARE VSSHARE.DOHideScreenshotIcon(); #endif }
/// <summary> /// Create the dots on the circle and activate the line to link the dots to the circle /// </summary> void CreateDotOnCircle() { for (int i = 0; i < LEVEL.numberDotsOnCircle; i++) { CircleBorder.rotation = Quaternion.Euler(new Vector3(0, 0, ((float)i) * 360f / LEVEL.numberDotsOnCircle)); Transform t = SpawnDotPrefab().transform; t.position = new Vector3(0, -positionTouchBorder, 0); t.parent = CircleBorder; t.rotation = Quaternion.identity; t.gameObject.SetActive(true); DotManager dm = t.GetComponent <DotManager> (); t.GetComponent <Collider2D>().enabled = true; dm.ActivateLine(); dm.ActivateNum(false); } }
/// <summary> /// Create the dots on the circle and activate the line to link the dots to the circle /// </summary> void CreateListDots() { for (int i = 0; i < LEVEL.numberDotsToCreate; i++) { DotManager dm = SpawnDotPrefab().GetComponent <DotManager> (); dm.SetNum(i + 1); dm.ActivateNum(true); dm.GetComponent <Collider2D>().enabled = false; dm.transform.parent = CircleTransform; if (sizeDot == 0) { sizeDot = dm.DotSprite.bounds.size.x * 1.1f; } Dots.Add(dm); } }