C# Class VoxelGame.Core.Logic.Block

Inheritance: IBlockBase
Afficher le fichier Open project: pershingthesecond/VoxelGame

Private Properties

Свойство Type Description

Méthodes publiques

Méthode Description
BlockUpdate ( World world, Vector3i position, data, BlockSide side ) : void

This method is called on blocks next to a position that was changed.

CanPlace ( World world, Vector3i position, PhysicsEntity? entity ) : bool

Override this to provide change the block placement checks.

Destroy ( World world, Vector3i position, PhysicsEntity? entity = null ) : bool

Attempt to destroy the block in the world. Will always fail if there is a different block at the given position.

EntityCollision ( PhysicsEntity entity, Vector3i position ) : void

This method is called when an entity collides with this block.

EntityInteract ( PhysicsEntity entity, Vector3i position ) : void

Called when a block and an entity collide.

GetBoundingBox ( World world, Vector3i position ) : BoundingBox

Returns the bounding box of this block if it would be at the given position.

GetMesh ( BlockMeshInfo info ) : BlockMeshData

Returns the mesh of a block side at given conditions.

Place ( World world, Vector3i position, PhysicsEntity? entity = null ) : bool

Attempt to place the block in the world.

RandomUpdate ( World world, Vector3i position, data ) : void

This method is called randomly on some blocks every update.

ToString ( ) : string

Méthodes protégées

Méthode Description
Block ( string name, string namedId, BlockFlags flags, BoundingBox boundingBox, TargetBuffer targetBuffer ) : System.Diagnostics

Create a new block.

CanDestroy ( World world, Vector3i position, data, PhysicsEntity? entity ) : bool

Override this to change the block destruction checks.

DoDestroy ( World world, Vector3i position, data, PhysicsEntity? entity ) : void

Override this to change the block destruction logic. The block destruction must always be successful. If checks are required, override CanDestroy.

DoPlace ( World world, Vector3i position, PhysicsEntity? entity ) : void

Override this to change the block placement logic. The block placement must always be successful. If checks are required, override CanPlace.

EntityCollision ( PhysicsEntity entity, Vector3i position, data ) : void

Override to provide custom entity collision logic.

EntityInteract ( PhysicsEntity entity, Vector3i position, data ) : void

Override to provide custom entity interaction logic.

GetBoundingBox ( data ) : BoundingBox

Override this to provide a custom bounding box for this block, depending on the block data.

ScheduledUpdate ( World world, Vector3i position, data ) : void

This method is called for scheduled updates.

Setup ( ITextureIndexProvider indexProvider ) : void

Called when loading blocks, meant to setup vertex data, indices etc.

Method Details

Block() protected méthode

Create a new block.
protected Block ( string name, string namedId, BlockFlags flags, BoundingBox boundingBox, TargetBuffer targetBuffer ) : System.Diagnostics
name string The name of the block. Can be localized.
namedId string The named ID of the block. A unique and unlocalized identifier.
flags BlockFlags The block flags setting specific options.
boundingBox BoundingBox The base bounding box for this block. Is used for placement checks.
targetBuffer TargetBuffer The target rendering buffer.
Résultat System.Diagnostics

BlockUpdate() public méthode

This method is called on blocks next to a position that was changed.
public BlockUpdate ( World world, Vector3i position, data, BlockSide side ) : void
world World The containing world.
position Vector3i The block position.
data The data of the block next to the changed position.
side BlockSide The side of the block where the change happened.
Résultat void

CanDestroy() protected méthode

Override this to change the block destruction checks.
protected CanDestroy ( World world, Vector3i position, data, PhysicsEntity? entity ) : bool
world World The world in which the placement occurs.
position Vector3i The position at which the placement is requested.
data The block data.
entity PhysicsEntity? The entity that performs placement.
Résultat bool

CanPlace() public méthode

