C# Класс 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.
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
_point FlxPoint

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Get the first node in the list.
public Head ( ) : FlxPoint
Результат FlxPoint

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

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

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

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

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

Get the last node in the list.
public Tail ( ) : FlxPoint
Результат FlxPoint

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

public destroy ( ) : void
Результат void

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

_point защищенное свойство

protected FlxPoint,flxSharp.flxSharp _point
Результат FlxPoint