// Start is called before the first frame update void Start() { UIFightBattleField.ShowElimitInfo(); }
public IEnumerator AnimEnd(UIFightBall ballA, UIFightBall ballB) { yield return(new WaitForSeconds(_ExchangeBallTime + 0.1f)); //iTween.Stop(); BallBox.Instance.MoveBall(ballA.BallInfo, ballB.BallInfo); //ballA.Exchange(ballB); ballA.ResetRoot(); ballB.ResetRoot(); ballA.ShowBall(); ballB.ShowBall(); var moveList = new List <BallInfo>() { ballA.BallInfo, ballB.BallInfo }; var elimitBalls = BallBox.Instance.CheckNormalEliminate(moveList); var spElimitMove = BallBox.Instance.CheckSpMove(moveList); var spElimitElimit = BallBox.Instance.CheckSpElimit(elimitBalls); var exploreBalls = BallBox.Instance.CurrentElimitnate(); var afterElimit = BallBox.Instance.AfterElimitnate(); BallBox.AddBallInfos(elimitBalls, spElimitMove); BallBox.AddBallInfos(elimitBalls, spElimitElimit); BallBox.AddBallInfos(elimitBalls, exploreBalls); BallBox.AddBallInfos(elimitBalls, afterElimit); if (elimitBalls.Count == 0) { iTween.MoveTo(ballA._FightBallAnchor.gameObject, ballB.transform.position, _ExchangeBallTime); iTween.MoveTo(ballB._FightBallAnchor.gameObject, ballA.transform.position, _ExchangeBallTime); yield return(new WaitForSeconds(_ExchangeBallTime + 0.1f)); BallBox.Instance.MoveBack(ballA.BallInfo, ballB.BallInfo); //ballA.Exchange(ballB); ballA.ResetRoot(); ballB.ResetRoot(); ballA.ShowBall(); ballB.ShowBall(); EndAnim(); yield break; } else { do { float elimitAnimTime = 0; AudioClip elimitSound = _ElimitAudio; FIGHT_SOUND_TYPE soundLevel = FIGHT_SOUND_TYPE.ELIMIT; foreach (var elimitBall in elimitBalls) { bool isContentBomb = false; if (!elimitBall._IsBoomSP) { foreach (var optBombInfo in BallBox.Instance._CurrentOptExtra) { if (optBombInfo._OptBall == elimitBall) { isContentBomb = true; break; } foreach (var bombElimitBall in optBombInfo._ElimitBalls) { if (bombElimitBall == elimitBall) { isContentBomb = true; break; } } if (isContentBomb) { break; } } } var uiBall = GetBallUI(elimitBall); if (uiBall.IsSPBallBomb()) { elimitSound = _BombAudio; soundLevel = FIGHT_SOUND_TYPE.BOMB; } else if (soundLevel < FIGHT_SOUND_TYPE.LINE && uiBall.IsSPBallLine()) { elimitSound = _LineAudio; soundLevel = FIGHT_SOUND_TYPE.LINE; } else if (soundLevel < FIGHT_SOUND_TYPE.COMBINE && BallBox.Instance._CurrentOptExtra.Count > 0) { elimitSound = _CombineAudio; soundLevel = FIGHT_SOUND_TYPE.COMBINE; } if (isContentBomb) { continue; } var elimitT = uiBall.Elimit(); if (elimitT > elimitAnimTime) { elimitAnimTime = elimitT; } } PlayerUISound(elimitSound, 1); StartCoroutine(BombCreateAnim()); yield return(new WaitForSeconds(elimitAnimTime + _ElimitBallTime)); BallBox.Instance.ClearElimitInfo(); foreach (var elimitBall in elimitBalls) { var uiBall = GetBallUI(elimitBall); uiBall.ShowBall(); } yield return(new WaitForSeconds(_ElimitBallTime)); UIFightBattleField.ShowElimitInfo(); var fillingTime = Filling(); yield return(new WaitForSeconds(fillingTime)); List <BallInfo> checkBalls = new List <BallInfo>(); BallBox.AddBallInfos(checkBalls, _FillingBalls); BallBox.AddBallInfos(checkBalls, exploreBalls); elimitBalls = BallBox.Instance.CheckNormalEliminate(); //elimitBalls = BallBox.Instance.CheckNormalEliminate(); var spSubElimitBalls = BallBox.Instance.CheckSpElimit(elimitBalls); exploreBalls = BallBox.Instance.CurrentElimitnate(); var subafterElimit = BallBox.Instance.AfterElimitnate(); BallBox.AddBallInfos(elimitBalls, spSubElimitBalls); BallBox.AddBallInfos(elimitBalls, exploreBalls); BallBox.AddBallInfos(elimitBalls, subafterElimit); }while (elimitBalls.Count > 0); } var reShowList = BallBox.Instance.RoundEnd(); if (reShowList != null && reShowList.Count > 0) { foreach (var elimitBall in reShowList) { var uiBall = GetBallUI(elimitBall); uiBall.ShowBall(); } } var eliminate = BallBox.Instance.FindPowerEliminate(); if (eliminate == null) { Debug.Log("No eliminate!!!"); yield return(new WaitForSeconds(1)); int refreshTimes = 0; while (eliminate == null) { if (refreshTimes < 2) { RefreshNormal(); } else { BallBox.Instance.RefreshNormalForElimit(false); UpdateBalls(); } ++refreshTimes; eliminate = BallBox.Instance.FindPowerEliminate(); } } //ShowElimit(); EndAnim(); }
public void TestBallMove() { var eliminate = BallBox.Instance.FindPowerEliminate(); if (eliminate == null) { while (eliminate == null) { RefreshNormal(); eliminate = BallBox.Instance.FindPowerEliminate(); } } var ballA = GetBallUI(eliminate.FromBall); var ballB = GetBallUI(eliminate.ToBall); BallBox.Instance.MoveBall(ballA.BallInfo, ballB.BallInfo); ballA.ShowBall(); ballB.ShowBall(); var moveList = new List <BallInfo>() { ballA.BallInfo, ballB.BallInfo }; var elimitBalls = BallBox.Instance.CheckNormalEliminate(moveList); var spElimitMove = BallBox.Instance.CheckSpMove(moveList); var spElimitElimit = BallBox.Instance.CheckSpElimit(elimitBalls); var exploreBalls = BallBox.Instance.CurrentElimitnate(); var afterElimit = BallBox.Instance.AfterElimitnate(); BallBox.AddBallInfos(elimitBalls, spElimitMove); BallBox.AddBallInfos(elimitBalls, spElimitElimit); BallBox.AddBallInfos(elimitBalls, exploreBalls); BallBox.AddBallInfos(elimitBalls, afterElimit); { do { BallBox.Instance.ClearElimitInfo(); foreach (var elimitBall in elimitBalls) { var uiBall = GetBallUI(elimitBall); uiBall.ShowBall(); } UIFightBattleField.ShowElimitInfo(); var fallExchanges = BallBox.Instance.ElimitnateFall(); for (int i = 0; i < fallExchanges.Count; ++i) { var uiBall1 = GetBallUI(fallExchanges[i].FromBall); if (uiBall1 != null) { uiBall1.ShowBall(); } var uiBall2 = GetBallUI(fallExchanges[i].ToBall); uiBall2.ShowBall(); _FillingBalls.Add(uiBall2.BallInfo); } elimitBalls = BallBox.Instance.CheckNormalEliminate(_FillingBalls); var spSubElimitBalls = BallBox.Instance.CheckSpElimit(elimitBalls); var subexploreBalls = BallBox.Instance.CurrentElimitnate(); var subafterElimit = BallBox.Instance.AfterElimitnate(); BallBox.AddBallInfos(elimitBalls, spSubElimitBalls); BallBox.AddBallInfos(elimitBalls, subexploreBalls); BallBox.AddBallInfos(elimitBalls, subafterElimit); }while (elimitBalls.Count > 0); } if (BallBox.Instance.CheckElimitSimple()) { _TestMode = false; return; } var reShowList = BallBox.Instance.RoundEnd(); if (reShowList != null && reShowList.Count > 0) { foreach (var elimitBall in reShowList) { var uiBall = GetBallUI(elimitBall); uiBall.ShowBall(); } } eliminate = BallBox.Instance.FindPowerEliminate(); if (eliminate == null) { int refreshTimes = 0; while (eliminate == null) { if (refreshTimes < 2) { RefreshNormal(); } else { BallBox.Instance.RefreshNormalForElimit(true); UpdateBalls(); } ++refreshTimes; eliminate = BallBox.Instance.FindPowerEliminate(); } } _LastMoveTime = Time.time; }