private void OnShowGameChangeOut0(lib.Event e) { for (int i = 0, len = outBackground.transform.childCount; i < len; i++) { GameBufferPool.ReleaseGridBg(outBackground.transform.GetChild(0).gameObject); } for (int i = 0; i < pieces.length; i++) { if (pieces[i].isInStage == false) { pieces[i].Hide(); } } }
private void OnShowGameChangeOut(lib.Event e) { for (int i = 0; i < backgroundgrids.Count; i++) { GameBufferPool.ReleaseGridBg(backgroundgrids[i]); } changeOutRoot = new GameObject(); changeOutRoot.name = "GameChangeOut"; changeOutRoot.transform.parent = root.transform.parent; for (int i = 0; i < this.pieces.length; i++) { pieces[i].ShowChangeOut(); } root.SetActive(false); outTweens = new List <Tweener>(); float maxTime = 0; Tweener maxTween = null; foreach (Transform child in changeOutRoot.transform) { foreach (Transform child2 in child) { float time1 = UnityEngine.Random.Range(0.1f, 0.6f); float time2 = UnityEngine.Random.Range(0.0f, 0.3f); child2.GetComponent <SpriteRenderer>().DOColor(new Color(1, 1, 1, 0), time1).SetDelay(time2); Tweener tween = child2.DOMove(new Vector3(UnityEngine.Random.Range(-7.2f, -8.0f), UnityEngine.Random.Range(child2.position.y - 3f, child2.position.y + 3f)), time1).SetDelay(time2).SetEase(Ease.InSine); outTweens.Add(tween); tween.onComplete = OnShowGameChangeOutComplete; if (time1 + time2 > maxTime) { maxTime = time1 + time2; maxTween = tween; } } } }