| 1 | #include "Player/PlayerContinuousJump.h" |
|---|---|
| 2 | |
| 3 | #include "Player/PlayerConst.h" |
| 4 | |
| 5 | PlayerContinuousJump::PlayerContinuousJump(const PlayerConst* pConst) : mConst(pConst) {} |
| 6 | |
| 7 | void PlayerContinuousJump::update(bool shouldCountDown) { |
| 8 | if (!shouldCountDown) { |
| 9 | clear(); |
| 10 | return; |
| 11 | } |
| 12 | |
| 13 | if (mCount > 0) { |
| 14 | mTimer++; |
| 15 | if (mTimer >= (u32)mConst->getContinuousJumpTimer()) |
| 16 | clear(); |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | void PlayerContinuousJump::clear() { |
| 21 | mLastJumpDir = {0.0f, 0.0f, 0.0f}; |
| 22 | mCount = 0; |
| 23 | mTimer = mConst->getContinuousJumpTimer(); |
| 24 | } |
| 25 | |
| 26 | void PlayerContinuousJump::countUp(const sead::Vector3f& jumpDir) { |
| 27 | mLastJumpDir = jumpDir; |
| 28 | mCount = (mCount + 1) % mConst->getContinuousJumpCount(); |
| 29 | mTimer = 0; |
| 30 | } |
| 31 |