| 1 | #include "Boss/BossForest/BossForestWander.h" |
| 2 | |
| 3 | #include "Library/KeyPose/KeyPoseKeeper.h" |
| 4 | #include "Library/KeyPose/KeyPoseKeeperUtil.h" |
| 5 | #include "Library/LiveActor/ActorActionFunction.h" |
| 6 | #include "Library/LiveActor/ActorInitUtil.h" |
| 7 | #include "Library/LiveActor/ActorPoseUtil.h" |
| 8 | #include "Library/LiveActor/LiveActorFunction.h" |
| 9 | #include "Library/Nerve/NerveSetupUtil.h" |
| 10 | #include "Library/Nerve/NerveUtil.h" |
| 11 | #include "Library/Se/SeFunction.h" |
| 12 | #include "Library/Stage/StageSwitchUtil.h" |
| 13 | |
| 14 | namespace { |
| 15 | NERVE_HOST_TYPE_IMPL(BossForestWander, WaitSwitchStart) |
| 16 | NERVE_HOST_TYPE_IMPL(BossForestWander, Wait) |
| 17 | NERVE_HOST_TYPE_IMPL(BossForestWander, Move) |
| 18 | NERVE_HOST_TYPE_IMPL(BossForestWander, End) |
| 19 | |
| 20 | NERVES_MAKE_NOSTRUCT(HostType, WaitSwitchStart, Move) |
| 21 | NERVES_MAKE_STRUCT(HostType, Wait, End) |
| 22 | } // namespace |
| 23 | |
| 24 | BossForestWander::BossForestWander(const char* name) : LiveActor(name) {} |
| 25 | |
| 26 | void BossForestWander::init(const al::ActorInitInfo& info) { |
| 27 | al::initActorWithArchiveName(actor: this, initInfo: info, archiveName: "BossForest" , suffix: "Wander" ); |
| 28 | al::initNerve(actor: this, nerve: &WaitSwitchStart, maxStates: 0); |
| 29 | |
| 30 | al::tryGetQuatPtr(actor: this); |
| 31 | |
| 32 | mKeyPoseKeeper = al::createKeyPoseKeeper(info); |
| 33 | mKeyPoseKeeper->setMoveTypeStop(); |
| 34 | al::setKeyMoveClippingInfo(this, &mClippingRadius, mKeyPoseKeeper); |
| 35 | |
| 36 | al::startActionSubActor(actor: this, subActorName: "ライフパーツ00" , action: "WaitOn" ); |
| 37 | al::startActionSubActor(actor: this, subActorName: "ライフパーツ01" , action: "WaitOn" ); |
| 38 | al::startActionSubActor(actor: this, subActorName: "ライフパーツ02" , action: "WaitOn" ); |
| 39 | |
| 40 | al::trySyncStageSwitchAppear(actor: this); |
| 41 | } |
| 42 | |
| 43 | void BossForestWander::exeWaitSwitchStart() { |
| 44 | if (al::isFirstStep(user: this)) |
| 45 | al::startAction(actor: this, actionName: "Wait" ); |
| 46 | if (!al::isValidSwitchStart(user: this) || al::isOnSwitchStart(user: this)) |
| 47 | al::setNerve(user: this, nerve: &NrvHostType.Wait); |
| 48 | } |
| 49 | |
| 50 | void BossForestWander::exeWait() { |
| 51 | if (al::isFirstStep(user: this)) { |
| 52 | s32 waitTime = al::calcKeyMoveWaitTime(keyPoseKeeper: mKeyPoseKeeper); |
| 53 | if (waitTime >= 0) |
| 54 | mWaitTime = waitTime; |
| 55 | } |
| 56 | if (al::isGreaterEqualStep(user: this, step: mWaitTime)) { |
| 57 | if (!al::checkIsPlayingSe(this, "PgSenario2StartMove" , nullptr)) |
| 58 | al::tryStartSe(this, "PgSenario2StartMove" ); |
| 59 | al::setNerve(user: this, nerve: &Move); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | void BossForestWander::exeMove() { |
| 64 | if (al::isFirstStep(user: this)) |
| 65 | mMoveTime = al::calcKeyMoveMoveTime(keyPoseKeeper: mKeyPoseKeeper); |
| 66 | |
| 67 | f32 rate = al::calcNerveRate(user: this, max: mMoveTime); |
| 68 | al::calcLerpKeyTrans(out: al::getTransPtr(actor: this), keyPoseKeeper: mKeyPoseKeeper, rate); |
| 69 | al::calcSlerpKeyQuat(out: al::getQuatPtr(actor: this), keyPoseKeeper: mKeyPoseKeeper, rate); |
| 70 | |
| 71 | if (al::isGreaterEqualStep(user: this, step: mMoveTime)) { |
| 72 | al::nextKeyPose(keyPoseKeeper: mKeyPoseKeeper); |
| 73 | if (al::isStop(keyPoseKeeper: mKeyPoseKeeper)) |
| 74 | al::setNerve(user: this, nerve: &NrvHostType.End); |
| 75 | else |
| 76 | al::setNerve(user: this, nerve: &NrvHostType.Wait); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | void BossForestWander::exeEnd() { |
| 81 | kill(); |
| 82 | } |
| 83 | |