コード例 #1
0
    void Update()
    {
        switch (_gamePhase)
        {
        case eGamePhase.NONE:
            break;

        case eGamePhase.INITIAL_STAGE:
            MakeUselessBubbles();
            _gamePhase = eGamePhase.UPDATE_BUBBLE;
            break;

        case eGamePhase.UPDATE_BUBBLE:
            if (UpdateBubble() == true)
            {
                switch (_missSwap)
                {
                case eMissAniPhase.Begin:
                    BubbleSwap(_swapSourceBubble, _swapTargetBubble);
                    _missSwap = eMissAniPhase.Return;
                    OnClickBubble(null, false);
                    _swapTargetBubble = null;
                    _swapSourceBubble = null;
                    break;

                case eMissAniPhase.Return:
                    _missSwap  = eMissAniPhase.None;
                    _gamePhase = eGamePhase.PLAYER_TURN;
                    break;

                case eMissAniPhase.None:
                    _gamePhase = eGamePhase.BUBBLE_BOMB;
                    break;
                }
            }
            break;

        case eGamePhase.BUBBLE_BOMB:
            if (CalcBubbleBomb() == true)
            {
                _gamePhase = eGamePhase.UPDATE_BUBBLE;
            }
            else
            {
                _gamePhase = eGamePhase.PLAYER_TURN;
            }
            break;

        case eGamePhase.PLAYER_TURN:
            CheckSwapBubble();
            break;

        case eGamePhase.CLEAR:
            break;
        }
    }
コード例 #2
0
    public void OnStartGame()
    {
        if (_mode == eGameMode.OPTION)
        {
            InitStage(TileWidth, TileHeight);

            MakeUselessBubbles();
            InitScale();
        }

        _gamePhase        = eGamePhase.INITIAL_STAGE;
        _missSwap         = eMissAniPhase.None;
        _swapTargetBubble = null;
        _swapSourceBubble = null;
        _optionManager.gameObject.SetActive(false);
        _mode = eGameMode.GAME;
    }
コード例 #3
0
    public void CheckSwapBubble()
    {
        if (_gamePhase != eGamePhase.PLAYER_TURN || _pressdBubble == null)
        {
            return;
        }

        Ray        ray = UICamera.currentCamera.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, 10f, _bubbleLayerMask))
        {
            BubbleScript bubble = hit.collider.gameObject.GetComponent <BubbleScript>();
            if (bubble == null)
            {
                return;
            }

            if (bubble.TargetMapTile.IsNearbyMapTile(_pressdBubble.TargetMapTile) == true)
            {
                if (SwapBubble(_pressdBubble, bubble) == true)
                {
                    BubbleSwap(_pressdBubble, bubble);
                    OnClickBubble(null, false);
                }
                else
                {
                    _missSwap = eMissAniPhase.Begin;
                    BubbleSwap(_pressdBubble, bubble);
                    _swapTargetBubble = bubble;
                    _swapSourceBubble = _pressdBubble;
                }
                _gamePhase = eGamePhase.UPDATE_BUBBLE;
            }
        }
    }