| 1 | #include "Library/Fluid/FlowMapParts.h" |
| 2 | |
| 3 | #include "Library/Demo/DemoFunction.h" |
| 4 | #include "Library/LiveActor/ActorActionFunction.h" |
| 5 | #include "Library/LiveActor/ActorInitUtil.h" |
| 6 | #include "Library/LiveActor/ActorModelFunction.h" |
| 7 | #include "Library/LiveActor/ActorSensorUtil.h" |
| 8 | #include "Library/LiveActor/LiveActor.h" |
| 9 | #include "Library/Placement/PlacementFunction.h" |
| 10 | #include "Library/Stage/StageSwitchUtil.h" |
| 11 | #include "Project/Fluid/FlowMapCtrl.h" |
| 12 | |
| 13 | namespace al { |
| 14 | FlowMapParts::FlowMapParts(const char* name) : LiveActor(name) {} |
| 15 | |
| 16 | void FlowMapParts::init(const ActorInitInfo& info) { |
| 17 | const char* suffix = nullptr; |
| 18 | tryGetStringArg(arg: &suffix, initInfo: info, key: "Suffix" ); |
| 19 | initMapPartsActor(actor: this, initInfo: info, suffix); |
| 20 | |
| 21 | s32 interval = 60; |
| 22 | f32 speed = 1.0f; |
| 23 | tryGetArg(arg: &interval, initInfo: info, key: "Interval" ); |
| 24 | tryGetArg(arg: &speed, initInfo: info, key: "Speed" ); |
| 25 | |
| 26 | trySyncStageSwitchAppearAndKill(actor: this); |
| 27 | registActorToDemoInfo(actor: this, initInfo: info); |
| 28 | if (getModelKeeper() && !isExistAction(actor: this) && !isViewDependentModel(actor: this)) |
| 29 | mIsStatic = true; |
| 30 | |
| 31 | mFlowMapCtrl = new FlowMapCtrl(this); |
| 32 | mFlowMapCtrl->init(interval, speed); |
| 33 | } |
| 34 | |
| 35 | void FlowMapParts::appear() { |
| 36 | LiveActor::appear(); |
| 37 | tryStartAction(actor: this, actionName: "Appear" ); |
| 38 | } |
| 39 | |
| 40 | void FlowMapParts::movement() { |
| 41 | mFlowMapCtrl->update(); |
| 42 | if (mIsStatic) |
| 43 | return; |
| 44 | LiveActor::movement(); |
| 45 | } |
| 46 | |
| 47 | void FlowMapParts::calcAnim() { |
| 48 | if (mIsStatic) { |
| 49 | calcViewModel(actor: this); |
| 50 | return; |
| 51 | } |
| 52 | LiveActor::calcAnim(); |
| 53 | } |
| 54 | |
| 55 | bool FlowMapParts::receiveMsg(const SensorMsg* message, HitSensor* other, HitSensor* self) { |
| 56 | if (isMsgAskSafetyPoint(msg: message)) { |
| 57 | if (isValidSwitchAppear(user: this)) |
| 58 | return false; |
| 59 | if (isValidSwitchKill(user: this)) |
| 60 | return false; |
| 61 | return true; |
| 62 | } |
| 63 | |
| 64 | if (isMsgShowModel(msg: message)) { |
| 65 | showModelIfHide(actor: this); |
| 66 | return true; |
| 67 | } |
| 68 | |
| 69 | if (isMsgHideModel(msg: message)) { |
| 70 | hideModelIfShow(actor: this); |
| 71 | return true; |
| 72 | } |
| 73 | |
| 74 | return false; |
| 75 | } |
| 76 | |
| 77 | } // namespace al |
| 78 | |