|
|
@@ -37,7 +37,7 @@ public class PlayerController : MonoBehaviour
|
|
|
public float extraRiseGravity = 0; //上升时额外重力加速度
|
|
|
public float extraFallGravity = -10; //下落时额外重力加速度
|
|
|
public float jumpSpeed = 10;
|
|
|
- //public float airJumpSpeed = 10;
|
|
|
+ public float airJumpSpeed = 10;
|
|
|
public float maxMoveSpeed = 5;
|
|
|
//public float moveAcc = 5f;
|
|
|
//public float airMoveAcc = 3f;
|
|
|
@@ -76,6 +76,8 @@ public class PlayerController : MonoBehaviour
|
|
|
[HideInInspector]
|
|
|
public float cacheRushTime; //无法Rush时按下Rush键不会Rush,手感不好,缓存几帧,在这几帧内落地会立即Rush;
|
|
|
public float totalCacheRushTime = 0.1f;
|
|
|
+ [HideInInspector]
|
|
|
+ public bool airJumped;
|
|
|
|
|
|
public bool isDie = false;
|
|
|
|
|
|
@@ -201,6 +203,12 @@ public class PlayerController : MonoBehaviour
|
|
|
ani.Play("jump", 0, 0);
|
|
|
}
|
|
|
|
|
|
+ public void AirJump()
|
|
|
+ {
|
|
|
+ SetUpSpeed(airJumpSpeed);
|
|
|
+ ani.Play("jump", 0, 0);
|
|
|
+ }
|
|
|
+
|
|
|
public void SetUpSpeed(float speed)
|
|
|
{
|
|
|
ChangeState(PlayerState.Rise);
|
|
|
@@ -394,15 +402,15 @@ public class PlayerController : MonoBehaviour
|
|
|
ChangeState(PlayerState.Fall);
|
|
|
break;
|
|
|
}
|
|
|
- //if (btnJumpPress || cacheJumpTime > 0)
|
|
|
- //{
|
|
|
- // if (!airJumped && rb.velocity.y < airJumpSpeed)
|
|
|
- // {
|
|
|
- // airJumped = true;
|
|
|
- // AirJump();
|
|
|
- // break;
|
|
|
- // }
|
|
|
- //}
|
|
|
+ if (btnJumpPress || cacheJumpTime > 0)
|
|
|
+ {
|
|
|
+ if (!airJumped && rb.velocity.y < airJumpSpeed)
|
|
|
+ {
|
|
|
+ airJumped = true;
|
|
|
+ AirJump();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
if (btnRushPress)
|
|
|
{
|
|
|
cacheRushTime = totalCacheRushTime;
|
|
|
@@ -456,20 +464,20 @@ public class PlayerController : MonoBehaviour
|
|
|
// StepEnemy();
|
|
|
// break;
|
|
|
//}
|
|
|
- //if (btnJumpPress || cacheJumpTime > 0)
|
|
|
- //{
|
|
|
- // if (!airJumped)
|
|
|
- // {
|
|
|
- // airJumped = true;
|
|
|
- // AirJump();
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // else if (canJumpTick >= runner.Tick)
|
|
|
- // {
|
|
|
- // Jump();
|
|
|
- // break;
|
|
|
- // }
|
|
|
- //}
|
|
|
+ if (btnJumpPress || cacheJumpTime > 0)
|
|
|
+ {
|
|
|
+ if (!airJumped)
|
|
|
+ {
|
|
|
+ airJumped = true;
|
|
|
+ AirJump();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ else if (cacheJumpTime > 0)
|
|
|
+ {
|
|
|
+ Jump();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
if (btnRushPress)
|
|
|
{
|
|
|
cacheRushTime = totalCacheRushTime;
|
|
|
@@ -797,4 +805,5 @@ public class PlayerController : MonoBehaviour
|
|
|
}
|
|
|
demonic.ChangeState(DemonicState.Attack1);
|
|
|
}
|
|
|
+
|
|
|
}
|