1#include "Library/MapObj/FixMapParts.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/Placement/PlacementFunction.h"
9#include "Library/Stage/StageSwitchUtil.h"
10
11namespace al {
12FixMapParts::FixMapParts(const char* name) : LiveActor(name) {}
13
14void FixMapParts::init(const ActorInitInfo& info) {
15 const char* suffix = nullptr;
16 tryGetStringArg(arg: &suffix, initInfo: info, key: "Suffix");
17 initMapPartsActor(actor: this, initInfo: info, suffix);
18 trySyncStageSwitchAppearAndKill(actor: this);
19 registActorToDemoInfo(actor: this, initInfo: info);
20
21 if (getModelKeeper() != nullptr && !isExistAction(actor: this) && !isViewDependentModel(actor: this))
22 mIsStatic = true;
23}
24
25void FixMapParts::appear() {
26 LiveActor::appear();
27
28 if (isExistModel(actor: this))
29 tryStartAction(actor: this, actionName: "Appear");
30}
31
32void FixMapParts::movement() {
33 if (!mIsStatic)
34 LiveActor::movement();
35}
36
37void FixMapParts::calcAnim() {
38 if (!mIsStatic)
39 LiveActor::calcAnim();
40 else
41 calcViewModel(actor: this);
42}
43
44bool FixMapParts::receiveMsg(const SensorMsg* message, HitSensor* other, HitSensor* self) {
45 if (isMsgAskSafetyPoint(msg: message))
46 return !isValidSwitchAppear(user: this) && !isValidSwitchKill(user: this);
47
48 if (isMsgShowModel(msg: message)) {
49 showModelIfHide(actor: this);
50 return true;
51 }
52
53 if (isMsgHideModel(msg: message)) {
54 hideModelIfShow(actor: this);
55 return true;
56 }
57
58 return false;
59}
60} // namespace al
61