浏览代码

Fixed jump attack particle bug (#464)

Like mentioned in the thread, the bug is caused because the state machine goes Ascending->Descending->DescendingAttacking where Descending calls the particles when exiting. I fixed this simply by adding a ground check on the LandParticles action.
/main
GitHub 3 年前
当前提交
a98c8e7f
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 4
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/PlayLandParticlesActionSO.cs

4
UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/PlayLandParticlesActionSO.cs


//Component references
private PlayerEffectController _dustController;
private Transform _transform;
private CharacterController _characterController;
private float _coolDown = 0.3f;
private float t = 0f;

{
_dustController = stateMachine.GetComponent<PlayerEffectController>();
_transform = stateMachine.transform;
_characterController = stateMachine.GetComponent<CharacterController>();
}
public override void OnStateEnter()

float dY = Mathf.Abs(_fallStartY - _fallEndY);
float fallIntensity = Mathf.InverseLerp(0, _maxFallDistance, dY);
if (Time.time >= t + _coolDown)
if (Time.time >= t + _coolDown && _characterController.isGrounded)
{
_dustController.PlayLandParticles(fallIntensity);
t = Time.time;

正在加载...
取消
保存