C# Class PunkX.World

Inheritance: Tweener
Afficher le fichier Open project: RichardMarks/PunkX

Méthodes publiques

Свойство Type Description
camera Microsoft.Xna.Framework.Vector2
visible System.Boolean

Méthodes publiques

Méthode Description
World ( ) : System

constructor

add ( Entity e ) : Entity

Adds the Entity to the World at the end of the frame.

addGraphic ( Graphic graphic, int layer, float x, float y ) : Entity

Adds an Entity to the World with the Graphic object.

addList ( ) : void

Adds multiple Entities to the world.

addMask ( Mask mask, string type, float x, float y ) : Entity

Adds an Entity to the World with the Mask object.

begin ( ) : void

Override this; called when World is switch to, and set to the currently active world.

bringForward ( Entity e ) : System.Boolean

Shifts the Entity one place towards the front of its contained layer.

bringToFront ( Entity e ) : System.Boolean

Brings the Entity to the front of its contained layer.

classCount ( string name ) : uint

Returns the amount of Entities of the Class are in the World.

classFirst ( string name ) : Entity

The first Entity of the Class.

clearRecycled ( string classType ) : void

Clears stored reycled Entities of the Class type.

clearRecycledAll ( ) : void

Clears stored recycled Entities of all Class types.

collideLine ( string type, int fromX, int fromY, int toX, int toY, int precision = 1, PunkX p = null ) : Entity

Returns the first Entity found that collides with the line.

collidePoint ( string type, float pX, float pY ) : Entity

Returns the first Entity found that collides with the position.

collidePointInto ( string type, float pX, float pY, Object &into ) : void

Populates an array with all Entities that collide with the position. This function does not empty the array, that responsibility is left to the user.

collideRect ( string type, float rX, float rY, int rWidth, int rHeight ) : Entity

Returns the first Entity that collides with the rectangular area.

collideRectInto ( string type, float rX, float rY, int rWidth, int rHeight, Object &into ) : void

Populates an array with all Entities that collide with the rectangle. This function does not empty the array, that responsibility is left to the user.

create ( string classType, System.Boolean addToWorld = true ) : Entity

Returns a new Entity, or a stored recycled Entity if one exists.

end ( ) : void

Override this; called when World is changed, and the active world is no longer this.

getAll ( Object &into ) : void

Pushes all Entities in the World into the array.

getClass ( string name, Object &into ) : void

Pushes all Entities in the World of the Class into the Array or Vector.

getLayer ( int layer, Object &into ) : void

Pushes all Entities in the World on the layer into the Array or Vector.

getType ( string type, Object &into ) : void

Pushes all Entities in the World of the type into the Array or Vector.

isAtBack ( Entity e ) : System.Boolean

If the Entity as at the back of its layer.

isAtFront ( Entity e ) : System.Boolean

If the Entity as at the front of its layer.

layerCount ( int layer ) : uint

Returns the amount of Entities are on the layer in the World.

layerFirst ( int layer ) : Entity

The first Entity on the Layer.

layerLast ( int layer ) : Entity

The last Entity on the Layer.

nearestToEntity ( string type, Entity e, System.Boolean useHitboxes = false ) : Entity

Finds the Entity nearest to another.

nearestToPoint ( string type, float x, float y, System.Boolean useHitboxes = false ) : Entity

Finds the Entity nearest to the position.

nearestToRect ( string type, float x, float y, int width, int height ) : Entity

Finds the Entity nearest to the rectangle.

recycle ( Entity e ) : Entity

Removes the Entity from the World at the end of the frame and recycles it. The recycled Entity can then be fetched again by calling the create() function.

remove ( Entity e ) : Entity

Removes the Entity from the World at the end of the frame.

removeAll ( ) : void

Removes all Entities from the World at the end of the frame.

removeList ( ) : void

Removes multiple Entities from the world.

render ( ) : void

Performed by the game loop, renders all contained Entities. If you override this to give your World render code, remember to call super.render() or your Entities will not be rendered.

sendBackward ( Entity e ) : System.Boolean

Shifts the Entity one place towards the back of its contained layer.

sendToBack ( Entity e ) : System.Boolean

Sends the Entity to the back of its contained layer.

typeCount ( string type ) : uint

Returns the amount of Entities of the type are in the World.

typeFirst ( string type ) : Entity

The first Entity of the type.

update ( ) : void

Performed by the game loop, updates all contained Entities. If you override this to give your World update code, remember to call super.update() or your Entities will not be updated.

updateLists ( ) : void

Updates the add/remove lists at the end of the frame.

Private Methods

Méthode Description
addRender ( Entity e ) : void

Adds Entity to the render list.

addType ( Entity e ) : void

Adds Entity to the type list.

addUpdate ( Entity e ) : void

Adds Entity to the update list.

