C# Class Source.Collisions.Body

A body, could be any polygon or circle
显示文件 Open project: HarkerGameDev/TheGame

Public Properties

Property Type Description
Color Color
Velocity Vector2

Protected Properties

Property Type Description
Points Vector2[]

Public Methods

Method Description
Body ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector2 position, Vector2 size, float rotation = 0f ) : System
Draw ( SpriteBatch spriteBatch ) : void
Intersects ( Polygon other ) : Vector2

Intersection detection function Mostly derived from http://www.codeproject.com/Articles/15573/2D-Polygon-Collision-Detection

MoveByPosition ( Vector2 by ) : void
MoveToPosition ( Vector2 pos ) : void
Raycast ( Vector2 rayStart, Vector2 rayDir ) : float

Gets the parametric T value for the ray on start in direction dir, 0 if nothing Based on http://ncase.me/sight-and-light/

TestPoint ( Vector2 point ) : bool

Currently making a small rectangle and using Intersect to TestPoint

Update ( float deltaTime ) : void

Method Details

Body() public method

public Body ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector2 position, Vector2 size, float rotation = 0f ) : System
texture Microsoft.Xna.Framework.Graphics.Texture2D
position Vector2
size Vector2
rotation float
return System

Draw() public method

public Draw ( SpriteBatch spriteBatch ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch
return void

Intersects() public abstract method

Intersection detection function Mostly derived from http://www.codeproject.com/Articles/15573/2D-Polygon-Collision-Detection
public abstract Intersects ( Polygon other ) : Vector2
other Polygon The other Body to check intersection with
return Vector2

MoveByPosition() public method

public MoveByPosition ( Vector2 by ) : void
by Vector2
return void

MoveToPosition() public method

public MoveToPosition ( Vector2 pos ) : void
pos Vector2
return void

Raycast() public abstract method

Gets the parametric T value for the ray on start in direction dir, 0 if nothing Based on http://ncase.me/sight-and-light/
public abstract Raycast ( Vector2 rayStart, Vector2 rayDir ) : float
rayStart Vector2
rayDir Vector2
return float

TestPoint() public method

Currently making a small rectangle and using Intersect to TestPoint
public TestPoint ( Vector2 point ) : bool
point Vector2
return bool

Update() public method

public Update ( float deltaTime ) : void
deltaTime float
return void

Property Details

Color public_oe property

public Color Color
return Color

Points protected_oe property

protected Vector2[] Points
return Vector2[]

Velocity public_oe property

public Vector2 Velocity
return Vector2