|
| 1 | +#include "Item/ItemAppearanceController.h" |
| 2 | + |
| 3 | +#include "Library/Item/ItemUtil.h" |
| 4 | +#include "Library/LiveActor/ActorActionFunction.h" |
| 5 | +#include "Library/LiveActor/ActorInitUtil.h" |
| 6 | +#include "Library/Nerve/NerveSetupUtil.h" |
| 7 | +#include "Library/Nerve/NerveUtil.h" |
| 8 | + |
| 9 | +#include "Util/ItemUtil.h" |
| 10 | + |
| 11 | +namespace { |
| 12 | +NERVE_HOST_TYPE_IMPL(ItemAppearanceController, Wait) |
| 13 | +NERVE_HOST_TYPE_IMPL(ItemAppearanceController, Appear) |
| 14 | +NERVE_HOST_TYPE_IMPL(ItemAppearanceController, Count) |
| 15 | +NERVE_HOST_TYPE_IMPL(ItemAppearanceController, Done) |
| 16 | + |
| 17 | +NERVES_MAKE_STRUCT(HostType, Wait, Count) |
| 18 | +NERVES_MAKE_NOSTRUCT(HostType, Appear, Done) |
| 19 | +} // namespace |
| 20 | + |
| 21 | +ItemAppearanceController::ItemAppearanceController(al::LiveActor* actor, s32 appearTime) |
| 22 | + : al::NerveExecutor("アイテム出現制御"), mActor(actor), mAppearTime(appearTime) { |
| 23 | + initNerve(&NrvHostType.Wait, 0); |
| 24 | +} |
| 25 | + |
| 26 | +bool ItemAppearanceController::requestAppear(const al::SensorMsg* message, |
| 27 | + const al::HitSensor* hitSensor) { |
| 28 | + if (al::isNerve(this, &NrvHostType.Wait)) { |
| 29 | + rs::setAppearItemFactorAndOffsetByMsg(mActor, message, hitSensor); |
| 30 | + al::setNerve(this, &NrvHostType.Count); |
| 31 | + return true; |
| 32 | + } |
| 33 | + return false; |
| 34 | +} |
| 35 | + |
| 36 | +void ItemAppearanceController::exeWait() {} |
| 37 | + |
| 38 | +void ItemAppearanceController::exeCount() { |
| 39 | + if (al::isGreaterEqualStep(this, mAppearTime)) |
| 40 | + al::setNerve(this, &Appear); |
| 41 | +} |
| 42 | + |
| 43 | +void ItemAppearanceController::exeAppear() { |
| 44 | + al::appearItem(mActor); |
| 45 | + al::setNerve(this, &Done); |
| 46 | +} |
| 47 | + |
| 48 | +void ItemAppearanceController::exeDone() {} |
0 commit comments