removeRender ( Entity e ) : void

Removes Entity from the render list.

removeType ( Entity e ) : void

Removes Entity from the type list.

removeUpdate ( Entity e ) : void

Removes Entity from the update list.

squarePointRect ( float px, float py, float rx, float ry, int rw, int rh ) : float

Calculates the squared distance between a rectangle and a point.

squarePoints ( float x1, float y1, float x2, float y2 ) : float

Calculates the squared distance between two points.

squareRects ( float x1, float y1, int w1, int h1, float x2, float y2, int w2, int h2 ) : float

Calculates the squared distance between two rectangles.

Method Details

World() public méthode

constructor
public World ( ) : System
Résultat System

add() public méthode

Adds the Entity to the World at the end of the frame.
public add ( Entity e ) : Entity
e Entity Entity object you want to add.
Résultat Entity

addGraphic() public méthode

Adds an Entity to the World with the Graphic object.
public addGraphic ( Graphic graphic, int layer, float x, float y ) : Entity
graphic Graphic Graphic to assign the Entity.
layer int Layer of the Entity.
x float X position of the Entity.
y float Y position of the Entity.
Résultat Entity

addList() public méthode

Adds multiple Entities to the world.
public addList ( ) : void
Résultat void

addMask() public méthode

Adds an Entity to the World with the Mask object.
public addMask ( Mask mask, string type, float x, float y ) : Entity
mask Mask Mask to assign the Entity.
type string Collision type of the Entity.
x float X position of the Entity.
y float Y position of the Entity.
Résultat Entity

begin() public méthode

Override this; called when World is switch to, and set to the currently active world.
public begin ( ) : void
Résultat void

bringForward() public méthode

Shifts the Entity one place towards the front of its contained layer.
public bringForward ( Entity e ) : System.Boolean
e Entity The Entity to shift.
Résultat System.Boolean

bringToFront() public méthode

Brings the Entity to the front of its contained layer.
public bringToFront ( Entity e ) : System.Boolean
e Entity The Entity to shift.
Résultat System.Boolean

classCount() public méthode

Returns the amount of Entities of the Class are in the World.
public classCount ( string name ) : uint
name string The Class type to count.
Résultat uint

classFirst() public méthode

The first Entity of the Class.
public classFirst ( string name ) : Entity
name string The Class type to check.
Résultat Entity

clearRecycled() public méthode

Clears stored reycled Entities of the Class type.
public clearRecycled ( string classType ) : void
classType string The Class type to clear.
Résultat void

clearRecycledAll() public méthode

Clears stored recycled Entities of all Class types.
public clearRecycledAll ( ) : void
Résultat void

collideLine() public méthode

Returns the first Entity found that collides with the line.
public collideLine ( string type, int fromX, int fromY, int toX, int toY, int precision = 1, PunkX p = null ) : Entity
type string The Entity type to check for.
fromX int Start x of the line.
fromY int Start y of the line.
toX int End x of the line.
toY int End y of the line.
precision int fixme
p PunkX fixme
Résultat Entity

collidePoint() public méthode

Returns the first Entity found that collides with the position.
public collidePoint ( string type, float pX, float pY ) : Entity
type string The Entity type to check for.
pX float X position.
pY float Y position.
Résultat Entity

collidePointInto() public méthode

Populates an array with all Entities that collide with the position. This function does not empty the array, that responsibility is left to the user.
public collidePointInto ( string type, float pX, float pY, Object &into ) : void
type string The Entity type to check for.
pX float X position.
pY float Y position.
into Object The Array or Vector to populate with collided Entities.
Résultat void

collideRect() public méthode

Returns the first Entity that collides with the rectangular area.
public collideRect ( string type, float rX, float rY, int rWidth, int rHeight ) : Entity
type string The Entity type to check for.
rX float X position of the rectangle.
rY float Y position of the rectangle.
rWidth int Width of the rectangle.
rHeight int Height of the rectangle.
Résultat Entity

collideRectInto() public méthode

Populates an array with all Entities that collide with the rectangle. This function does not empty the array, that responsibility is left to the user.
public collideRectInto ( string type, float rX, float rY, int rWidth, int rHeight, Object &into ) : void
type string The Entity type to check for.
rX float X position of the rectangle.
rY float Y position of the rectangle.
rWidth int Width of the rectangle.
rHeight int Height of the rectangle.
into Object The Array or Vector to populate with collided Entities.
Résultat void

create() public méthode

Returns a new Entity, or a stored recycled Entity if one exists.
public create ( string classType, System.Boolean addToWorld = true ) : Entity
classType string The Class of the Entity you want to add.
addToWorld System.Boolean Add it to the World immediately.
Résultat Entity

end() public méthode

Override this; called when World is changed, and the active world is no longer this.
public end ( ) : void
Résultat void

