-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Can now get entity collisions by tag - Fixed bug with setting tags in python script - Added rough ease functions (not ready to be used!)
- Loading branch information
Showing
13 changed files
with
381 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"version": "0.43.0" | ||
"version": "0.44.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#pragma once | ||
|
||
#include <set> | ||
#include <unordered_map> | ||
|
||
#include "entity.h" | ||
|
||
class EntityTagCache { | ||
public: | ||
void AddEntityTags(Entity entity, const std::vector<std::string> tags) { | ||
for (const std::string& tag : tags) { | ||
if (!HasTag(tag)) { | ||
entityTagCache.emplace(tag, std::set<Entity> {}); | ||
} | ||
entityTagCache[tag].insert(entity); | ||
} | ||
} | ||
|
||
void RemoveEntityTags(Entity entity, const std::vector<std::string> tags) { | ||
for (const std::string& tag : tags) { | ||
if (HasTag(tag)) { | ||
entityTagCache[tag].erase(entity); | ||
} | ||
} | ||
} | ||
|
||
bool HasTag(const std::string& tag) { | ||
return entityTagCache.count(tag) > 0; | ||
} | ||
|
||
std::set<Entity> GetTaggedEntities(const std::string& tag) { | ||
if (HasTag(tag)) { | ||
return entityTagCache[tag]; | ||
} | ||
return {}; | ||
} | ||
private: | ||
std::unordered_map<std::string, std::set<Entity>> entityTagCache = {}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.