Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // GameObject.h
- #pragma once
- class CGameObject : public CAVEvents
- {
- public:
- std::string name;
- std::string tag;
- int id;
- NativeArray<CComponent>* components;
- CGameObject* gameObject;
- public:
- CGameObject();
- void OnUpdate() override;
- ~CGameObject();
- public:
- };
- // GameObject.cpp
- #include "AVEvents.h"
- #include <string>
- #include "AVEM.h"
- #include "Component.h"
- #include "GameObject.h"
- CGameObject::CGameObject()
- {
- name = "Obejct";
- tag = "Default";
- gameObject = this;
- components = new NativeArray<CComponent>();
- id = 0;
- }
- void CGameObject::OnUpdate()
- {
- }
- CGameObject::~CGameObject()
- {
- }
- // Component.h
- #pragma once
- class CComponent
- {
- public:
- CGameObject* gameObject;
- public:
- CComponent()
- {
- }
- template<class T>
- static T* AddComponent();
- ~CComponent()
- {
- }
- };
- // Component.cpp
- #include "GameObject.h"
- #include "Component.h"
- template <class T>
- T* CComponent::AddComponent()
- {
- T* ptr = new (T);
- return ptr;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement