| 1 | #include "Item/CoinCollectHintState.h" |
| 2 | |
| 3 | #include <math/seadVector.h> |
| 4 | |
| 5 | #include "Library/Camera/CameraUtil.h" |
| 6 | #include "Library/Effect/EffectSystemInfo.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(CoinCollectHintState, Wait); |
| 14 | |
| 15 | NERVES_MAKE_STRUCT(CoinCollectHintState, Wait); |
| 16 | } // namespace |
| 17 | |
| 18 | CoinCollectHintState::CoinCollectHintState(al::LiveActor* actor) |
| 19 | : al::ActorStateBase("ヒント状態" , actor) {} |
| 20 | |
| 21 | void CoinCollectHintState::init() { |
| 22 | initNerve(nerve: &NrvCoinCollectHintState.Wait, stateCount: 0); |
| 23 | } |
| 24 | |
| 25 | void CoinCollectHintState::appear() { |
| 26 | al::setNerve(user: this, nerve: &NrvCoinCollectHintState.Wait); |
| 27 | al::NerveStateBase::appear(); |
| 28 | appearHintEffect(); |
| 29 | } |
| 30 | |
| 31 | void CoinCollectHintState::kill() { |
| 32 | al::deleteEffect(mActor, "Emission" ); |
| 33 | al::NerveStateBase::kill(); |
| 34 | } |
| 35 | |
| 36 | void CoinCollectHintState::deleteHintEffect() { |
| 37 | al::tryKillEmitterAndParticleAll(mActor); |
| 38 | } |
| 39 | |
| 40 | void CoinCollectHintState::appearHintEffect() { |
| 41 | al::emitEffect(mActor, "Emission" , nullptr); |
| 42 | } |
| 43 | |
| 44 | void CoinCollectHintState::exeWait() { |
| 45 | al::LiveActor* actor = mActor; |
| 46 | sead::Vector3f cameraDiff = al::getCameraPos(user: actor, viewIdx: 0) - al::getTrans(actor); |
| 47 | f32 distanceToCamera = cameraDiff.length(); |
| 48 | if (distanceToCamera > 3500.0f) { |
| 49 | f32 scale = distanceToCamera / 3500.0f; |
| 50 | al::setEffectAllScale(actor, "Emission" , sead::Vector3f{scale, scale, scale}); |
| 51 | } |
| 52 | } |
| 53 | |