Пример #1
0
    private void Start( )
    {
        for (int i = 0; i < _button_input_count.Length; i++)
        {
            _button_input_count[i] = 0;
        }

        _button_name[( int )Controller.INPUT_TYPE.BACK_BUTTON]            = "バックボタン:";
        _button_name[( int )Controller.INPUT_TYPE.HOME_BUTTON_LONG_PRESS] = "ホームボタン長押し:";
        _button_name[( int )Controller.INPUT_TYPE.TRIGGER]                = "トリガー長押し:";
        _button_name[( int )Controller.INPUT_TYPE.TRIGGER_DOWN]           = "トリガー押し込み:";
        _button_name[( int )Controller.INPUT_TYPE.TRIGGER_UP]             = "トリガー離した:";
        _button_name[( int )Controller.INPUT_TYPE.TOUCH_PAD_CLICK]        = "タッチパッドクリック:";
        _button_name[( int )Controller.INPUT_TYPE.TOUCH_PAD_SCREEL_UP]    = "タッチパッドスクロール上:";
        _button_name[( int )Controller.INPUT_TYPE.TOUCH_PAD_SCREEL_DOWN]  = "タッチパッドスクロール下:";
        _button_name[( int )Controller.INPUT_TYPE.TOUCH_PAD_SCREEL_LEFT]  = "タッチパッドスクロール左:";
        _button_name[( int )Controller.INPUT_TYPE.TOUCH_PAD_SCREEL_RIGHT] = "タッチパッドスクロール右:";


        _debug_button_texts[( int )Controller.INPUT_TYPE.BACK_BUTTON].text            = _button_name[( int )Controller.INPUT_TYPE.BACK_BUTTON] + _button_input_count[( int )Controller.INPUT_TYPE.BACK_BUTTON];
        _debug_button_texts[( int )Controller.INPUT_TYPE.HOME_BUTTON_LONG_PRESS].text = _button_name[( int )Controller.INPUT_TYPE.HOME_BUTTON_LONG_PRESS] + _button_input_count[( int )Controller.INPUT_TYPE.HOME_BUTTON_LONG_PRESS];
        _debug_button_texts[( int )Controller.INPUT_TYPE.TRIGGER].text                = _button_name[( int )Controller.INPUT_TYPE.TRIGGER] + _button_input_count[( int )Controller.INPUT_TYPE.TRIGGER];
        _debug_button_texts[( int )Controller.INPUT_TYPE.TRIGGER_DOWN].text           = _button_name[( int )Controller.INPUT_TYPE.TRIGGER_DOWN] + _button_input_count[( int )Controller.INPUT_TYPE.TRIGGER_DOWN];
        _debug_button_texts[( int )Controller.INPUT_TYPE.TRIGGER_UP].text             = _button_name[( int )Controller.INPUT_TYPE.TRIGGER_UP] + _button_input_count[( int )Controller.INPUT_TYPE.TRIGGER_UP];
        _debug_button_texts[( int )Controller.INPUT_TYPE.TOUCH_PAD_CLICK].text        = _button_name[( int )Controller.INPUT_TYPE.TOUCH_PAD_CLICK] + _button_input_count[( int )Controller.INPUT_TYPE.TOUCH_PAD_CLICK];
        _debug_button_texts[( int )Controller.INPUT_TYPE.TOUCH_PAD_SCREEL_UP].text    = _button_name[( int )Controller.INPUT_TYPE.TOUCH_PAD_SCREEL_UP] + _button_input_count[( int )Controller.INPUT_TYPE.TOUCH_PAD_SCREEL_UP];
        _debug_button_texts[( int )Controller.INPUT_TYPE.TOUCH_PAD_SCREEL_DOWN].text  = _button_name[( int )Controller.INPUT_TYPE.TOUCH_PAD_SCREEL_DOWN] + _button_input_count[( int )Controller.INPUT_TYPE.TOUCH_PAD_SCREEL_DOWN];
        _debug_button_texts[( int )Controller.INPUT_TYPE.TOUCH_PAD_SCREEL_LEFT].text  = _button_name[( int )Controller.INPUT_TYPE.TOUCH_PAD_SCREEL_LEFT] + _button_input_count[( int )Controller.INPUT_TYPE.TOUCH_PAD_SCREEL_LEFT];
        _debug_button_texts[( int )Controller.INPUT_TYPE.TOUCH_PAD_SCREEL_RIGHT].text = _button_name[( int )Controller.INPUT_TYPE.TOUCH_PAD_SCREEL_RIGHT] + _button_input_count[( int )Controller.INPUT_TYPE.TOUCH_PAD_SCREEL_RIGHT];

        _debug_pos_text.text = "Xpos:" + _controller.getControllerPos( ).x +
                               "\nYpos:" + _controller.getControllerPos( ).y;

        _debug_player_pos_text.text = "PlayerXpos:" + _player.transform.position.x +
                                      "\nPlayerYpos:" + _player.transform.position.y +
                                      "\nPlayerZpos:" + _player.transform.position.z;

        _debug_player_dir_text.text = "PlayerXdir:" + _player.transform.eulerAngles.x +
                                      "\nPlayerYdir:" + _player.transform.eulerAngles.y +
                                      "\nPlayerZdir:" + _player.transform.eulerAngles.z;

        _debug_gaze_dir_text.text = "GazeXdir:" + _gaze_controller.getDirection( ).x +
                                    "\nGazeYdir:" + _gaze_controller.getDirection( ).y +
                                    "\nGazeZdir:" + _gaze_controller.getDirection( ).z;

        _debug_ray_hit_text.text = _gaze_controller.getIsHit( ).ToString( );

        if (_gaze_controller.getLockOnObject( ) != null)
        {
            _debug_hit_object_text.text = _gaze_controller.getLockOnObject( ).ToString( );
        }
        else
        {
            _debug_hit_object_text.text = "NULL";
        }
    }
Пример #2
0
    //角度を視線と常に合わせる
    private void Direction( )
    {
        Vector3 player_dir = new Vector3(-_gaze_controller.getDirection( ).y, _gaze_controller.getDirection( ).x, 0);           //恐らく、2Dと3Dで向きの計算が違うため入れ替えてる(2Dは単純にxは横、yは縦。3Dはそれぞれの線の軸を中心に回転する)

        transform.eulerAngles = player_dir * _direction_size;
    }