| 1 | #include "Item/ShineTowerKey.h" |
| 2 | |
| 3 | #include "Library/LiveActor/ActorActionFunction.h" |
| 4 | #include "Library/LiveActor/ActorInitUtil.h" |
| 5 | #include "Library/Nerve/NerveSetupUtil.h" |
| 6 | #include "Library/Nerve/NerveUtil.h" |
| 7 | |
| 8 | #include "System/GameDataFunction.h" |
| 9 | #include "Util/SensorMsgFunction.h" |
| 10 | |
| 11 | namespace { |
| 12 | NERVE_IMPL(ShineTowerKey, Wait) |
| 13 | NERVES_MAKE_NOSTRUCT(ShineTowerKey, Wait) |
| 14 | } // namespace |
| 15 | |
| 16 | ShineTowerKey::ShineTowerKey(const char* name) : al::LiveActor(name) {} |
| 17 | |
| 18 | void ShineTowerKey::init(const al::ActorInitInfo& info) { |
| 19 | al::initActorWithArchiveName(actor: this, initInfo: info, archiveName: "ShineTowerKey" , suffix: nullptr); |
| 20 | al::initNerve(actor: this, nerve: &Wait, maxStates: 0); |
| 21 | makeActorAlive(); |
| 22 | } |
| 23 | |
| 24 | bool ShineTowerKey::receiveMsg(const al::SensorMsg* message, al::HitSensor* other, |
| 25 | al::HitSensor* self) { |
| 26 | if (rs::isMsgItemGetAll(message)) { |
| 27 | GameDataFunction::addKey(writer: this, count: 1); |
| 28 | al::startHitReaction(actor: this, name: "取得" ); |
| 29 | kill(); |
| 30 | return true; |
| 31 | } |
| 32 | return false; |
| 33 | } |
| 34 | |
| 35 | void ShineTowerKey::exeWait() { |
| 36 | if (al::isFirstStep(user: this)) |
| 37 | al::startAction(actor: this, actionName: "Wait" ); |
| 38 | } |
| 39 | |