RedCore
Loading...
Searching...
No Matches
FreezeFrameEvent.h
Go to the documentation of this file.
1#pragma once
2
3#include <event/EventBase.h>
4
5namespace red {
6
7 /**
8 * @brief Actor event that will pause execution of all actors except the ones specified in the whitelist.
9 * @tparam T Actor types to be whitelisted. These will continue execution.
10 * @details Push this to @ref EventMgr to freeze, then call @c unfreeze() to end the event.
11 */
12 template <typename... T>
13 class FreezeFrameEvent : public EventBase {
14 public:
15 /**
16 * @brief Ends the freeze event and resumes execution of all actors.
17 */
18 void unfreeze() {
19 mFrozen = false;
20 }
21
22 private:
23 bool isJoin(const ActorBase* actor) const override {
24 if ((... || (sead::DynamicCast<T>(actor) != nullptr))) {
25 return true;
26 }
27
28 return !mFrozen;
29 }
30
31 Result execute() override {
32 if (mFrozen)
33 return cResult_Keep;
34
35 return cResult_Exit;
36 }
37
38 private:
39 bool mFrozen = true;
40 };
41
42} // namespace red
Actor event that will pause execution of all actors except the ones specified in the whitelist.
Definition FreezeFrameEvent.h:13
void unfreeze()
Ends the freeze event and resumes execution of all actors.
Definition FreezeFrameEvent.h:18
Definition ActorDonutBlock.h:5