예제 #1
0
    private void Update()
    {
        var phase = GodTouch.GetPhase();
        var pos   = GodTouch.GetPosition();
        var delta = GodTouch.GetDeltaPosition();

        switch (phase)
        {
        case GodPhase.Began:
            newPosition = MainCamera.transform.position;

            lastMousePosition = Input.mousePosition;
            break;

        case GodPhase.Moved:
            newPosition.x -= (Input.mousePosition.x - lastMousePosition.x) * 0.1f;
            newPosition.z -= (Input.mousePosition.y - lastMousePosition.y) * 0.1f;
            newPosition.x  = Mathf.Clamp(newPosition.x, x_Min, x_Max);
            newPosition.z  = Mathf.Clamp(newPosition.z, z_Min, z_Max);
            MainCamera.gameObject.transform.position = newPosition;

            lastMousePosition = Input.mousePosition;
            break;
        }
    }
예제 #2
0
    public void Installation()
    {
        Vector3    touchStartPos = GodTouch.GetPosition();
        GameObject copyObj       = Instantiate(Gameobj, touchStartPos, Quaternion.identity);

        copyObj.GetComponent <MouseStalker>().touchStartPos = touchStartPos;
    }
예제 #3
0
    void PlayGame()
    {
        switch (state)
        {
        case STATE.WAIT:
            transform.position += transform.right * 0.08f;
            if (transform.position.x > -3.5)
            {
                state = STATE.RUN;
            }
            break;

        case STATE.RUN:
            DecreaseHp();

            // タッチを検出して動かす
            var phase = GodTouch.GetPhase();
            if (phase == GodPhase.Began && jumpCount < 2)
            {
                state = STATE.JUMP;
            }
            break;

        case STATE.JUMP:
            DecreaseHp();
            animator.SetTrigger("jump");
            rb.AddForce(Vector2.up * flap);
            jumpCount++;
            state = STATE.RUN;
            break;
        }
    }
예제 #4
0
        // Update is called once per frame
        void Update()
        {
            pastTime += Time.deltaTime;

            var phase = GodTouch.GetPhase();

            if (phase == GodPhase.Began && isActive)
            {
                int pastTimeInt = (int)(pastTime * 1000f);

                // targetHitSubject.OnNext(pastTimeInt);
                if (!SettingController.isAutoMode)
                {
                    oscController.sendHitTarget(pastTimeInt);
                }
                isHit = true;



                StartCoroutine(hitAnimation());
                StopCoroutine("deactivate");
                StopCoroutine("Show");
            }

            if (Input.GetKey(KeyCode.Space))
            {
                activate(2000.0f);
            }
        }
예제 #5
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();
    }
예제 #6
0
    void SceneLoard()
    {
        var phase = GodTouch.GetPhase();

        if (phase == GodPhase.Began)
        {
            SceneManager.LoadScene(0);
        }
    }
예제 #7
0
    // ピースを選択する処理
    private void SelectBlock()
    {
        Vector3 inputPos;

        if (replay)
        {
            inputPos      = board.GetBlockWorldPos(new Vector2(replayData[0].InputData1[replayIdx], replayData[0].InputData2[replayIdx]));
            selectedBlock = board.board[replayData[0].InputData1[replayIdx], replayData[0].InputData2[replayIdx]];
            replayIdx++;
        }
        else
        {
            // クリック位置取得
            inputPos = GodTouch.GetPosition();
            // 盤外なら処理しない
            if (board.IsInputOut(inputPos))
            {
                return;
            }
            // 近くのブロックを取得
            selectedBlock = board.GetNearestBlock(inputPos);
            // 練習の書込モードの場合、書き込んで処理終了
            if (writeBlock)
            {
                selectedBlock.SetKind(writeBlockKind);
                selectedBlock.garbageKind = writeGarbageKind;
                return;
            }
            // お邪魔は選択できない
            if (selectedBlock.garbageKind != GarbageKind.None)
            {
                return;
            }
            // リプレイの処理
            inputFrame.Add(frame);
            inputType.Add((int)InputType.Select);
            Vector2 pos = board.GetBlockBoardPos(selectedBlock);
            inputData1.Add((byte)pos.x);
            inputData2.Add((byte)pos.y);
        }

        // ボードの処理
        selectedBlock.SetBlockAlpha(0f);
        selectedBlock.selectFlag = true;

        var block = board.InstantiateBlock(inputPos);

        block.SetKind(selectedBlock.GetKind());
        block.SetSize((int)(board.blockWidth * 1.2f));
        movingBlockObject = block.gameObject;

        currentState = PuzzleState.BlockMove;
    }
예제 #8
0
    // Update is called once per frame
    void Update()
    {
        var phase = GodTouch.GetPhase();

        if (phase == GodPhase.Began && Input.touchCount == 1)
        {
            if (m_PhotonView.isMine)
            {
                PhotonNetwork.Instantiate(Bomb.name, m_Atacker.HitGroundPosition, transform.rotation, 0);
            }
        }
    }
