//--------------------------------------------------------------------
    // ● 更新(更新)
    //--------------------------------------------------------------------
    protected override void update_update()
    {
        base.update_update();


        if (Input.GetKeyDown(KeyCode.Backspace))
        {
            next_scene_name = SceneManager.GetActiveScene().name;
        }

        switch (game_state)
        {
        case Game_State.START:  update_start(); break;

        case Game_State.GAME:   update_game();  break;

        case Game_State.CLEAR:  update_clear(); break;

        case Game_State.OVER:   update_over();  break;
        }

        Debug_EX.add("Game\t :" + game_state);

/*
 *              if (Input.GetKeyDown(KeyCode.F12)) {
 *                      next_scene_name = "Title";
 *              }
 */
    }
Exemplo n.º 2
0
    //--------------------------------------------------------------------
    // ● 更新(キネクト)
    //--------------------------------------------------------------------
    void update_kinect()
    {
        var kinect = KinectManager.Instance;

        if (kinect == null)
        {
            return;
        }

        var id = kinect.GetPlayer1ID();

        if (id <= 0)
        {
            return;
        }

        var main_position = kinect.GetUserPosition(id);
        var hip           = 0;
        var right_hand    = 11;


        // 人が存在するかを判定
        is_human_exists = kinect.IsJointTracked(id, hip);


        if (kinect.IsJointTracked(id, right_hand))
        {
            var joint_position = kinect.GetJointPosition(id, right_hand);
            joint_position -= main_position;
            var joint_rotation =
                kinect.GetJointOrientation(id, right_hand, true);
//			transform.localPosition = joint_position;
//			transform.rotation = joint_rotation;


            // 右手の位置を設定
            var y = 1 - Mathf.Clamp01(joint_position.y);
            hand_position = new Vector2(
                Mathf.Clamp01(joint_position.x + 0.5f) * 1920,
                y * -1080);


            // 釣り開始を判定
            var z = Mathf.Clamp01(joint_position.z * 2 * -1);

/*
 *                      if (y > 0.4 && z <= 0)
 *                              fishing_accumulate_second = Time.time + 1;
 *                      if (fishing_accumulate_second > Time.time && z >= 0.5)
 *                              is_start_fishing = true;
 */

            debug_position   = joint_position;
            debug_position.z = z;
            Debug_EX.add(Color.yellow);
            Debug_EX.add("右手の位置 : " + joint_position);
            Debug_EX.add(Color.white);
        }
    }
 //--------------------------------------------------------------------
 // ● 更新
 //--------------------------------------------------------------------
 protected virtual void Update()
 {
     // FPSを計測
     frame_count++;          // フレーム数を加算
     // FPS確認秒数に到達した場合、FPSを更新
     if (next_frame_check_second < Time.time)
     {
         next_frame_check_second = 1 + Time.time; // 次回確認秒数を設定
         fps         = frame_count;               // FPSをフレーム数とする
         frame_count = 0;                         // フレーム数をリセット
     }
     Debug_EX.add("FPS : " + fps);                // FPSをデバッグ表示
 }
    //--------------------------------------------------------------------
    // ● 更新
    //--------------------------------------------------------------------
    protected override void Update()
    {
        base.Update();

        // 終了秒に到達したか、BackSpaceボタンが押された場合
        if (end_coroutine == null && (end_second < Time.time || Input.GetKeyDown(KeyCode.Backspace)))
        {
            end_coroutine = StartCoroutine(end());
        }

        // 終了までの秒数をデバッグ表示
        Debug_EX.add("end_second : " + (end_second - Time.time));
    }
    //--------------------------------------------------------------------
    // ● 更新(テスト)
    //--------------------------------------------------------------------
    void update_test()
    {
//		Debug_EX.new_line();
        Debug_EX.add(Color.yellow);
        var s = ai.status;

        Debug_EX.add(ai.name +
                     " HP : " + ai.status.strength +
                     " Mood : " + ai.status.mood);
        Debug_EX.add(Color.white);

        var list = new List <string>(states.Keys);

        foreach (var key in list)
        {
            Debug_EX.add(key + "\t: " + states[key].ToString());
        }

//		Debug_EX.add("");
    }
Exemplo n.º 6
0
    //--------------------------------------------------------------------
    // ● 更新
    //--------------------------------------------------------------------
    void Update()
    {
        // ESC キーで終了
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Application.Quit();
        }


        // FPSを計測
        if (next_check_fps_time < Time.time)
        {
            next_check_fps_time = Time.time + 1;
            fps         = frame_count;
            frame_count = 0;
        }
        frame_count++;
        Debug_EX.add(Color.red);
        Debug_EX.add("FPS : " + fps);
        Debug_EX.add(Color.white);
    }
Exemplo n.º 7
0
    //--------------------------------------------------------------------
    // ● 更新
    //--------------------------------------------------------------------
    public override void update()
    {
        base.update();


        if (error_second < Time.time)
        {
            is_error = true;
        }
        Debug_EX.add("コルーチン停止 : " + (error_second - Time.time));

        if (is_error)
        {
            stop_all_coroutines();
            game_manager.next_scene_name =
                SceneManager.GetActiveScene().name;
        }


        if (!is_setup)
        {
            return;
        }

        if (ai.animator.GetBool("Is_Swim") &&
            ai.animator.GetBool("Is_Under_Water"))
        {
            var pos = ai.transform.position;
            pos.y = Mathf.Min(pos.y, sea.position.y - 1.5f);
            ai.transform.position = pos;
        }

        RaycastHit hit_info;
        var        is_hit = Physics.Raycast(
            ai.transform.position, -ai.transform.up, out hit_info, 1);

        ai.animator.SetBool("Is_Grounded", is_hit);
    }
 //--------------------------------------------------------------------
 // ● 更新(テスト)
 //--------------------------------------------------------------------
 protected virtual void update_test()
 {
     Debug_EX.add(this + " HP : " + strength);
     Debug_EX.add(this + " Mood : " + mood);
 }