| 1 | #include "Amiibo/ItemAmiiboKoopa.h" |
| 2 | |
| 3 | #include "Library/LiveActor/ActorActionFunction.h" |
| 4 | #include "Library/LiveActor/ActorInitUtil.h" |
| 5 | #include "Library/LiveActor/ActorPoseUtil.h" |
| 6 | #include "Library/LiveActor/ActorSensorUtil.h" |
| 7 | #include "Library/LiveActor/LiveActor.h" |
| 8 | #include "Library/Nerve/NerveSetupUtil.h" |
| 9 | #include "Library/Nerve/NerveUtil.h" |
| 10 | |
| 11 | #include "Util/PlayerUtil.h" |
| 12 | #include "Util/SensorMsgFunction.h" |
| 13 | |
| 14 | namespace { |
| 15 | NERVE_IMPL(ItemAmiiboKoopa, Wait); |
| 16 | NERVE_IMPL(ItemAmiiboKoopa, Expand); |
| 17 | |
| 18 | NERVES_MAKE_STRUCT(ItemAmiiboKoopa, Wait, Expand); |
| 19 | } // namespace |
| 20 | |
| 21 | ItemAmiiboKoopa::ItemAmiiboKoopa(const char* actorName) : al::LiveActor(actorName) {} |
| 22 | |
| 23 | void ItemAmiiboKoopa::init(const al::ActorInitInfo& info) { |
| 24 | al::initActorWithArchiveName(actor: this, initInfo: info, archiveName: "ItemAmiiboKoopa" , suffix: nullptr); |
| 25 | al::initNerve(actor: this, nerve: &NrvItemAmiiboKoopa.Wait, maxStates: 0); |
| 26 | makeActorDead(); |
| 27 | } |
| 28 | |
| 29 | void ItemAmiiboKoopa::appear() { |
| 30 | al::LiveActor::appear(); |
| 31 | al::setNerve(user: this, nerve: &NrvItemAmiiboKoopa.Wait); |
| 32 | al::startHitReaction(actor: this, name: "出現" ); |
| 33 | } |
| 34 | |
| 35 | void ItemAmiiboKoopa::exeExpand() { |
| 36 | al::setSensorRadius(this, al::getNerveStep(user: this) / 30.0f * 1000.0f); |
| 37 | al::setTrans(actor: this, trans: rs::getPlayerPos(this)); |
| 38 | if (al::isGreaterEqualStep(user: this, step: 30)) |
| 39 | al::setNerve(user: this, nerve: &NrvItemAmiiboKoopa.Wait); |
| 40 | } |
| 41 | |
| 42 | void ItemAmiiboKoopa::exeWait() { |
| 43 | if (al::isGreaterEqualStep(user: this, step: 300)) { |
| 44 | kill(); |
| 45 | return; |
| 46 | } |
| 47 | |
| 48 | al::setTrans(actor: this, trans: rs::getPlayerPos(this)); |
| 49 | } |
| 50 | |
| 51 | void ItemAmiiboKoopa::attackSensor(al::HitSensor* self, al::HitSensor* other) { |
| 52 | rs::sendMsgItemAmiiboKoopa(source: other, target: self); |
| 53 | } |
| 54 | |