-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameObject.h
53 lines (37 loc) · 1.32 KB
/
GameObject.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
#include "Component.h"
#include "RayHit.h"
#include "MathGeoLib.h"
#include <vector>
#include <string>
#include <list>
class ComponentCamera;
class JSON_file;
class GameObject
{
public:
GameObject(const char* name, GameObject* parent = nullptr);
GameObject(GameObject& game_obj);
GameObject(); // empty constructor! Load MUST be called afterwards
~GameObject();
Component* FindComponent(Component_type type);
std::vector<Component*> FindComponents(Component_type type);
GameObject* FindChild(const char* name);
void Update(float dt);
void Draw();
bool Cull(ComponentCamera* cam);
void HierarchyTree(std::string& selected_obj_uid);
void RayCastAgainstAABBs(Ray ray, std::list<RayHit>& outHits);
void RayCastAgainstMeshes(Ray ray, std::list<RayHit>& outHits); // not recursive
void Save(JSON_file& save_file, uint& obj_index);
void Load(JSON_file& save_file, uint& obj_index);
void FindParent(std::vector<GameObject*>& objects);
public:
GameObject* parent = nullptr;
std::string name; // scene saved variable
std::string uid; // scene saved variable
std::string parent_uid; // scene saved variable
std::vector<Component*> components; // scene saved variable
std::vector<GameObject*> children; // scene saved variable
bool enabled = true; // scene saved variable
};