Example #1
0
 void StartFigureJump()
 {
     if (Physics2D.OverlapCircle(m_feet.position, 0.3f, m_jump_flag_layer))
     {
         rb.velocity = Vector2.up * m_jump_force * /*Time.deltaTime*/ 0.016f;
         //Anim.SetBool("Jumping", true);
         jumping_state = JUMPING_STATE.JUMPING;
     }
 }
Example #2
0
    void ExtendFigureJump()
    {
        jump_time_counter += Time.deltaTime;
        rb.velocity        = Vector2.up * m_jump_force * /*Time.deltaTime*/ 0.016f;

        //Debug.Log("Time Counter: " + jump_time_counter + "Player Counter: " + player_controller.jump_time_counter);

        if (jump_time_counter > player_controller.jump_time_counter)
        {
            jump_time_counter = 0.0f;
            jumping_state     = JUMPING_STATE.FALLING;
        }
    }
Example #3
0
    void EndFigureJump()
    {
        if (normal_gravity_scale)
        {
            rb.gravityScale     += 1.0f;
            normal_gravity_scale = false;
        }

        if (Physics2D.OverlapCircle(m_feet.position, ground_collision_radius, m_ground_layer))
        {
            if (!normal_gravity_scale)
            {
                rb.gravityScale     -= 1.0f;
                normal_gravity_scale = true;
            }

            //Anim.SetBool("Jumping", false);
            jumping_state = JUMPING_STATE.GROUNDED;
        }
    }