PlanBaseCheckNextCoordinate Method |
Namespace: (Default Namespace)
public virtual int CheckNextCoordinate( SpriteBase Sprite, int CoordinateIndex, ref int WaitCounter )
This function determines if the sprite should head toward the next coordinate by checking if the sprite is within this plan's TargetDistance of the specified coordinate. If it is, then it checks the coordinate's weight, to see if the sprite is supposed to wait at this coordinate. If it's not supposed to wait, the function returns the next coordinate index right away. If it is supposed to wait, the function will only return the next coordinate index if the sprite has waited the specified number of frames at the current coordinate.
Normally two sprite parameters are used in conjunction with a sprite that follows a series of coordinates in a plan, and they are both passed into this function. One parameter tracks the index of the coordinate toward which the the sprite is currently heading. The other tracks how long the sprite has waited at the current coordinate. The coordinate parameter is passed in as the the input for CoordinateIndex and also specified to receive the output of the function. The wait counter is passed for the last parameter and is automatically updated when needed because it is passed by reference.
m_ParentLayer.m_Plasma_1.CoordIndex = CheckNextCoordinate(m_ParentLayer.m_Plasma_1, m_ParentLayer.m_Plasma_1.CoordIndex, ref m_ParentLayer.m_Plasma_1.WaitCounter);