C# Класс PunkX.World

Наследование: Tweener
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
camera Microsoft.Xna.Framework.Vector2
visible System.Boolean

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

World() публичный Метод

constructor
public World ( ) : System
Результат System

add() публичный Метод

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.
Результат Entity

addGraphic() публичный Метод

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.
Результат Entity

addList() публичный Метод

Adds multiple Entities to the world.
public addList ( ) : void
Результат void

addMask() публичный Метод

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.
Результат Entity

begin() публичный Метод

Override this; called when World is switch to, and set to the currently active world.
public begin ( ) : void
Результат void

bringForward() публичный Метод

Shifts the Entity one place towards the front of its contained layer.
public bringForward ( Entity e ) : System.Boolean
e Entity The Entity to shift.
Результат System.Boolean

bringToFront() публичный Метод

Brings the Entity to the front of its contained layer.
public bringToFront ( Entity e ) : System.Boolean
e Entity The Entity to shift.
Результат System.Boolean

classCount() публичный Метод

Returns the amount of Entities of the Class are in the World.
public classCount ( string name ) : uint
name string The Class type to count.
Результат uint

classFirst() публичный Метод

The first Entity of the Class.
public classFirst ( string name ) : Entity
name string The Class type to check.
Результат Entity

clearRecycled() публичный Метод

Clears stored reycled Entities of the Class type.
public clearRecycled ( string classType ) : void
classType string The Class type to clear.
Результат void

clearRecycledAll() публичный Метод

Clears stored recycled Entities of all Class types.
public clearRecycledAll ( ) : void
Результат void

collideLine() публичный Метод

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
Результат Entity

collidePoint() публичный Метод

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.
Результат Entity

collidePointInto() публичный Метод

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.
Результат void

collideRect() публичный Метод

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.
Результат Entity

collideRectInto() публичный Метод

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.
Результат void

create() публичный Метод

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.
Результат Entity

end() публичный Метод

Override this; called when World is changed, and the active world is no longer this.
public end ( ) : void
Результат void

getAll() публичный Метод

Pushes all Entities in the World into the array.
public getAll ( Object &into ) : void
into Object The Array or Vector to populate.
Результат void

getClass() публичный Метод

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.
Результат void

getLayer() публичный Метод

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.
Результат void

getType() публичный Метод

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.
Результат void

isAtBack() публичный Метод

If the Entity as at the back of its layer.
public isAtBack ( Entity e ) : System.Boolean
e Entity The Entity to check.
Результат System.Boolean

isAtFront() публичный Метод

If the Entity as at the front of its layer.
public isAtFront ( Entity e ) : System.Boolean
e Entity The Entity to check.
Результат System.Boolean

layerCount() публичный Метод

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.
Результат uint

layerFirst() публичный Метод

The first Entity on the Layer.
public layerFirst ( int layer ) : Entity
layer int The layer to check.
Результат Entity

layerLast() публичный Метод

The last Entity on the Layer.
public layerLast ( int layer ) : Entity
layer int The layer to check.
Результат Entity

nearestToEntity() публичный Метод

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.
Результат Entity

nearestToPoint() публичный Метод

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.
Результат Entity

nearestToRect() публичный Метод

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.
Результат Entity

recycle() публичный Метод

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.
Результат Entity

remove() публичный Метод

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.
Результат Entity

removeAll() публичный Метод

Removes all Entities from the World at the end of the frame.
public removeAll ( ) : void
Результат void

removeList() публичный Метод

Removes multiple Entities from the world.
public removeList ( ) : void
Результат void

render() публичный Метод

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
Результат void

sendBackward() публичный Метод

Shifts the Entity one place towards the back of its contained layer.
public sendBackward ( Entity e ) : System.Boolean
e Entity The Entity to shift.
Результат System.Boolean

sendToBack() публичный Метод

Sends the Entity to the back of its contained layer.
public sendToBack ( Entity e ) : System.Boolean
e Entity The Entity to shift.
Результат System.Boolean

typeCount() публичный Метод

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.
Результат uint

typeFirst() публичный Метод

The first Entity of the type.
public typeFirst ( string type ) : Entity
type string The type to check.
Результат Entity

update() публичный Метод

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
Результат void

updateLists() публичный Метод

Updates the add/remove lists at the end of the frame.
public updateLists ( ) : void
Результат void

Описание свойств

camera публичное свойство

Point used to determine drawing offset in the render loop.
public Microsoft.Xna.Framework.Vector2 camera
Результат Microsoft.Xna.Framework.Vector2

visible публичное свойство

If the render() loop is performed.
public Boolean,System visible
Результат System.Boolean