Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        float Horizontal = Input.GetAxis("Horizontal_L");
        float Vertical   = Input.GetAxis("Vertical_L");

        if (Input.GetButtonDown("Circle") && targetObj != null)
        {
            PauseButton pButton = targetObj.GetComponent <PauseButton>();
            if (pButton.GetSelectNum == 0)
            {
                pButton.Decision();
            }
            else
            {
            }

            //switch (gameManager.GetComponent<GameStateController>().PState)
            //{
            //    case GameStateController.PlayerState.Action:
            //        break;
            //    case GameStateController.PlayerState.Pause:
            //        //targetObj.GetComponent<>()
            //        break;
            //    case GameStateController.PlayerState.Synthesis:
            //        break;
            //    default:
            //        break;
            //}
        }

        // 横移動
        if (Horizontal != 0)
        {
            cursorPosition.x += Horizontal * moveSpeed;
        }

        // 縦移動
        if (Vertical != 0)
        {
            cursorPosition.y += Vertical * moveSpeed;
        }

        // 可動制限----------------------------------------------------------------
        if (cursorPosition.x > Screen.width || cursorPosition.x < 0)
        {
            cursorPosition = transform.position;
        }

        if (cursorPosition.y > Screen.height || cursorPosition.y < 0)
        {
            cursorPosition = transform.position;
        }
        // ------------------------------------------------------------------------
        cursorIcon.transform.position = cursorPosition;
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        Horizontal = Input.GetAxis("Horizontal_L");
        Vertical   = Input.GetAxis("Vertical_L");

        // ポーズ内のボタンを押したときの処理
        if (Input.GetButtonDown("Circle") && targetObj != null)
        {
            PauseButton pButton = targetObj.GetComponent <PauseButton>();
            if (pButton.GetSelectNum == 0)
            {
                pButton.Decision();
            }
            else
            {
                pauseCon.GetComponent <PauseController>().Pause();
            }
        }

        // 横移動
        if (Horizontal != 0)
        {
            cursorPosition.x += Horizontal * moveSpeed;
        }

        // 縦移動
        if (Vertical != 0)
        {
            cursorPosition.y += Vertical * moveSpeed;
        }

        // 可動制限----------------------------------------------------------------
        if (cursorPosition.x > Screen.width || cursorPosition.x < 0)
        {
            cursorPosition = transform.position;
        }

        if (cursorPosition.y > Screen.height || cursorPosition.y < 0)
        {
            cursorPosition = transform.position;
        }
        // ------------------------------------------------------------------------
        transform.position = cursorPosition;
    }