| 1 | #include "Player/PlayerJudgeSpeedCheckFall.h" |
|---|---|
| 2 | |
| 3 | #include <math/seadMathCalcCommon.h> |
| 4 | |
| 5 | #include "Util/JudgeUtil.h" |
| 6 | #include "Util/PlayerCollisionUtil.h" |
| 7 | |
| 8 | PlayerJudgeSpeedCheckFall::PlayerJudgeSpeedCheckFall(const al::LiveActor* player, |
| 9 | const IUsePlayerCollision* collision, |
| 10 | const PlayerConst* pConst, |
| 11 | const IJudge* judgeWaterSurfaceRun) |
| 12 | : mPlayer(player), mCollision(collision), mConst(pConst), |
| 13 | mJudgeStartWaterSurfaceRun(judgeWaterSurfaceRun) {} |
| 14 | |
| 15 | void PlayerJudgeSpeedCheckFall::reset() { |
| 16 | mFramesNoCollideGround = 0; |
| 17 | } |
| 18 | |
| 19 | void PlayerJudgeSpeedCheckFall::update() { |
| 20 | if (!rs::isCollidedGroundRunAngle(mPlayer, mCollision, mConst)) { |
| 21 | if (mFramesNoCollideGround <= 4) |
| 22 | mFramesNoCollideGround++; |
| 23 | } else { |
| 24 | mFramesNoCollideGround = 0; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | bool PlayerJudgeSpeedCheckFall::judge() const { |
| 29 | return !rs::isJudge(judge: mJudgeStartWaterSurfaceRun) && mFramesNoCollideGround > 4; |
| 30 | } |
| 31 |