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 /**
23 * @brief Re-activates the freeze event.
24 */
25 void freeze() {
26 mFrozen = true;
27 }
28
29 private:
30 bool isJoin(const ActorBase* actor) const override {
31 if ((... || (sead::DynamicCast<T>(actor) != nullptr))) {
32 return true;
33 }
34
35 return !mFrozen;
36 }
37
38 Result execute() override {
39 if (mFrozen)
40 return cResult_Keep;
41
42 return cResult_Exit;
43 }
44
45 private:
46 bool mFrozen = true;
47 };
48
49} // namespace red
Actor event that will pause execution of all actors except the ones specified in the whitelist.
Definition FreezeFrameEvent.h:13
void freeze()
Re-activates the freeze event.
Definition FreezeFrameEvent.h:25
void unfreeze()
Ends the freeze event and resumes execution of all actors.
Definition FreezeFrameEvent.h:18
Definition ActorDonutBlock.h:5