C# Class flxSharp.flxSharp.FlxPath

This is a simple path data container. Basically a list of points that a FlxObject can follow. Also has code for drawing debug visuals. FlxTilemap.findPath() returns a path object, but you can also just make your own, using the add() functions below or by creating your own array of points.
Datei anzeigen Open project: jlorek/flxSharp Class Usage Examples

Protected Properties

Property Type Description
_point FlxPoint

Public Methods

Method Description
Add ( float x, float y ) : void

Add a new node to the end of the path at the specified location.

AddAt ( float x, float y, int index ) : void

Add a new node to the path at the specified location and index within the path.

AddPoint ( FlxPoint node, bool asReference = false ) : void

Sometimes its easier or faster to just pass a point object instead of separate X and Y coordinates. This also gives you the option of not creating a new node but actually adding that specific FlxPoint object to the path. This allows you to do neat things, like dynamic paths.

AddPointAt ( FlxPoint node, int index, bool asReference = false ) : void

Sometimes its easier or faster to just pass a point object instead of separate X and Y coordinates. This also gives you the option of not creating a new node but actually adding that specific FlxPoint object to the path. This allows you to do neat things, like dynamic paths.

DrawDebug ( FlxCamera camera ) : void

While this doesn't override FlxBasic.DrawDebug(), the behavior is very similar. Based on this path data, it draws a simple lines-and-boxes representation of the path if the visual debug mode was toggled in the debugger overlay. You can use DebugColor and DebugScrollFactor to control the path's appearance.

FlxPath ( IEnumerable nodes = null ) : System

Instantiate a new path object.

Head ( ) : FlxPoint

Get the first node in the list.

Remove ( FlxPoint node ) : FlxPoint

Remove a node from the path. NOTE: only works with points added by reference or with references from nodes itself!

RemoveAt ( int index ) : FlxPoint

Remove a node from the path using the specified position in the list of path nodes.

Tail ( ) : FlxPoint

Get the last node in the list.

destroy ( ) : void

Method Details

Add() public method

Add a new node to the end of the path at the specified location.
public Add ( float x, float y ) : void
x float X position of the new path point in world coordinates.
y float Y position of the new path point in world coordinates.
return void

AddAt() public method

Add a new node to the path at the specified location and index within the path.
public AddAt ( float x, float y, int index ) : void
x float X position of the new path point in world coordinates.
y float Y position of the new path point in world coordinates.
index int Where within the list of path nodes to insert this new point.
return void

AddPoint() public method

Sometimes its easier or faster to just pass a point object instead of separate X and Y coordinates. This also gives you the option of not creating a new node but actually adding that specific FlxPoint object to the path. This allows you to do neat things, like dynamic paths.
public AddPoint ( FlxPoint node, bool asReference = false ) : void
node FlxPoint The point in world coordinates you want to add to the path.
asReference bool Whether to add the point as a reference, or to create a new point with the specified values.
return void

AddPointAt() public method

Sometimes its easier or faster to just pass a point object instead of separate X and Y coordinates. This also gives you the option of not creating a new node but actually adding that specific FlxPoint object to the path. This allows you to do neat things, like dynamic paths.
public AddPointAt ( FlxPoint node, int index, bool asReference = false ) : void
node FlxPoint The point in world coordinates you want to add to the path.
index int Where within the list of path nodes to insert this new point.
asReference bool Whether to add the point as a reference, or to create a new point with the specified values.
return void

DrawDebug() public method

While this doesn't override FlxBasic.DrawDebug(), the behavior is very similar. Based on this path data, it draws a simple lines-and-boxes representation of the path if the visual debug mode was toggled in the debugger overlay. You can use DebugColor and DebugScrollFactor to control the path's appearance.
public DrawDebug ( FlxCamera camera ) : void
camera FlxCamera The camera object the path will draw to.
return void

FlxPath() public method

Instantiate a new path object.
public FlxPath ( IEnumerable nodes = null ) : System
nodes IEnumerable Optional, can specify all the points for the path up front if you want.
return System

Head() public method

Get the first node in the list.
public Head ( ) : FlxPoint
return FlxPoint

Remove() public method

Remove a node from the path. NOTE: only works with points added by reference or with references from nodes itself!
public Remove ( FlxPoint node ) : FlxPoint
node FlxPoint The point object you want to remove from the path.
return FlxPoint

RemoveAt() public method

Remove a node from the path using the specified position in the list of path nodes.
public RemoveAt ( int index ) : FlxPoint
index int Where within the list of path nodes you want to remove a node.
return FlxPoint

Tail() public method

Get the last node in the list.
public Tail ( ) : FlxPoint
return FlxPoint

destroy() public method

public destroy ( ) : void
return void

Property Details

_point protected_oe property

protected FlxPoint,flxSharp.flxSharp _point
return FlxPoint