| 1 | #include "Player/PlayerJudgeAirForceCount.h" |
|---|---|
| 2 | |
| 3 | #include "Library/Math/MathUtil.h" |
| 4 | |
| 5 | #include "Player/PlayerExternalVelocity.h" |
| 6 | #include "Util/PlayerCollisionUtil.h" |
| 7 | |
| 8 | PlayerJudgeAirForceCount::PlayerJudgeAirForceCount(const al::LiveActor* player, |
| 9 | const PlayerExternalVelocity* externalVelocity, |
| 10 | const IUsePlayerCollision* collider) |
| 11 | : mPlayer(player), mExternalVelocity(externalVelocity), mCollider(collider) {} |
| 12 | |
| 13 | void PlayerJudgeAirForceCount::reset() { |
| 14 | mCounterAirForce = 0; |
| 15 | } |
| 16 | |
| 17 | void PlayerJudgeAirForceCount::update() { |
| 18 | if (rs::isOnGround(mPlayer, mCollider) || !mExternalVelocity->isExistForce()) { |
| 19 | reset(); |
| 20 | return; |
| 21 | } |
| 22 | |
| 23 | mCounterAirForce = al::converge(mCounterAirForce, 40, 1); |
| 24 | } |
| 25 | |
| 26 | bool PlayerJudgeAirForceCount::judge() const { |
| 27 | return mCounterAirForce >= 40; |
| 28 | } |
| 29 |