| 1 | #include "MapObj/VolleyballBase.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 | namespace { |
| 9 | NERVE_IMPL(VolleyballBase, Wait); |
| 10 | NERVE_IMPL(VolleyballBase, Reaction); |
| 11 | |
| 12 | NERVES_MAKE_NOSTRUCT(VolleyballBase, Wait, Reaction); |
| 13 | } // namespace |
| 14 | |
| 15 | VolleyballBase::VolleyballBase(const char* name) : al::LiveActor(name) {} |
| 16 | |
| 17 | void VolleyballBase::init(const al::ActorInitInfo& initInfo) { |
| 18 | al::initActorWithArchiveName(actor: this, initInfo, archiveName: "VolleyballBase" , suffix: nullptr); |
| 19 | al::initNerve(actor: this, nerve: &Wait, maxStates: 0); |
| 20 | makeActorAlive(); |
| 21 | } |
| 22 | |
| 23 | void VolleyballBase::startReaction() { |
| 24 | al::setNerve(user: this, nerve: &Reaction); |
| 25 | } |
| 26 | |
| 27 | void VolleyballBase::exeWait() { |
| 28 | if (al::isFirstStep(user: this)) |
| 29 | al::startAction(actor: this, actionName: "Wait" ); |
| 30 | } |
| 31 | |
| 32 | void VolleyballBase::exeReaction() { |
| 33 | if (al::isFirstStep(user: this)) |
| 34 | al::startAction(actor: this, actionName: "Reaction" ); |
| 35 | |
| 36 | if (al::isActionEnd(actor: this)) |
| 37 | al::setNerve(user: this, nerve: &Wait); |
| 38 | } |
| 39 | |