Override this to provide change the block placement checks.
public CanPlace ( World world, Vector3i position, PhysicsEntity? entity ) : bool
world World The world in which the placement occurs.
position Vector3i The position at which the placement is requested.
entity PhysicsEntity? The entity that performs placement.
Résultat bool

Destroy() public méthode

Attempt to destroy the block in the world. Will always fail if there is a different block at the given position.
public Destroy ( World world, Vector3i position, PhysicsEntity? entity = null ) : bool
world World The world in which to destroy the block.
position Vector3i The position at which to destroy to block.
entity PhysicsEntity? The entity destroying the block.
Résultat bool

DoDestroy() protected méthode

Override this to change the block destruction logic. The block destruction must always be successful. If checks are required, override CanDestroy.
protected DoDestroy ( World world, Vector3i position, data, PhysicsEntity? entity ) : void
world World The world in which the placement occurs.
position Vector3i The position at which the placement is requested.
data The block data.
entity PhysicsEntity? The entity that performs placement.
Résultat void

DoPlace() protected méthode

Override this to change the block placement logic. The block placement must always be successful. If checks are required, override CanPlace.
protected DoPlace ( World world, Vector3i position, PhysicsEntity? entity ) : void
world World The world in which the placement occurs.
position Vector3i The position at which the placement is requested.
entity PhysicsEntity? The entity that performs placement.
Résultat void

EntityCollision() public méthode

This method is called when an entity collides with this block.
public EntityCollision ( PhysicsEntity entity, Vector3i position ) : void
entity PhysicsEntity The entity that caused the collision.
position Vector3i The block position.
Résultat void

EntityCollision() protected méthode

Override to provide custom entity collision logic.
protected EntityCollision ( PhysicsEntity entity, Vector3i position, data ) : void
entity PhysicsEntity The entity that collided with this block.
position Vector3i The position of the block.
data The block data of this block.
Résultat void

EntityInteract() public méthode

Called when a block and an entity collide.
public EntityInteract ( PhysicsEntity entity, Vector3i position ) : void
entity PhysicsEntity The entity that collided with the block.
position Vector3i The block position.
Résultat void

EntityInteract() protected méthode

Override to provide custom entity interaction logic.
protected EntityInteract ( PhysicsEntity entity, Vector3i position, data ) : void
entity PhysicsEntity The entity that interacted with this block.
position Vector3i The position of the block.
data The block data of this block.
Résultat void

GetBoundingBox() protected méthode

Override this to provide a custom bounding box for this block, depending on the block data.
protected GetBoundingBox ( data ) : BoundingBox
data The block data.
Résultat BoundingBox

GetBoundingBox() public méthode

Returns the bounding box of this block if it would be at the given position.
public GetBoundingBox ( World world, Vector3i position ) : BoundingBox
world World The world in which the block is.
position Vector3i The position of the block.
Résultat BoundingBox

GetMesh() public abstract méthode

Returns the mesh of a block side at given conditions.
public abstract GetMesh ( BlockMeshInfo info ) : BlockMeshData
info BlockMeshInfo Information about the conditions the mesh should be created in.
Résultat BlockMeshData

Place() public méthode

Attempt to place the block in the world.
public Place ( World world, Vector3i position, PhysicsEntity? entity = null ) : bool
world World The world in which to place the block.
position Vector3i The position at which to place the block.
entity PhysicsEntity? The entity that is placing the block.
Résultat bool

RandomUpdate() public méthode

This method is called randomly on some blocks every update.
public RandomUpdate ( World world, Vector3i position, data ) : void
world World
position Vector3i
Résultat void

ScheduledUpdate() protected méthode

This method is called for scheduled updates.
protected ScheduledUpdate ( World world, Vector3i position, data ) : void
world World
position Vector3i
Résultat void

Setup() protected méthode

Called when loading blocks, meant to setup vertex data, indices etc.
protected Setup ( ITextureIndexProvider indexProvider ) : void
indexProvider ITextureIndexProvider
Résultat void

ToString() public final méthode

public final ToString ( ) : string
Résultat string