title: C# unity Double Jump Coding for player Movement control
body: <pre><code>using UnityEngine;
  using System.Collections;
  
  public class PlayerMovement : MonoBehaviour 
  {
  public float speed          = 3.0f;
  public float jumpSpeed          = 200.0f;
  public bool grounded            = true;
  public float time           = 4.0f;     
  
  
  
  // Use this for initialization
  void Start () 
  {
  
  }
  
  // Update is called once per frame
  void FixedUpdate () 
  {
      Vector3 x = Input.GetAxis("Horizontal")* transform.right * Time.deltaTime *      speed;
  
      if (time &lt;= 2)
      {
      if(Input.GetButtonDown("Jump"))
          {
                  Jump();
          }
  
      }
  
      transform.Translate(x);
  
      //Restrict Rotation upon jumping of player object
      transform.rotation = Quaternion.LookRotation(Vector3.forward);
  
  
  }
  void Jump()
      {
          if (grounded == true)
          {
              rigidbody.AddForce(Vector3.up* jumpSpeed);
  
  
              grounded = false;
          }
  
      }
  void OnCollisionEnter (Collision hit)
  {
      grounded = true;
      // check message upon collition for functionality working of code.
      Debug.Log ("I am colliding with something");
  }
  
  }
  </code></pre>
  
  <p>Where should and what type of coding can make it jump twice before resting back on ground?</p>
  
  <p>There is an object with sprite sheet on it and i had acquired constraining the movement and normal jump based on physics engine in unity. but i want the movement to be more dynamic and make the jump twice only once it is not grounded and in between certain time frame like if the  jump button is pressed within some Milli second interval before coming to reset position upon resting in ground.</p>