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
12namespace {
13NERVE_IMPL(CoinCollectHintState, Wait);
14
15NERVES_MAKE_STRUCT(CoinCollectHintState, Wait);
16} // namespace
17
18CoinCollectHintState::CoinCollectHintState(al::LiveActor* actor)
19 : al::ActorStateBase("ヒント状態", actor) {}
20
21void CoinCollectHintState::init() {
22 initNerve(nerve: &NrvCoinCollectHintState.Wait, stateCount: 0);
23}
24
25void CoinCollectHintState::appear() {
26 al::setNerve(user: this, nerve: &NrvCoinCollectHintState.Wait);
27 al::NerveStateBase::appear();
28 appearHintEffect();
29}
30
31void CoinCollectHintState::kill() {
32 al::deleteEffect(mActor, "Emission");
33 al::NerveStateBase::kill();
34}
35
36void CoinCollectHintState::deleteHintEffect() {
37 al::tryKillEmitterAndParticleAll(mActor);
38}
39
40void CoinCollectHintState::appearHintEffect() {
41 al::emitEffect(mActor, "Emission", nullptr);
42}
43
44void 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