TazGraph Project v0.1.0
Loading...
Searching...
No Matches
GECSEntityTypesEmpty.h
1#pragma once
2
3#include "./GECSEntityTypes.h"
4
5class Empty : public EmptyEntity {
6
7public:
8
9 Empty(Manager& mManager) : EmptyEntity(mManager) {
10
11 }
12
13 void addToGroup(Group mGroup) override {
14 Entity::addToGroup(mGroup);
15 manager.AddToGroup(this, mGroup);
16 }
17
18 void removeGroup(Group mGroup) override {
19 Entity::removeGroup(mGroup);
20 manager.aboutTo_updateActiveEntities();
21 }
22
23 virtual ~Empty() {
24
25 }
26
27 void update(float deltaTime)
28 {
29 ZoneScoped;
30
31 //cellUpdate();
32
33 Entity::update(deltaTime);
34 }
35
36 void cellUpdate() override {
37 if (this->ownerCell) {
38 Cell* newCell = manager.grid->getCell(*this, manager.grid->getGridLevel());
39 if (newCell != this->ownerCell) {
40 // Need to shift the entity
41 removeFromCell();
42 manager.grid->addEmpty(this, newCell);
43 }
44 }
45 }
46
47
48
49 void imgui_print() override {
50 glm::vec2 position = this->GetComponent<TransformComponent>().getPosition(); // Make sure Entity class has a getPosition method
51 ImGui::Text("TazPosition: (%.2f, %.2f)", position.x, position.y);
52 }
53
54 void destroy() {
55 Entity::destroy();
56 manager.aboutTo_updateActiveEntities(); //? cant have it at destroy in baseclass
57 // may need to also update Visible Entities
58 }
59};
Definition GECSEntity.h:7
Definition GECSEntityTypesEmpty.h:5
Manager & manager
the object doesnt move, so we can have pointer
Definition GECS.h:241
Definition GECSManager.h:20
Definition CellEntity.h:6