Пример #1
0
    protected override void TurnBegin()
    {
        base.TurnBegin();
        m_PunishmentCountThisRound = 0;
        m_RewardCountThisRound     = 0;
        State = GlobalState.IDLE;
        if (m_Turn > 1 && LevelDataIndex.CurrentLevel.SpecificPocket)
        {
            //generate punitive pocket and reward pocket
            //punishment
            PocketIndexes punishment = PocketIndexes.None;
            if (Random.Range(0, 100) > ConstantData.SpecialPocketProbability)
            {
                punishment |= (PocketIndexes)(1 << Random.Range(0, 5));
                if (Random.Range(0, 1) == 1)
                {
                    punishment |= (PocketIndexes)(1 << Random.Range(0, 5));
                }
            }
            //reward
            PocketIndexes reward = PocketIndexes.None;
            if (Random.Range(0, 100) > ConstantData.SpecialPocketProbability)
            {
                reward |= (PocketIndexes)(1 << Random.Range(0, 5));
                if (Random.Range(0, 1) == 1)
                {
                    reward |= (PocketIndexes)(1 << Random.Range(0, 5));
                }
            }

            PocketTrigger.MarkPocketType(punishment, reward);
        }
    }
Пример #2
0
 public static PocketTrigger GetPocketWithIndexes(PocketIndexes index)
 {
     for(int i = 0, count = Pools.PocketTriggers.Count; i < count; i++)
     {
         if((Pools.PocketTriggers[i].m_PocketIndex & index) != 0x0)
             return Pools.PocketTriggers[i];
     }
     return null;
 }
Пример #3
0
 public static void Block(PocketIndexes pockets)
 {
     for (int i = 0, length = Pools.PocketTriggers.Count; i < length; i++)
     {
         PocketTrigger trigger = Pools.PocketTriggers[i];
         if ((trigger.PocketIndex & pockets) != 0x0)
             trigger.BlockOff();
     }
 }
Пример #4
0
 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;
     }
 }
Пример #5
0
 public static void Block(PocketIndexes pockets)
 {
     for (int i = 0, length = Pools.PocketTriggers.Count; i < length; i++)
     {
         PocketTrigger trigger = Pools.PocketTriggers[i];
         if ((trigger.PocketIndex & pockets) != 0x0)
         {
             trigger.BlockOff();
         }
     }
 }
Пример #6
0
 public static PocketTrigger GetPocketWithIndexes(PocketIndexes index)
 {
     for (int i = 0, count = Pools.PocketTriggers.Count; i < count; i++)
     {
         if ((Pools.PocketTriggers[i].m_PocketIndex & index) != 0x0)
         {
             return(Pools.PocketTriggers[i]);
         }
     }
     return(null);
 }
 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;
     }
 }
Пример #8
0
    public override void Potted(PocketIndexes pocketIndex)
    {
        base.Potted(pocketIndex);

        if (GameManager.Rules.State == GlobalState.GAMEOVER)
            return;

        GameManager.Rules.State = GlobalState.GAMEOVER;

        if (GameOverWithPotted != null)
            GameOverWithPotted(null);
    }
 public override void PotBall(PoolBall ball, PocketIndexes pocket)
 {
     base.PotBall(ball, pocket);
     if (CurrentPlayer.TargetBallType == BallType.NONE && ball.ballType != BallType.WHITE && ball.ballType != BallType.BLACK && !firstRound)
     {
         CurrentPlayer.TargetBallType = ball.ballType;
         OpponentPlayer.TargetBallType = ball.ballType == BallType.SOLID ? BallType.STRIPE : BallType.SOLID;
     }
     BallType b = ball.ballType;
     if (b != BallType.WHITE)
     {
         CurrentPlayer.combo++;
     }
 }
Пример #10
0
 public override void Potted(PocketIndexes pocketIndex)
 {
     if (m_rigidbody)
     {
         m_state = State.POTTED;
         m_rigidbody.velocity        = Vector3.zero;
         m_rigidbody.angularVelocity = Vector3.zero;
         CloseDrag();
         CloseRenderer();
         enabled = false;
         RemovePhysicalMaterial();
         GameStatistics.MarkCueballPotted(1);
     }
 }
Пример #11
0
 public override void Potted(PocketIndexes pocketIndex)
 {
     if (m_rigidbody)
     {
         m_state = State.POTTED;
         m_rigidbody.velocity = Vector3.zero;
         m_rigidbody.angularVelocity = Vector3.zero;
         CloseDrag();
         CloseRenderer();
         enabled = false;
         RemovePhysicalMaterial();
         GameStatistics.MarkPottedJiangyouBallCount(1);
     }
 }