예제 #9
0
    public void TouchJudg()
    {
        var phase = GodTouch.GetPhase();
        var pos   = GodTouch.GetPosition();

        switch (phase)
        //if(Input.GetMouseButtonDown(0))
        {
        case GodPhase.Began:     // 押された
            RaycastHit hit;
            Ray        ray = camera.ScreenPointToRay(Input.mousePosition);


            if (EventSystem.current.IsPointerOverGameObject())
            {
                break;
            }

            if (Input.touchCount > 0 && EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId))
            {
                // かぶさってるので処理キャンセル(タップver)
                break;
            }
            if (Physics.Raycast(ray, out hit, maxDistance))
            {
                // レイに当たったオブジェクトに何かをする
                if (hit.transform.tag == "Test" && gimmick != Gimmick.Normal && remaining[(int)gimmick] != 0)
                {
                    hit.transform.tag = tag;
                    hit.collider.GetComponent <Renderer>().material = mat;
                    remaining[(int)gimmick]--;
                    text[(int)gimmick].text = remaining[(int)gimmick].ToString();
                    sound1.PlayOneShot(sound1.clip);
                    if (remaining[(int)gimmick] == 0)
                    {
                        selecting[(int)gimmick].GetComponentInChildren <Image>().color = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 100.0f / 255.0f);
                    }
                    else
                    {
                        selecting[(int)gimmick].GetComponentInChildren <Image>().color = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
                    }

                    gimmick = Gimmick.Normal;
                    tag     = gimmick.ToString();
                    mat     = matArray[(int)gimmick];

                    tutorialPlayer.StopReset();
                }
            }
            break;
        }
    }
예제 #10
0
    // タッチ位置更新
    public void UpdatePosition()
    {
        // 押された時
        if (GodTouch.GetPhase() == GodPhase.Began)
        {
            // スクリーン座標をワールド座標に変換
            Vector2    pos         = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            Collider2D collition2d = Physics2D.OverlapPoint(pos);

            // タッチ位置更新
            transform.position = pos;
        }
    }
예제 #11
0
    // 復帰
    void Recovery()
    {
        // カウント表示
        TextScript[0].textmesh.text = ((int)down_cnt).ToString();
        TextScript[1].textmesh.text = recovery_cnt.ToString();

        // 押された時
        if (GodTouch.GetPhase() == GodPhase.Began)
        {
            recovery_cnt--;
            // 復帰
            if (recovery_cnt <= 0)
            {
                PlayerSprite.enabled        = true;
                PlayerState                 = ePlayerState.NONE;
                TextScript[0].textmesh.text = "";
                TextScript[1].textmesh.text = "";

                // 無敵状態コルーチン
                StartCoroutine("Invincible");
            }
        }


        down_cnt -= Time.deltaTime;

        // 復帰不可
        if (down_cnt <= 0)
        {
            // エフェクト再生
            this.GetComponent <ParticleSystem>().Play();

            // 今取得したスコア生成表示
            var DeathTextObj          = Instantiate(TextPrefab, transform.position, Quaternion.identity);
            var PlayerDeathTextScript = DeathTextObj.gameObject.GetComponent <TextGenerator>();
            PlayerDeathTextScript.textmesh.text = 10.ToString();

            // 得点文字に当たり判定追加
            var TextCircleCollider2D = DeathTextObj.gameObject.AddComponent <CircleCollider2D>();
            TextCircleCollider2D.radius    = Define.TEXT_RADIUS;
            TextCircleCollider2D.isTrigger = true;

            // 状態更新
            PlayerState = ePlayerState.DEATH;

            // 復帰・ダウンカウント文字削除
            Destroy(PlayerTextObj[0]);
            Destroy(PlayerTextObj[1]);
        }
    }
예제 #12
0
    void Update()
    {
        // タッチを検出して動かす
        var phase = GodTouch.GetPhase();

        if (phase == GodPhase.Began)
        {
            Debug.Log("tap");
            // startPos = GodTouch.GetPosition ();
            // vec = Camera.main.ScreenToWorldPoint (startPos);
            //Debug.Log("x="+vec.x+" y="+vec.y);
        }

        // transform.position = Vector2.MoveTowards (transform.position, new Vector2 (vec.x, vec.y), speed * Time.deltaTime);
    }
예제 #13
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");
        }
    }
예제 #14
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();
        }
예제 #15
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();
    }
예제 #16
0
    // Update is called once per frame
    void Update()
    {
        var phase = GodTouch.GetPhase();

        if (phase == GodPhase.Began && isActive)
        {
            // itemHitSubject.OnNext(activeKind);
            oscController.sendHitItem(activeKind);
            // StartCoroutine(hitAnimation());
            hitAnimation();
            StartCoroutine(showGetText());
        }

        if (Input.GetKey("a"))
        {
            Debug.Log("クリックアップデート");
            startShow(item1, 2000);
        }
    }
예제 #17
0
    // タッチ時オブジェクトを全取得
    public List <GameObject> getClickObjectAll()
    {
        List <GameObject> result = new List <GameObject>();

        // 押された時
        if (GodTouch.GetPhase() == GodPhase.Began)
        {
            Vector2 worldPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition);

            // ワールド座標にあるオブジェクトをすべて取得
            foreach (RaycastHit2D hit in Physics2D.RaycastAll(worldPoint, Vector2.zero))
            {
                // オブジェクトがあった時
                if (hit)
                {
                    result.Add(hit.collider.gameObject);
                }
            }
        }
        return(result);
    }
예제 #18
0
        void Update()
        {
            if (!UnityEngine.Rendering.SplashScreen.isFinished)
            {
                return;
            }

            // タッチを検出
            var phase = GodTouch.GetPhase();

            if (phase == GodPhase.Began)
            {
                if (isNextScene)
                {
                    return;
                }
                isNextScene = true;
                Sound.PlaySe("jingle_start");
                effects.PlayEffects();
                StartCoroutine(WaitNextScene(1f));
            }
        }
예제 #19
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();
    }