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
12namespace {
13NERVE_IMPL(CoinStateCountUp, CountUp);
14NERVE_IMPL(CoinStateCountUp, Got);
15
16NERVES_MAKE_NOSTRUCT(CoinStateCountUp, CountUp, Got);
17} // namespace
18
19CoinStateCountUp::CoinStateCountUp(al::LiveActor* actor)
20 : ActorStateBase("カウントアップ状態", actor) {
21 initNerve(nerve: &CountUp, stateCount: 0);
22}
23
24void CoinStateCountUp::appear() {
25 al::NerveStateBase::appear();
26 al::setNerve(user: this, nerve: &CountUp);
27}
28
29void 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
46void CoinStateCountUp::exeGot() {
47 kill();
48}
49