private void RotateCharacter(D3DXVECTOR2 newPoint) { var dx2DPoint = new Player2DPos {x = newPoint.x, y = newPoint.y}; Funcs.ModelRotation(ref dx2DPoint); }
/// <summary> Distances. </summary> /// /// /// <param name="p1" type="Player2DPos"> . </param> /// <param name="p2" type="D3DXVECTOR2"> The second D3DXVECTOR2. </param> /// /// <returns> A float. </returns> /// /// ### <param name="p1" type="D3DXVECTOR2"> The first D3DXVECTOR2. </param> private float Distance(Player2DPos p1, D3DXVECTOR2 p2) { return Distance(p1.y, p1.x, p2.y, p2.x); }
/// <summary> Gets closest index. </summary> /// /// /// <param name="PList"> The list. </param> /// <param name="curPos"> The current position. </param> /// /// <returns> The closest index. </returns> private int GetClosestIndex(List<D3DXVECTOR2> PList, Player2DPos curPos) { var n = 0; PList.ForEach(p => n = Distance(curPos, p) < Distance(curPos, PList[n]) ? PList.IndexOf(p) : n); return n; }
public static extern void ModelRotation(ref Player2DPos newPoint);