整合SLSUtilities
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using SLSFramework.General;
|
||||
using SLSUtilities.FunctionalAnimation;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
@@ -119,22 +120,11 @@ namespace Cielonos.MainGame.Characters
|
||||
}
|
||||
}
|
||||
|
||||
void Jump()
|
||||
private void Jump()
|
||||
{
|
||||
if (player.inputSc.JumpPressed)
|
||||
if (player.inputSc.JumpPressed && animationSc.fullBodyFuncAnimSm.Stop(DisruptionType.Movement))
|
||||
{
|
||||
if (!isJumping && groundDetector.isOnGround)
|
||||
{
|
||||
animator.SetTrigger("Jump");
|
||||
Observable.Timer(TimeSpan.FromSeconds(0.16f)).Subscribe(_ =>
|
||||
{
|
||||
jumpVelocity = jumpForce;
|
||||
isJumping = true;
|
||||
jumpTime = 0;
|
||||
jumpHeldTime = 0;
|
||||
animator.SetBool("IsLandingOnGround", false);
|
||||
});
|
||||
}
|
||||
FirstJump();
|
||||
}
|
||||
|
||||
if (isJumping)
|
||||
@@ -150,16 +140,16 @@ namespace Cielonos.MainGame.Characters
|
||||
// --- 玩家正在下落 ---
|
||||
// [不对称重力] 玩家正在下落
|
||||
// 使用较大的 'fallingGravity' 让他感觉更“重”
|
||||
jumpVelocity -= jumpGravity * DeltaTime;
|
||||
jumpVelocity -= jumpGravity * gravityMultiplier * DeltaTime;
|
||||
if (groundDetector.DetectGround(0.8f) || groundDetector.isOnGround)
|
||||
{
|
||||
if (isJumping && jumpTime > 10000f)
|
||||
/*if (isJumping && jumpTime > 10000f)
|
||||
{
|
||||
animator.SetTrigger("LandFromHighAltitude");
|
||||
isJumpLanding = true;
|
||||
|
||||
Observable.Timer(TimeSpan.FromSeconds(0.4f)).Subscribe(_ => { isJumpLanding = false; });
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
animator.SetBool("IsLandingOnGround", true);
|
||||
@@ -171,6 +161,38 @@ namespace Cielonos.MainGame.Characters
|
||||
}
|
||||
}
|
||||
|
||||
public void FirstJump()
|
||||
{
|
||||
if(isJumping || !groundDetector.isOnGround)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
animator.SetTrigger("Jump");
|
||||
player.eventSm.onFirstJump.Invoke();
|
||||
player.selfTimeSm.AddLocalTimer(0.16f, () =>
|
||||
{
|
||||
jumpVelocity = jumpForce;
|
||||
isJumping = true;
|
||||
jumpTime = 0;
|
||||
jumpHeldTime = 0;
|
||||
animator.SetBool("IsLandingOnGround", false);
|
||||
});
|
||||
}
|
||||
|
||||
public void ExtraJump(bool hasAnimation = false, float overrideForce = -1, bool isAdditive = false)
|
||||
{
|
||||
if (!isAdditive)
|
||||
{
|
||||
jumpVelocity = overrideForce > 0 ? overrideForce : jumpForce;
|
||||
}
|
||||
else
|
||||
{
|
||||
jumpVelocity += overrideForce > 0 ? overrideForce : jumpForce;
|
||||
}
|
||||
isJumping = true;
|
||||
}
|
||||
|
||||
protected override void UpdateFinalMovement()
|
||||
{
|
||||
base.UpdateFinalMovement();
|
||||
|
||||
Reference in New Issue
Block a user