| 1 | #include "Enemy/EnemyStateReviveInsideScreen.h" |
| 2 | |
| 3 | #include "Library/Action/ActorActionKeeper.h" |
| 4 | #include "Library/LiveActor/ActorActionFunction.h" |
| 5 | #include "Library/LiveActor/ActorClippingFunction.h" |
| 6 | #include "Library/LiveActor/ActorModelFunction.h" |
| 7 | #include "Library/LiveActor/ActorMovementFunction.h" |
| 8 | #include "Library/LiveActor/ActorPoseUtil.h" |
| 9 | #include "Library/LiveActor/LiveActor.h" |
| 10 | #include "Library/Nerve/NerveSetupUtil.h" |
| 11 | #include "Library/Nerve/NerveUtil.h" |
| 12 | #include "Library/Se/SeFunction.h" |
| 13 | |
| 14 | namespace { |
| 15 | NERVE_IMPL(EnemyStateReviveInsideScreen, Hide); |
| 16 | NERVE_IMPL(EnemyStateReviveInsideScreen, Delay); |
| 17 | NERVE_IMPL(EnemyStateReviveInsideScreen, AppearSign); |
| 18 | |
| 19 | NERVES_MAKE_NOSTRUCT(EnemyStateReviveInsideScreen, AppearSign); |
| 20 | NERVES_MAKE_STRUCT(EnemyStateReviveInsideScreen, Hide, Delay); |
| 21 | } // namespace |
| 22 | |
| 23 | EnemyStateReviveInsideScreen::EnemyStateReviveInsideScreen(al::LiveActor* actor) |
| 24 | : al::ActorStateBase("強制復活状態" , actor) { |
| 25 | initNerve(nerve: &NrvEnemyStateReviveInsideScreen.Hide, stateCount: 0); |
| 26 | al::calcQuat(quat: &mReviveQuat, actor); |
| 27 | mRevivePos.set(al::getTrans(actor)); |
| 28 | } |
| 29 | |
| 30 | void EnemyStateReviveInsideScreen::appear() { |
| 31 | al::NerveStateBase::appear(); |
| 32 | |
| 33 | if (al::isHideModel(actor: mActor)) { |
| 34 | mIsModelHidden = true; |
| 35 | } else { |
| 36 | al::hideModel(actor: mActor); |
| 37 | mIsModelHidden = false; |
| 38 | } |
| 39 | |
| 40 | if (al::isInvalidClipping(mActor)) { |
| 41 | mIsInvalidClipping = true; |
| 42 | } else { |
| 43 | al::invalidateClipping(actor: mActor); |
| 44 | mIsInvalidClipping = false; |
| 45 | } |
| 46 | |
| 47 | al::setVelocityZero(mActor); |
| 48 | mActor->getActorActionKeeper()->tryStartActionNoAnim(actionName: "ReviveInsideScreen" ); |
| 49 | if (mIsHidden) |
| 50 | al::setNerve(user: this, nerve: &NrvEnemyStateReviveInsideScreen.Hide); |
| 51 | else |
| 52 | al::setNerve(user: this, nerve: &NrvEnemyStateReviveInsideScreen.Delay); |
| 53 | } |
| 54 | |
| 55 | void EnemyStateReviveInsideScreen::kill() { |
| 56 | al::stopSe(mActor, "RevivalSign" , 0xFFFFFFFF, 0); |
| 57 | al::NerveStateBase::kill(); |
| 58 | if (!mIsModelHidden) |
| 59 | al::showModel(actor: mActor); |
| 60 | if (!mIsInvalidClipping) |
| 61 | al::validateClipping(actor: mActor); |
| 62 | } |
| 63 | |
| 64 | void EnemyStateReviveInsideScreen::startRevive() { |
| 65 | al::setNerve(user: this, nerve: &AppearSign); |
| 66 | } |
| 67 | |
| 68 | bool EnemyStateReviveInsideScreen::isDisappear() const { |
| 69 | return al::isNerve(user: this, nerve: &NrvEnemyStateReviveInsideScreen.Hide) || |
| 70 | al::isNerve(user: this, nerve: &NrvEnemyStateReviveInsideScreen.Delay); |
| 71 | } |
| 72 | |
| 73 | void EnemyStateReviveInsideScreen::exeHide() {} |
| 74 | |
| 75 | void EnemyStateReviveInsideScreen::exeDelay() { |
| 76 | al::setNerveAtGreaterEqualStep(user: this, nerve: &AppearSign, step: 150); |
| 77 | } |
| 78 | |
| 79 | void EnemyStateReviveInsideScreen::exeAppearSign() { |
| 80 | if (al::isFirstStep(user: this)) { |
| 81 | al::resetQuatPosition(actor: mActor, quat: mReviveQuat, trans: mRevivePos); |
| 82 | al::startAction(actor: mActor, actionName: "AppearSign" ); |
| 83 | } |
| 84 | if (al::isGreaterEqualStep(user: this, step: 150)) { |
| 85 | al::startHitReaction(actor: mActor, name: "出現" ); |
| 86 | kill(); |
| 87 | } |
| 88 | } |
| 89 | |