C# Class VoxelGame.Core.Logic.World

显示文件 Open project: pershingthesecond/VoxelGame Class Usage Examples

Private Properties

Property Type Description
GetBlock BlockInstance?
GetContent System
GetLiquid LiquidInstance?
ModifyLiquid void
ModifyWorldData void
RetrieveContent void
SetBlock void
SetContent void
SetContent void
SetLiquid void
SetPosition void
Setup void
World System

Public Methods

Method Description
Dispose ( ) : void

Dispose of the world.

DoRandomUpdate ( Vector3i position ) : bool

Force a random update at a position.

FinishAll ( ) : Task

Wait for all world tasks to finish.

GetSpawnPosition ( ) : Vector3

Get the spawn position of this world.

Save ( ) : Task

Saves all active chunks that are not currently saved.

SetDefaultBlock ( Vector3i position ) : void

Set a position to the default block.

SetDefaultLiquid ( Vector3i position ) : void

Set a position to the default liquid.

SetSpawnPosition ( Vector3 position ) : void

Sets the spawn position of this world.

Update ( float deltaTime ) : void

Called every update cycle.

Protected Methods

Method Description
AddAllTasks ( List tasks ) : void

Add all tasks to the list. This is used to wait for all tasks to finish when calling FinishAll.

Dispose ( bool disposing ) : void

Dispose of the world.

ProcessChangedSection ( VoxelGame.Core.Logic.Chunk chunk, Vector3i position ) : void

Process that a section was changed.

World ( VoxelGame.Core.Logic.WorldInformation information, string path ) : System

This constructor is meant for worlds that already exist.

World ( string name, string path, int seed ) : System

This constructor is meant for worlds that are new.

Private Methods

Method Description
GetBlock ( Vector3i position ) : BlockInstance?
GetContent ( Vector3i position ) : System
GetLiquid ( Vector3i position ) : LiquidInstance?
ModifyLiquid ( bool isStatic, Vector3i position ) : void
ModifyWorldData ( Vector3i position, uint clearMask, uint addMask ) : void
RetrieveContent ( Vector3i position, Block? &block, uint &data, Liquid? &liquid, LiquidLevel &level, bool &isStatic ) : void
SetBlock ( BlockInstance block, Vector3i position ) : void
SetContent ( Block block, uint data, VoxelGame.Core.Logic.Liquid liquid, LiquidLevel level, bool isStatic, Vector3i position, bool tickLiquid ) : void
SetContent ( BlockInstance block, LiquidInstance liquid, Vector3i position, bool tickLiquid ) : void
SetLiquid ( LiquidInstance liquid, Vector3i position ) : void
SetPosition ( Block block, uint data, VoxelGame.Core.Logic.Liquid liquid, LiquidLevel level, bool isStatic, Vector3i position ) : void
Setup ( ) : void
World ( VoxelGame.Core.Logic.WorldInformation information, string worldDirectory, string chunkDirectory, IWorldGenerator generator ) : System

Setup of readonly fields and non-optional steps.

Method Details

AddAllTasks() protected method

Add all tasks to the list. This is used to wait for all tasks to finish when calling FinishAll.
protected AddAllTasks ( List tasks ) : void
tasks List The task list.
return void

Dispose() public method

Dispose of the world.
public Dispose ( ) : void
return void

Dispose() protected method

Dispose of the world.
protected Dispose ( bool disposing ) : void
disposing bool True when disposing intentionally.
return void

DoRandomUpdate() public method

Force a random update at a position.
public DoRandomUpdate ( Vector3i position ) : bool
position Vector3i The position.
return bool

FinishAll() public method

Wait for all world tasks to finish.
public FinishAll ( ) : Task
return Task

GetSpawnPosition() public method

Get the spawn position of this world.
public GetSpawnPosition ( ) : Vector3
return Vector3

ProcessChangedSection() protected abstract method

Process that a section was changed.
protected abstract ProcessChangedSection ( VoxelGame.Core.Logic.Chunk chunk, Vector3i position ) : void
chunk VoxelGame.Core.Logic.Chunk The chunk containing the section.
position Vector3i The position of the block that caused the section change.
return void

Save() public method

Saves all active chunks that are not currently saved.
public Save ( ) : Task
return Task

SetDefaultBlock() public method

Set a position to the default block.
public SetDefaultBlock ( Vector3i position ) : void
position Vector3i
return void

SetDefaultLiquid() public method

Set a position to the default liquid.
public SetDefaultLiquid ( Vector3i position ) : void
position Vector3i
return void

SetSpawnPosition() public method

Sets the spawn position of this world.
public SetSpawnPosition ( Vector3 position ) : void
position Vector3 The position to set as spawn.
return void

Update() public abstract method

Called every update cycle.
public abstract Update ( float deltaTime ) : void
deltaTime float The time since the last update cycle.
return void

World() protected method

This constructor is meant for worlds that already exist.
protected World ( VoxelGame.Core.Logic.WorldInformation information, string path ) : System
information VoxelGame.Core.Logic.WorldInformation
path string
return System

World() protected method

This constructor is meant for worlds that are new.
protected World ( string name, string path, int seed ) : System
name string
path string
seed int
return System