| 1 | #include "Item/CoinStateCountUp.h" |
| 2 | |
| 3 | #include <math/seadVector.h> |
| 4 | |
| 5 | #include "Library/LiveActor/ActorActionFunction.h" |
| 6 | #include "Library/LiveActor/ActorMovementFunction.h" |
| 7 | #include "Library/LiveActor/ActorPoseUtil.h" |
| 8 | #include "Library/LiveActor/LiveActor.h" |
| 9 | #include "Library/Nerve/NerveSetupUtil.h" |
| 10 | #include "Library/Nerve/NerveUtil.h" |
| 11 | |
| 12 | namespace { |
| 13 | NERVE_IMPL(CoinStateCountUp, CountUp); |
| 14 | NERVE_IMPL(CoinStateCountUp, Got); |
| 15 | |
| 16 | NERVES_MAKE_NOSTRUCT(CoinStateCountUp, CountUp, Got); |
| 17 | } // namespace |
| 18 | |
| 19 | CoinStateCountUp::CoinStateCountUp(al::LiveActor* actor) |
| 20 | : ActorStateBase("カウントアップ状態" , actor) { |
| 21 | initNerve(nerve: &CountUp, stateCount: 0); |
| 22 | } |
| 23 | |
| 24 | void CoinStateCountUp::appear() { |
| 25 | al::NerveStateBase::appear(); |
| 26 | al::setNerve(user: this, nerve: &CountUp); |
| 27 | } |
| 28 | |
| 29 | void CoinStateCountUp::exeCountUp() { |
| 30 | al::LiveActor* actor = mActor; |
| 31 | if (al::isFirstStep(user: this)) { |
| 32 | mTransY = al::getTrans(actor).y; |
| 33 | al::setVelocity(actor, vel: sead::Vector3f::ey * 65.0f); |
| 34 | } |
| 35 | |
| 36 | al::rotateQuatYDirDegree(actor, deg: 9.5f); |
| 37 | al::scaleVelocity(actor, factor: 0.9f); |
| 38 | al::addVelocityToGravity(actor, force: 1.5f); |
| 39 | |
| 40 | if (mTransY > al::getTrans(actor).y - 300.0f && al::getVelocity(actor).y < 0.0f) { |
| 41 | al::startHitReaction(actor, name: "釣り取得" ); |
| 42 | al::setNerve(user: this, nerve: &Got); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | void CoinStateCountUp::exeGot() { |
| 47 | kill(); |
| 48 | } |
| 49 | |