Engine
Frameworkcreatedbymeusableforthecreationofsimplegames.CurrentlysupportsOpenGL(Verysimple)andVulkan.
Component.cpp
Go to the documentation of this file.
3 
4 #include <ThirdParty/cereal/include/cereal/archives/binary.hpp>
5 #include <ThirdParty/cereal/include/cereal/archives/json.hpp>
6 
7 namespace Engine
8 {
9  eastl::weak_ptr<Entity> Component::GetOwner() const
10  {
11  return owner;
12  }
13 
15  {
16  }
17 
19  {
20  }
21 
23  {
24  }
25 
26  void Component::OnComponentAdded(eastl::weak_ptr<Component> addedComponent)
27  {
28  }
29 
30  void Component::OnComponentRemoved(eastl::weak_ptr<Component> removedComponent)
31  {
32  }
33 
34  eastl::vector<eastl::shared_ptr<Component>> Component::GetAllComponents() const
35  {
36  return owner.lock()->GetAllComponents();
37  }
38 
39  void Component::OnBeginContact(eastl::weak_ptr<Entity> entity)
40  {
41  }
42 
43  void Component::OnEndContact(eastl::weak_ptr<Entity> entity)
44  {
45  }
46 
47  eastl::weak_ptr<Component> Component::GetPointerRefence() const
48  {
49  return pointerReference;
50  }
51 
52  void Component::SetOwner(eastl::weak_ptr<Entity> owner)
53  {
54  this->owner = owner;
55  }
56 
57  void Component::SetPointerReference(eastl::weak_ptr<Component> pointerReference)
58  {
59  this->pointerReference = pointerReference;
60  }
61 
62  template <typename archive>
64  {
65  ar(CEREAL_NVP(this->isEnabled));
66  }
67 
68  template <typename archive>
70  {
71  ar(this->isEnabled);
72  }
73 } // namespace Engine
void SaveBaseComponent(archive ar)
Saves the data of this component to a archive (all derived classes have their own version...
Definition: Component.cpp:63
virtual void OnBeginContact(eastl::weak_ptr< Entity > entity)
Definition: Component.cpp:39
virtual void Update()
The update method of this component. NOTE: This method will not be called in case the entity is disab...
Definition: Component.cpp:22
virtual void InitializeComponent()
This method is used to initialize your component in. This method is called after the setting of the o...
Definition: Component.cpp:18
eastl::weak_ptr< Entity > GetOwner() const
This method allows you to get the entity holding this component.
Definition: Component.cpp:9
void LoadBaseComponent(archive ar)
loads the data from the archive to this component (all derived classes have their own version...
Definition: Component.cpp:69
eastl::vector< eastl::shared_ptr< Component > > GetAllComponents() const
Returns all the components of this entity.
Definition: Component.cpp:34
eastl::weak_ptr< Component > GetPointerRefence() const
This method allows you to get a direct refence to the weak pointer of this component.
Definition: Component.cpp:47
virtual void OnEndContact(eastl::weak_ptr< Entity > entity)
Definition: Component.cpp:43
virtual void OnComponentRemoved(eastl::weak_ptr< Component > removedComponent)
This method will be called whenever a component has been removed from the entity. ...
Definition: Component.cpp:30
virtual void OnComponentAdded(eastl::weak_ptr< Component > addedComponent)
This method will be called whenever a component has been added to the entity.
Definition: Component.cpp:26