C# Class Nez.CircleCollider

Inheritance: Collider
ファイルを表示 Open project: prime31/Nez

Public Methods

Method Description
CircleCollider ( ) : Microsoft.Xna.Framework

zero param constructor requires that a RenderableComponent be on the entity so that the collider can size itself when the entity is added to the scene.

CircleCollider ( float radius ) : Microsoft.Xna.Framework

creates a CircleCollider with radius. Note that when specifying a radius if using a RenderableComponent on the Entity as well you will need to set the origin to align the CircleCollider. For example, if the RenderableComponent has a 0,0 origin and a CircleCollider with a radius of 1.5f * renderable.width is created you can offset the origin by just setting the originNormalied to the center divided by the scaled size: entity.collider = new CircleCollider( moonTexture.Width * 1.5f ); entity.collider.originNormalized = Vector2Extension.halfVector() / 1.5f;

ToString ( ) : string
debugRender ( Graphics graphics ) : void
setRadius ( float radius ) : CircleCollider

Method Details

CircleCollider() public method

zero param constructor requires that a RenderableComponent be on the entity so that the collider can size itself when the entity is added to the scene.
public CircleCollider ( ) : Microsoft.Xna.Framework
return Microsoft.Xna.Framework

CircleCollider() public method

creates a CircleCollider with radius. Note that when specifying a radius if using a RenderableComponent on the Entity as well you will need to set the origin to align the CircleCollider. For example, if the RenderableComponent has a 0,0 origin and a CircleCollider with a radius of 1.5f * renderable.width is created you can offset the origin by just setting the originNormalied to the center divided by the scaled size: entity.collider = new CircleCollider( moonTexture.Width * 1.5f ); entity.collider.originNormalized = Vector2Extension.halfVector() / 1.5f;
public CircleCollider ( float radius ) : Microsoft.Xna.Framework
radius float Radius.
return Microsoft.Xna.Framework

ToString() public method

public ToString ( ) : string
return string

debugRender() public method

public debugRender ( Graphics graphics ) : void
graphics Graphics
return void

setRadius() public method

public setRadius ( float radius ) : CircleCollider
radius float
return CircleCollider