getAll() public méthode

Pushes all Entities in the World into the array.
public getAll ( Object &into ) : void
into Object The Array or Vector to populate.
Résultat void

getClass() public méthode

Pushes all Entities in the World of the Class into the Array or Vector.
public getClass ( string name, Object &into ) : void
name string The Class type to check.
into Object The Array or Vector to populate.
Résultat void

getLayer() public méthode

Pushes all Entities in the World on the layer into the Array or Vector.
public getLayer ( int layer, Object &into ) : void
layer int The layer to check.
into Object The Array or Vector to populate.
Résultat void

getType() public méthode

Pushes all Entities in the World of the type into the Array or Vector.
public getType ( string type, Object &into ) : void
type string The type to check.
into Object The Array or Vector to populate.
Résultat void

isAtBack() public méthode

If the Entity as at the back of its layer.
public isAtBack ( Entity e ) : System.Boolean
e Entity The Entity to check.
Résultat System.Boolean

isAtFront() public méthode

If the Entity as at the front of its layer.
public isAtFront ( Entity e ) : System.Boolean
e Entity The Entity to check.
Résultat System.Boolean

layerCount() public méthode

Returns the amount of Entities are on the layer in the World.
public layerCount ( int layer ) : uint
layer int The layer to count Entities on.
Résultat uint

layerFirst() public méthode

The first Entity on the Layer.
public layerFirst ( int layer ) : Entity
layer int The layer to check.
Résultat Entity

layerLast() public méthode

The last Entity on the Layer.
public layerLast ( int layer ) : Entity
layer int The layer to check.
Résultat Entity

nearestToEntity() public méthode

Finds the Entity nearest to another.
public nearestToEntity ( string type, Entity e, System.Boolean useHitboxes = false ) : Entity
type string The Entity type to check for.
e Entity The Entity to find the nearest to.
useHitboxes System.Boolean If the Entities' hitboxes should be used to determine the distance. If false, their x/y coordinates are used.
Résultat Entity

nearestToPoint() public méthode

Finds the Entity nearest to the position.
public nearestToPoint ( string type, float x, float y, System.Boolean useHitboxes = false ) : Entity
type string The Entity type to check for.
x float X position.
y float Y position.
useHitboxes System.Boolean If the Entities' hitboxes should be used to determine the distance. If false, their x/y coordinates are used.
Résultat Entity

nearestToRect() public méthode

Finds the Entity nearest to the rectangle.
public nearestToRect ( string type, float x, float y, int width, int height ) : Entity
type string The Entity type to check for.
x float X position of the rectangle.
y float Y position of the rectangle.
width int Width of the rectangle.
height int Height of the rectangle.
Résultat Entity

recycle() public méthode

Removes the Entity from the World at the end of the frame and recycles it. The recycled Entity can then be fetched again by calling the create() function.
public recycle ( Entity e ) : Entity
e Entity The Entity to recycle.
Résultat Entity

remove() public méthode

Removes the Entity from the World at the end of the frame.
public remove ( Entity e ) : Entity
e Entity Entity object you want to remove.
Résultat Entity

removeAll() public méthode

Removes all Entities from the World at the end of the frame.
public removeAll ( ) : void
Résultat void

removeList() public méthode

Removes multiple Entities from the world.
public removeList ( ) : void
Résultat void

render() public méthode

Performed by the game loop, renders all contained Entities. If you override this to give your World render code, remember to call super.render() or your Entities will not be rendered.
public render ( ) : void
Résultat void

sendBackward() public méthode

Shifts the Entity one place towards the back of its contained layer.
public sendBackward ( Entity e ) : System.Boolean
e Entity The Entity to shift.
Résultat System.Boolean

sendToBack() public méthode

Sends the Entity to the back of its contained layer.
public sendToBack ( Entity e ) : System.Boolean
e Entity The Entity to shift.
Résultat System.Boolean

typeCount() public méthode

Returns the amount of Entities of the type are in the World.
public typeCount ( string type ) : uint
type string The type (or Class type) to count.
Résultat uint

typeFirst() public méthode

The first Entity of the type.
public typeFirst ( string type ) : Entity
type string The type to check.
Résultat Entity

update() public méthode

Performed by the game loop, updates all contained Entities. If you override this to give your World update code, remember to call super.update() or your Entities will not be updated.
public update ( ) : void
Résultat void

updateLists() public méthode

Updates the add/remove lists at the end of the frame.
public updateLists ( ) : void
Résultat void

Property Details

camera public_oe property

Point used to determine drawing offset in the render loop.
public Microsoft.Xna.Framework.Vector2 camera
Résultat Microsoft.Xna.Framework.Vector2

visible public_oe property

If the render() loop is performed.
public Boolean,System visible
Résultat System.Boolean