protected override void Start() { Pools.DisableStandardBalls(); List <LevelData.BallData> lp = LevelDataIndex.CurrentLevel.ballDatas; Transform ooRoot = GameObject.Find("8Ball/OtherObjects").transform; for (int i = 0, count = lp.Count; i < count; i++) { LevelData.BallData d = lp[i]; GameObject o = Resources.Load(d.Type.ToString()) as GameObject; GameObject oo = Instantiate(o) as GameObject; oo.transform.SetParent(ooRoot); d.Position.y = 0; oo.transform.position = d.Position; PoolBall pb = oo.GetComponent <PoolBall>(); pb.SetBallID(d.ID); pb.ballType = d.Type; if (pb.ballType != BallType.JIANGYOU && pb.ballType != BallType.DEMON) { m_TargetBalls.Add(d.ID); } Pools.CustomBalls.Add(pb.GetBallID(), pb); } Pools.CueBall.transform.position = LevelDataIndex.CurrentLevel.cueBallData.Position; PocketTrigger.MarkPocketType(LevelDataIndex.CurrentLevel.StartPunishmentPocket, LevelDataIndex.CurrentLevel.StartRewardPocket); PocketTrigger.Block(LevelDataIndex.CurrentLevel.BlockPockets); m_Player.ShotsRemain = LevelDataIndex.CurrentLevel.shotCount; TurnBegin(); TextDialog.Show(LevelDataIndex.CurrentLevel.DescriptionID); }
protected void OnSingularityBreakBall(PoolBall ball) { if (ball) { Destroy(ball.gameObject); m_TargetBalls.Remove(ball.GetBallID()); } }
public override void PotBall(PoolBall ball, PocketIndexes pocket) { base.PotBall(ball, pocket); if(ball.ballType != BallType.WHITE) { m_Player.AddBall(ball.GetBallID()); m_Player.AddScore(ConstantData.QuickFireBallPottedPoint); m_Time += 10; m_Player.PlayTime += 10; } }
public override void PotBall(PoolBall ball, PocketIndexes pocket) { base.PotBall(ball, pocket); if (ball.ballType != BallType.WHITE) { m_Player.AddBall(ball.GetBallID()); m_Player.AddScore(ConstantData.QuickFireBallPottedPoint); m_Time += 10; m_Player.PlayTime += 10; } }
protected virtual IEnumerator CheckResultAndChangeTurn(float time) { yield return(new WaitForSeconds(time)); for (int i = 0, count = m_PottedBallListThisRound.Count; i < count; i++) { PoolBall pb = m_PottedBallListThisRound[i]; m_PottedBallList.Add(pb.GetBallID(), pb); } m_PottedBallListThisRound.Clear(); TurnBegin(); }
protected override IEnumerator CheckResultAndChangeTurn(float time) { yield return(new WaitForSeconds(time)); if (m_PottedBallListThisRound.Count == 0) { m_Player.Combo = 0; } if (m_WhiteBallPotted) { m_Player.Score -= m_ScoreThisRound; BaseUIController.text.Show(string.Format(HOLocalizationConfiguration.GetValue(106), m_ScoreThisRound)); yield return(new WaitForSeconds(ConstantData.MissionFoulTimeWait)); for (int i = 0, count = m_PottedBallListThisRound.Count; i < count; i++) { m_PottedBallListThisRound[i].BackToPrevRoundState(); } } else { for (int i = 0, count = m_PottedBallListThisRound.Count; i < count; i++) { PoolBall pb = m_PottedBallListThisRound[i]; m_PottedBallList.Add(pb.GetBallID(), pb); } } m_PottedBallListThisRound.Clear(); if (CheckGameOver()) { State = GlobalState.GAMEOVER; if (onGameOver != null) { if (m_TargetBalls.Count == 0) { onGameOver(m_Player); } else if (m_Player.ShotsRemain == 0) { onGameOver(null); } } } else { TurnBegin(); } }
protected override IEnumerator CheckResultAndChangeTurn(float time) { yield return(new WaitForSeconds(time)); if (m_WhiteBallPotted) { m_Time -= 30; } if (m_PottedBallListThisRound.Count == 0 && !m_WhiteBallPotted) { m_Player.ComboBreak(); } for (int i = 0, count = m_PottedBallListThisRound.Count; i < count; i++) { PoolBall pb = m_PottedBallListThisRound[i]; m_PottedBallList.Add(pb.GetBallID(), pb); } m_PottedBallListThisRound.Clear(); TurnBegin(); }
protected override IEnumerator CheckResultAndChangeTurn(float time) { yield return(new WaitForSeconds(time)); if (CheckGameOver()) // the game is over { GameManager.Rules.State = GlobalState.GAMEOVER; if (onGameOver != null) { onGameOver(CurrentPlayer); } BaseUIController.MSettlement.StandardGameOver(CurrentPlayer); } else //not yet { m_HandleWhiteball = HandleFouls(); if (m_HandleWhiteball || !AnyBallWithTypeEnterPocket(CurrentPlayer.TargetBallType)) { CurrentPlayer.combo = 0; //change player(if there is more than 2 players in the game) CurrentPlayer.End(); m_CurPlayerIndex = MathTools.Roll(0, m_Players.Length, m_CurPlayerIndex + 1); } for (int i = 0, count = m_PottedBallListThisRound.Count; i < count; i++) { PoolBall pb = m_PottedBallListThisRound[i]; m_PottedBallList.Add(pb.GetBallID(), pb); } m_PottedBallListThisRound.Clear(); TurnBegin(); } }
public override void PotBall(PoolBall ball, PocketIndexes pocket) { base.PotBall(ball, pocket); if ((pocket & PocketTrigger.PunitivePocket) != 0) { //m_PunishmentCountThisRound++; m_Player.AddCues(ConstantData.PunitiveShots, PocketTrigger.GetPocketWithIndexes(pocket)); } if ((pocket & PocketTrigger.RewardPocket) != 0) { //m_RewardCountThisRound++; m_Player.AddCues(ConstantData.RewardShots, PocketTrigger.GetPocketWithIndexes(pocket)); } int score = 0; if (ball.ballType == BallType.WHITE) { m_Player.Combo = 0; m_Player.AddCues(ConstantData.MissionCueballPottedPunishment, PocketTrigger.GetPocketWithIndexes(pocket)); return; } else if (ball.ballType == BallType.BOMB) { score = ConstantData.MissionBombPottedPoint; } else if (ball.ballType == BallType.SINGULARITY) { score = ConstantData.MissionSingularityPottedPoint; } else if (ball.ballType == BallType.ABSORB) { score = ConstantData.MissionAbsorbPottedPoint; AbsorbBall b = (AbsorbBall)ball; for (int i = 0, count = b.AbsorbList.Count; i < count; i++) { PotBall(b.AbsorbList[i], pocket); Pools.StorageRack.Add(b.AbsorbList[i]); } b.AbsorbList.Clear(); } else if (ball.ballType == BallType.REDCUSTOM) { score = ConstantData.MissionRedBallPoint; } else if (ball.ballType == BallType.BLUECUSTOM) { score = ConstantData.MissionBlueBallPoint; } else if (ball.ballType == BallType.YELLOWCUSTOM) { score = ConstantData.MissionYellowBallPoint; } else if (ball.ballType == BallType.JIANGYOU) { score = ConstantData.MissionJiangYouBallPoint; } else if (ball.ballType == BallType.DEMON) { score = ConstantData.MissionDemonBallPoint; } if (score > 0) { m_Player.Combo++; m_Player.AddScore(score, PocketTrigger.GetPocketWithIndexes(pocket)); m_ScoreThisRound = score; } if (m_Player.Combo >= 5) { BaseUIController.GenerateTips("Great!"); } m_Player.Pot(); if (m_TargetBalls.Contains(ball.GetBallID())) { m_TargetBalls.Remove(ball.GetBallID()); } }
public override void PotBall(PoolBall ball, PocketIndexes pocket) { base.PotBall(ball, pocket); if ((pocket & PocketTrigger.PunitivePocket) != 0) { //m_PunishmentCountThisRound++; m_Player.AddCues(ConstantData.PunitiveShots, PocketTrigger.GetPocketWithIndexes(pocket)); } if ((pocket & PocketTrigger.RewardPocket) != 0) { //m_RewardCountThisRound++; m_Player.AddCues(ConstantData.RewardShots, PocketTrigger.GetPocketWithIndexes(pocket)); } int score = 0; if (ball.ballType == BallType.WHITE) { m_Player.Combo = 0; m_Player.AddCues(ConstantData.MissionCueballPottedPunishment, PocketTrigger.GetPocketWithIndexes(pocket)); return; } else if (ball.ballType == BallType.BOMB) score = ConstantData.MissionBombPottedPoint; else if (ball.ballType == BallType.SINGULARITY) score = ConstantData.MissionSingularityPottedPoint; else if (ball.ballType == BallType.ABSORB) { score = ConstantData.MissionAbsorbPottedPoint; AbsorbBall b = (AbsorbBall)ball; for (int i = 0, count = b.AbsorbList.Count; i < count; i++) { PotBall(b.AbsorbList[i], pocket); Pools.StorageRack.Add(b.AbsorbList[i]); } b.AbsorbList.Clear(); } else if (ball.ballType == BallType.REDCUSTOM) score = ConstantData.MissionRedBallPoint; else if (ball.ballType == BallType.BLUECUSTOM) score = ConstantData.MissionBlueBallPoint; else if (ball.ballType == BallType.YELLOWCUSTOM) score = ConstantData.MissionYellowBallPoint; else if (ball.ballType == BallType.JIANGYOU) score = ConstantData.MissionJiangYouBallPoint; else if (ball.ballType == BallType.DEMON) score = ConstantData.MissionDemonBallPoint; if(score > 0) { m_Player.Combo++; m_Player.AddScore(score, PocketTrigger.GetPocketWithIndexes(pocket)); m_ScoreThisRound = score; } if (m_Player.Combo >= 5) { BaseUIController.GenerateTips("Great!"); } m_Player.Pot(); if (m_TargetBalls.Contains(ball.GetBallID())) m_TargetBalls.Remove(ball.GetBallID()); }
protected void OnSingularityBreakBall(PoolBall ball) { if(ball) { Destroy(ball.gameObject); m_TargetBalls.Remove(ball.GetBallID()); } }