Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ChunkMap.h"
- #include "ChunkData.h"
- #include "Region.h"
- void ChunkMap::onCreate()
- {
- }
- void ChunkMap::onDestroy()
- {
- }
- Chunk* ChunkMap::getChunk(const Vec2i& aCoords)
- {
- Vec2i regionCoords = ChunkConstants::chunkToRegion(aCoords);
- for(uint i = 0; i < mRegions.size(); i++)
- {
- if(mRegions[i]->getCoords() == regionCoords)
- {
- return mRegions[i]->getChunk(aCoords);
- }
- }
- Region* region = GetFramework()->createGameObject()->addComponent<Region>();
- region->setCoords(regionCoords);
- mRegions.push_back(region);
- return region->getChunk(aCoords);
- }
- Chunk* ChunkMap::findChunk(const Vec2i& aCoords)
- {
- Vec2i regionCoords = ChunkConstants::chunkToRegion(aCoords);
- for(uint i = 0; i < mRegions.size(); i++)
- {
- if(mRegions[i]->getCoords() == regionCoords)
- {
- return mRegions[i]->findChunk(aCoords);
- }
- }
- return nullptr;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement