Terrain Engine 2D  1.10
A 2D Block Engine
TerrainEngine2D.ChunkLoader Class Reference

Handles chunk loading and unloading More...

Inheritance diagram for TerrainEngine2D.ChunkLoader:
TerrainEngine2D.MonoBehaviourSingleton< ChunkLoader >

Public Member Functions

delegate void ChunkAction ()
 Actions invoked by the ChunkLoader More...
 
void BeginChunkLoading ()
 Set the initial world coordinates and start loading chunks More...
 
void LoadChunk (int x, int y, bool unload=false, int unloadX=0, int unloadY=0)
 Loads and unloads chunks More...
 
void UpdateChunk (int x, int y, bool fluidChunk=false)
 Updates the chunk of a specified coordinate More...
 

Protected Member Functions

override void Awake ()
 

Properties

int ChunkSize [get, set]
 The size of the chunk in blocks (one side length) More...
 
int NumChunks [get]
 Number of chunks loaded in the scene More...
 
int MaxChunks [get]
 Max number of chunks that can be loaded at once More...
 
int LoadedWorldWidth [get]
 Width of the world loaded in chunks More...
 
int LoadedWorldHeight [get]
 Height of the world loaded in chunks More...
 
int HorizontalChunkLoadDist [get]
 Horizontal Chunk loading distance Horizontal distance from the center of the camera used to determine which Chunk column to load and unload More...
 
int VerticalChunkLoadDist [get]
 Vertical Chunk loading distance Vertical distance from the center of the camera used to determine which Chunk row to load and unload More...
 
Vector2 OriginLoadedChunks [get]
 Coordinates of the bottom left point of the current loaded world More...
 
Vector2 EndPointLoadedChunks [get]
 Coordinates of the top right point of the current loaded world More...
 
- Properties inherited from TerrainEngine2D.MonoBehaviourSingleton< ChunkLoader >
static T Instance [get]
 

Events

static ChunkAction OnChunksLoaded
 Event called when chunks have been loaded/unloaded More...
 

Detailed Description

Handles chunk loading and unloading

Member Function Documentation

◆ Awake()

override void TerrainEngine2D.ChunkLoader.Awake ( )
protectedvirtual

◆ BeginChunkLoading()

void TerrainEngine2D.ChunkLoader.BeginChunkLoading ( )

Set the initial world coordinates and start loading chunks

◆ ChunkAction()

delegate void TerrainEngine2D.ChunkLoader.ChunkAction ( )

Actions invoked by the ChunkLoader

◆ LoadChunk()

void TerrainEngine2D.ChunkLoader.LoadChunk ( int  x,
int  y,
bool  unload = false,
int  unloadX = 0,
int  unloadY = 0 
)

Loads and unloads chunks

Parameters
xX coordinate of chunk
yY coordinate of chunk
unloadUnload a chunk
unloadXX coordinate of the chunk to unload
unloadYY coordinate of the chunk to unload

All coordinates are in chunk units for indexing

◆ UpdateChunk()

void TerrainEngine2D.ChunkLoader.UpdateChunk ( int  x,
int  y,
bool  fluidChunk = false 
)

Updates the chunk of a specified coordinate

Parameters
xX coordinate
yY coordinate
fluidChunkWhether updating a fluid chunk or not

Input the position of a modified block

Property Documentation

◆ ChunkSize

int TerrainEngine2D.ChunkLoader.ChunkSize
getset

The size of the chunk in blocks (one side length)

◆ EndPointLoadedChunks

Vector2 TerrainEngine2D.ChunkLoader.EndPointLoadedChunks
get

Coordinates of the top right point of the current loaded world

◆ HorizontalChunkLoadDist

int TerrainEngine2D.ChunkLoader.HorizontalChunkLoadDist
get

Horizontal Chunk loading distance Horizontal distance from the center of the camera used to determine which Chunk column to load and unload

◆ LoadedWorldHeight

int TerrainEngine2D.ChunkLoader.LoadedWorldHeight
get

Height of the world loaded in chunks

◆ LoadedWorldWidth

int TerrainEngine2D.ChunkLoader.LoadedWorldWidth
get

Width of the world loaded in chunks

◆ MaxChunks

int TerrainEngine2D.ChunkLoader.MaxChunks
get

Max number of chunks that can be loaded at once

◆ NumChunks

int TerrainEngine2D.ChunkLoader.NumChunks
get

Number of chunks loaded in the scene

◆ OriginLoadedChunks

Vector2 TerrainEngine2D.ChunkLoader.OriginLoadedChunks
get

Coordinates of the bottom left point of the current loaded world

◆ VerticalChunkLoadDist

int TerrainEngine2D.ChunkLoader.VerticalChunkLoadDist
get

Vertical Chunk loading distance Vertical distance from the center of the camera used to determine which Chunk row to load and unload

Event Documentation

◆ OnChunksLoaded

ChunkAction TerrainEngine2D.ChunkLoader.OnChunksLoaded
static

Event called when chunks have been loaded/unloaded


The documentation for this class was generated from the following file: