Beispiel #1
0
    // プレイヤーがピースを選択しているときの処理、入力終了を検知したらReleaseWaitに移行する
    private void BlockMove()
    {
        if (remainTime == 0)
        {
            ReleaseBlock();
        }
        else
        {
            if (replay)
            {
                if (replayIdx < replayData[0].InputCount &&
                    replayData[0].InputFrame[replayIdx] == frame)
                {
                    if (replayData[0].InputType[replayIdx] == (byte)InputType.Move)
                    {
                        // ボードの処理
                        Vector3 inputPos = board.GetBlockWorldPos(new Vector2(replayData[0].InputData1[replayIdx], replayData[0].InputData2[replayIdx]));
                        Block   block    = board.board[replayData[0].InputData1[replayIdx], replayData[0].InputData2[replayIdx]];
                        board.SwitchBlock(selectedBlock, block);
                        movingBlockObject.transform.position = inputPos + Vector3.up * 10;
                        replayIdx++;
                    }
                    else if (replayData[0].InputType[replayIdx] == (byte)InputType.Release)
                    {
                        ReleaseBlock();
                        replayIdx++;
                    }
                }
            }
            else
            {
                GodPhase phase = GodTouch.GetPhase();
                if (phase == GodPhase.Moved)
                {
                    Block block = board.GetNearestBlock(GodTouch.GetPosition());
                    if (block != selectedBlock)
                    {
                        // リプレイの処理
                        inputFrame.Add(frame);
                        inputType.Add((int)InputType.Move);
                        Vector2 pos = board.GetBlockBoardPos(block);
                        inputData1.Add((byte)pos.x);
                        inputData2.Add((byte)pos.y);

                        // ボードの処理
                        board.SwitchBlock(selectedBlock, block);
                    }
                    movingBlockObject.transform.position = GodTouch.GetPosition() + Vector3.up * 10;
                }
                else if (phase == GodPhase.Ended)
                {
                    ReleaseCount = 0;
                    currentState = PuzzleState.ReleaseWait;
                }
            }
        }

        board.HasMatch();
    }
Beispiel #2
0
    private void Result()
    {
        Text label;

        label      = GameObject.Find("MenuText").GetComponent <Text>();
        label.text = "Menu";

        GodPhase phase = GodTouch.GetPhase();

        if (phase == GodPhase.Began)
        {
            iTween.tweens.Clear();
            SceneManager.LoadScene("Free");
        }
    }
Beispiel #3
0
        /// *******************************************************
        /// <summary>更新処理</summary>
        /// *******************************************************
        void Update()
        {
            GodPhase phase = GodTouch.GetPhase();
            Vector3  pos   = Camera.main.ScreenToWorldPoint(GodTouch.GetPosition());

            pos.z = 0;

            switch (phase)
            {
            case GodPhase.Began:
                EnableButton = false;
                Vector3 press    = pos - Center;
                float   distance = (press.x * press.x) + (press.y * press.y);
                if (distance < (ButtonWidth * ButtonWidth))
                {
                    StartPos     = pos;
                    Position     = Center;
                    EnableButton = true;
                }
                break;

            case GodPhase.Stationary:
            case GodPhase.Moved:
                if (EnableButton)
                {
                    Vector3 move    = pos - StartPos;
                    float   movepos = (move.x * move.x) + (move.y * move.y);
                    if (movepos > (MoveWidth * MoveWidth))
                    {
                        move = Vector3.Normalize(move) * MoveWidth;
                    }
                    Position = Center + move;

                    float dst = move.magnitude / MoveWidth;
                    float rad = Mathf.Atan2(move.x, move.y);

                    PlayerControll.Instance.OnShot(rad, dst);
                }
                break;

            case GodPhase.Ended:
                EnableButton = false;
                Position     = Center;
                break;
            }

            UpdateBombCount();
        }
Beispiel #4
0
    // プレイヤーの入力を検知し、ピースを選択状態にする
    private void Idle()
    {
        if (remainTime == 0)
        {
            CalcColorScore();

            if (replay)
            {
                ScoreManager scoreManager = ScoreManager.Instance;
                Debug.Log("colorScore[replayScoreKind]" + colorScore[replayScoreKind] + " scoreManager.highScore[replayScoreKind]" + scoreManager.myHighScore[replayScoreKind]);
                if (colorScore[replayScoreKind] == scoreManager.myHighScore[replayScoreKind])
                {
                    currentState = PuzzleState.Result;
                }
                else
                {
                    currentState = PuzzleState.SendScoreData;
                }
            }
            else
            {
                currentState = PuzzleState.SendScoreData;
            }
        }
        else
        {
            if (replay)
            {
                if (replayIdx < replayData[0].InputCount &&
                    replayData[0].InputFrame[replayIdx] == frame &&
                    replayData[0].InputType[replayIdx] == (byte)InputType.Select)
                {
                    SelectBlock();
                }
            }
            else
            {
                GodPhase phase = GodTouch.GetPhase();
                if (phase == GodPhase.Began)
                {
                    SelectBlock();
                }
            }
        }

        board.HasMatch();
    }
Beispiel #5
0
    // 再度タッチした場合はBlockMoveに移行、タッチされなければ盤面のチェックの状態に移行する
    private void ReleaseWait()
    {
        GodPhase phase = GodTouch.GetPhase();

        if (phase == GodPhase.Began || phase == GodPhase.Moved)
        {
            currentState = PuzzleState.BlockMove;
        }
        else
        {
            stateText.text = string.Format("RC:{0} RM:{1} itween:{2}", ReleaseCount, ReleaseCountMax, iTween.tweens.Count);
            if (ReleaseCount > ReleaseCountMax && iTween.tweens.Count == 0)
            {
                ReleaseBlock();
            }
            else
            {
                ReleaseCount++;
            }
        }

        board.HasMatch();
    }