using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PLayer : MonoBehaviour {
private float jumpPressure;
private float minJump;
private float maxJumpPressure;
private bool onGround;
private Rigidbody rbody;
// Use this for initialization
void Start ()
{
onGround = true;
jumpPressure = 0f;
minJump = 2f;
maxJumpPressure = 10f;
}
// Update is called once per frame
void Update ()
{
if(onGround)
{
{ //Hold to make player jump higher//
if(Input.GetButton("Jump"))
{
if(jumpPressure < maxJumpPressure)
{
jumpPressure += Time.deltaTime*10f;
}
else
{
jumpPressure = maxJumpPressure;
}
print(jumpPressure);
}
}
} //Not Holding (tapping) Jump Button (Will make you jump at normal height (lower))
else
{
if(jumpPressure > 0f)
{
jumpPressure = jumpPressure + minJump;
}
↧