Пример #12
0
    public override void PotBall(PoolBall ball, PocketIndexes pocket)
    {
        base.PotBall(ball, pocket);
        if (CurrentPlayer.TargetBallType == BallType.NONE && ball.ballType != BallType.WHITE && ball.ballType != BallType.BLACK && !firstRound)
        {
            CurrentPlayer.TargetBallType  = ball.ballType;
            OpponentPlayer.TargetBallType = ball.ballType == BallType.SOLID ? BallType.STRIPE : BallType.SOLID;
        }
        BallType b = ball.ballType;

        if (b != BallType.WHITE)
        {
            CurrentPlayer.combo++;
        }
    }
Пример #13
0
 public static void MarkPocketType(PocketIndexes punishmentIndex, PocketIndexes rewardIndex)
 {
     for(int i = 0, length = Pools.PocketTriggers.Count; i < length; i++)
     {
         PocketTrigger trigger = Pools.PocketTriggers[i];
         if((trigger.PocketIndex & punishmentIndex) != 0x0)
             trigger.Punishment();
         else if((trigger.PocketIndex & rewardIndex) != 0x0)
             trigger.Reward();
         else
             trigger.Clear();
     }
     PunitivePocket = punishmentIndex;
     RewardPocket = rewardIndex;
 }
Пример #14
0
    public override void Potted(PocketIndexes pocketIndex)
    {
        base.Potted(pocketIndex);

        if (GameManager.Rules.State == GlobalState.GAMEOVER)
        {
            return;
        }

        GameManager.Rules.State = GlobalState.GAMEOVER;

        if (GameOverWithPotted != null)
        {
            GameOverWithPotted(null);
        }
    }
Пример #15
0
 public virtual void PotBall(PoolBall ball, PocketIndexes pocket)
 {
     ball.Potted(pocket);
     if (ball.ballType == BallType.WHITE)
     {
         m_WhiteBallPotted = true;
         if (onCueballPotted != null)
         {
             onCueballPotted();
         }
     }
     else if (ball.ballType != BallType.JIANGYOU && ball.ballType != BallType.DEMON)
     {
         m_PottedBallListThisRound.Add(ball);
     }
 }
Пример #16
0
        public Pocket(Rect _rect, Texture2D _texture, GameObject _pocketGameObject, PocketIndexes _Index)
        {
            rect             = _rect;
            texture          = _texture;
            pocketGameObject = _pocketGameObject;
            m_Index          = _Index;

            (punishmentObject = pocketGameObject.transform.FindChild("PunishmentSprite").gameObject).SetActive(false);
            (rewardObject = pocketGameObject.transform.FindChild("RewardSprite").gameObject).SetActive(false);
            (blockObject = pocketGameObject.transform.FindChild("BlockOff").gameObject).SetActive(false);

            punishmentColor = Color.red;
            rewardColor     = Color.green;
            blockColor      = Color.white;

            m_Type = PocketType.None;
        }
Пример #17
0
 public static void MarkPocketType(PocketIndexes punishmentIndex, PocketIndexes rewardIndex)
 {
     for (int i = 0, length = Pools.PocketTriggers.Count; i < length; i++)
     {
         PocketTrigger trigger = Pools.PocketTriggers[i];
         if ((trigger.PocketIndex & punishmentIndex) != 0x0)
         {
             trigger.Punishment();
         }
         else if ((trigger.PocketIndex & rewardIndex) != 0x0)
         {
             trigger.Reward();
         }
         else
         {
             trigger.Clear();
         }
     }
     PunitivePocket = punishmentIndex;
     RewardPocket   = rewardIndex;
 }
    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());
    }
Пример #19
0
    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 Pocket(Rect _rect, Texture2D _texture, GameObject _pocketGameObject, PocketIndexes _Index)
        {
            rect = _rect;
            texture = _texture;
            pocketGameObject = _pocketGameObject;
            m_Index = _Index;

            (punishmentObject = pocketGameObject.transform.FindChild("PunishmentSprite").gameObject).SetActive(false);
            (rewardObject = pocketGameObject.transform.FindChild("RewardSprite").gameObject).SetActive(false);
            (blockObject = pocketGameObject.transform.FindChild("BlockOff").gameObject).SetActive(false);

            punishmentColor = Color.red;
            rewardColor = Color.green;
            blockColor = Color.white;

            m_Type = PocketType.None;
        }
Пример #21
0
 public virtual void PotBall(PoolBall ball, PocketIndexes pocket)
 {
     ball.Potted(pocket);
     if (ball.ballType == BallType.WHITE)
     {
         m_WhiteBallPotted = true;
         if (onCueballPotted != null)
             onCueballPotted();
     }
     else if (ball.ballType != BallType.JIANGYOU && ball.ballType != BallType.DEMON)
     {
         m_PottedBallListThisRound.Add(ball);
     }
 }