Brunot
Loading...
Searching...
No Matches
ActionProxy.h
Go to the documentation of this file.
1// File: ActionProxy.h
2// Description: A component that holds all relevant actions to an entity (so when we copy, all actions carry over)
3// Author(s): Ori Balashov (ori.balashov@digipen.edu)
4// 2025 / 11 / 10
5// (C) Digipen 202
6// ____ __ __ __
7// /\__ _\/\ \ /\ \/\ \
8// \/_/\ \/\ \ \___ __ \ \ \_\ \ ___ __ __ ____ __
9// \ \ \ \ \ _ `\ /'__`\ \ \ _ \ / __`\/\ \/\ \ /',__\ /'__`\
10// \ \ \ \ \ \ \ \/\ __/ \ \ \ \ \/\ \L\ \ \ \_\ \/\__, `\/\ __/
11// \ \_\ \ \_\ \_\ \____\ \ \_\ \_\ \____/\ \____/\/\____/\ \____\
12// \/_/ \/_/\/_/\/____/ \/_/\/_/\/___/ \/___/ \/___/ \/____/
13
14#pragma once
15#include "Framework/Component.h"
16#include "Utility/Any_Action.h"
17
18class ActionProxy : public Component
19{
20public:
22 ActionProxy(const ActionProxy&) = default;
23 auto operator=(const ActionProxy&) -> ActionProxy& = default;
24 ~ActionProxy() override = default;
25 ActionProxy(ActionProxy&& other) noexcept = default;
26 auto operator=(ActionProxy&& other) noexcept -> ActionProxy& = default;
27
28 auto parentTo(GameObject* newParent) -> bool override;
29
30 auto clone() const -> std::unique_ptr<GameObject> override;
31 auto componentShowMenu() -> void override; // for debug ImGUI
32 auto onUpdate(float dt) -> void override;
33 auto endWindow() -> void override; // for debug ImGUI
34 auto onRender() -> void override;
35 auto load(Stream& stream) -> void override;
36 auto save(Stream& stream) const -> void override;
37
38 auto add(const std::weak_ptr<th::AnyAction>& newAction) -> void;
39
40private:
41 std::vector<std::weak_ptr<th::AnyAction>> allActions;
42};
sys::Json Stream
Definition AudioObject.h:20
The base class for components, holding all of their shared All components should inherit from this.
auto operator=(const ActionProxy &) -> ActionProxy &=default
std::vector< std::weak_ptr< th::AnyAction > > allActions
Definition ActionProxy.h:41
ActionProxy(ActionProxy &&other) noexcept=default
ActionProxy(const ActionProxy &)=default
auto operator=(ActionProxy &&other) noexcept -> ActionProxy &=default
ActionProxy()
Definition ActionProxy.cpp:20
auto add(const std::weak_ptr< th::AnyAction > &newAction) -> void
Definition ActionProxy.cpp:82
auto save(Stream &stream) const -> void override
Implementations will load the state of a GameObject to a th::Json object.
Definition ActionProxy.cpp:77
auto endWindow() -> void override
currently unused, but intended to but was assumed to be necessary for a proper ImGui editor
Definition ActionProxy.cpp:64
auto load(Stream &stream) -> void override
Implementations will load the state of a GameObject from a th::Json Object.
Definition ActionProxy.cpp:72
auto parentTo(GameObject *newParent) -> bool override
Sets the GameObject as a child of another GameObject.
Definition ActionProxy.cpp:25
auto clone() const -> std::unique_ptr< GameObject > override
makes a copy a GameObject even if it's held polymorphically
Definition ActionProxy.cpp:49
auto onUpdate(float dt) -> void override
called once every frame.
Definition ActionProxy.cpp:59
~ActionProxy() override=default
auto componentShowMenu() -> void override
Definition ActionProxy.cpp:54
auto onRender() -> void override
called every frame after update has been called for every object.
Definition ActionProxy.cpp:68
Component(ComponentTypeEnum type, const char *typeName)
Definition Component.cpp:72
GameObject(std::string typeName, gobj::Type parentType, gobj::Type type)
constructor for gameobject.
Definition GameObject.cpp:23
Definition Factory.cpp:59