Empeld
Empeld plugin documentation.
essentials.action.Pathing.Rails.StepRail Class Reference

Slightly difference from an AbstractRail, this doesn't keep track of interpolation, but just the list of ordered points to traverse More...

Inheritance diagram for essentials.action.Pathing.Rails.StepRail:

Public Member Functions

 StepRail (IEnumerable< Vector3d > path)
 
 StepRail (Path path, Vector3d offset)
 
 StepRail (Path path)
 
bool Advance ()
 
IEnumerator< Vector3d > GetEnumerator ()
 

Static Public Member Functions

static StepRail FromPathSmoothedXY (Path path, float centerWeight=1f)
 

Properties

int Index [get, set]
 Current (clamped) index More...
 
int Length [get]
 
Vector3d Position [get]
 
Vector3d LookDirection [get]
 

Detailed Description

Slightly difference from an AbstractRail, this doesn't keep track of interpolation, but just the list of ordered points to traverse

Constructor & Destructor Documentation

◆ StepRail() [1/3]

essentials.action.Pathing.Rails.StepRail.StepRail ( IEnumerable< Vector3d >  path)
74  {
75  _rail = path.ToArray();
76  }

◆ StepRail() [2/3]

essentials.action.Pathing.Rails.StepRail.StepRail ( Path  path,
Vector3d  offset 
)
79  :this(path.Select(x => x + offset))
80  {}

◆ StepRail() [3/3]

essentials.action.Pathing.Rails.StepRail.StepRail ( Path  path)
83  :this(path, Vector3d.Zero)
84  {}

Member Function Documentation

◆ Advance()

bool essentials.action.Pathing.Rails.StepRail.Advance ( )
107  {
108  if (_idx >= _rail.Length-1)
109  {
110  return false;
111  }
112  this.Index++;
113  return true;
114  }
int Index
Current (clamped) index
Definition: StepRail.cs:25

◆ FromPathSmoothedXY()

static StepRail essentials.action.Pathing.Rails.StepRail.FromPathSmoothedXY ( Path  path,
float  centerWeight = 1f 
)
static

Attribute: path.Count

;

Attribute: 0] = path[0

+ CENTERXY;

Attribute: path.Count - 1] = path[path.Count - 1

+ CENTERXY;

Attribute: i

= (

Attribute: i

+ CENTERXY) * centerWeight

Attribute: i - 1

+ CENTERXY)

Attribute: i + 1

) + CENTERXY)

87  {
88  Vector3d CENTERXY = new Vector3d(0.5, 0.5, 0);
89 
90  var pts = new Vector3d[path.Count];
91  pts[0] = path[0] + CENTERXY;
92  pts[path.Count - 1] = path[path.Count - 1] + CENTERXY;
93 
94  for (int i = 1; i < path.Count - 1; i++)
95  {
96  pts[i] = (
97  (path[i] + CENTERXY) * centerWeight
98  + (path[i - 1] + CENTERXY)
99  + (path[i + 1]) + CENTERXY)
100  / (2 + centerWeight);
101  }
102 
103  return new StepRail(pts);
104  }
StepRail(IEnumerable< Vector3d > path)
Definition: StepRail.cs:73

◆ GetEnumerator()

IEnumerator<Vector3d> essentials.action.Pathing.Rails.StepRail.GetEnumerator ( )
117  {
118  return ((IEnumerable<Vector3d>)_rail).GetEnumerator();
119  }

Property Documentation

◆ Index

int essentials.action.Pathing.Rails.StepRail.Index
getset

Current (clamped) index

The index.

◆ Length

int essentials.action.Pathing.Rails.StepRail.Length
get

◆ LookDirection

Vector3d essentials.action.Pathing.Rails.StepRail.LookDirection
get

◆ Position

Vector3d essentials.action.Pathing.Rails.StepRail.Position
get

The documentation for this class was generated from the following file: