CSEngine
Loading...
Searching...
No Matches
SComponent.h
1#pragma once
2
3#include "../SObject.h"
4#include <string>
5#include <map>
6#include <utility>
7#include "../Object/SGameObject.h"
8#include "SISComponent.h"
9#include "../Util/ComponentDef.h"
10#include "../Util/VariableBinder.h"
11
12
13namespace CSE {
14
15 class SGameObject;
16
17 class SComponent : public SObject, public virtual SISComponent, public VariableBinder {
18 public:
19
20 explicit SComponent(std::string classType, SGameObject* gameObject) : m_classType(std::move(classType)),
21 gameObject(gameObject) {
22 }
23
24 SComponent(const SComponent& src) : SISComponent(src) {
25 gameObject = src.gameObject;
26 isEnable = src.isEnable;
27 m_classType = src.m_classType;
28 }
29
30
31 ~SComponent() override = default;
32
33 void Start() override {}
34
35 virtual SComponent* Clone(SGameObject* object) {
36 return nullptr;
37 }
38
39 virtual void CopyReference(SComponent* src, std::map<SGameObject*, SGameObject*> lists_obj,
40 std::map<SComponent*, SComponent*> lists_comp) {}
41
42 virtual auto GetComponent() -> SObject* {
43 return this;
44 }
45
46 void SetValue(std::string name_str, Arguments value) override {}
47
48 std::string PrintValue() const override { return {}; }
49
50 void SetGameObject(SGameObject* object) {
51 gameObject = object;
52 }
53
54 virtual SGameObject* GetGameObject() const {
55 return gameObject;
56 }
57
58
59 virtual bool GetIsEnable() const {
60 return isEnable;
61 }
62
63
64 virtual void SetIsEnable(bool is_enable) {
65 isEnable = is_enable;
66 }
67
68 std::string GetClassType() const {
69 return m_classType;
70 }
71
72 void SetClassType(std::string type) {
73 m_classType = std::move(type);
74 }
75
76 protected:
77 SGameObject* gameObject = nullptr;
78 bool isEnable = true;
79
80 std::string m_classType;
81
82 };
83
84}