public Node(Vector3 pos, SFMisc.Dot2 coord) { this.estimatedCost = 0.0f; this.nodeTotalCost = 1.0f; this.parent = null; this.position = pos; this.coord = coord; }
public static CSDirection GetDirection(SFMisc.Dot2 dot) { dot = dot.Normal(); byte b = (byte)((dot.x + 1) * 10 + (dot.y + 1)); if (dirDic.ContainsKey(b)) { return((CSDirection)dirDic[b]); } return(CSDirection.None); }
public void UpdateLinePos() { if (!mIsShow) { return; } if (mLine == null || !SFOut.IGame.IsLanuchMainPlayer || SFOut.IScene.CahceWorldTrans == null) { return; } ISFAvater avatar1 = SFOut.IScene.getAvatarByISFAvatar(avatarID1); if (avatar1 == null || avatar1.isDead) { Show(false); mIsShow = false; return; } ISFAvater avatar2 = SFOut.IScene.getAvatarByISFAvatar(avatarID2); if (avatar2 == null || avatar2.isDead) { Show(false); mIsShow = false; return; } SFMisc.Dot2 dot = avatar1.getOldCellPos - avatar2.getOldCellPos; int dist = dot.Pow2(); bool b = dist <= (showDist * showDist); if (mLine.enabled != b) { mLine.enabled = b; } if (!b) { Show(false); mIsShow = false; return; } float z = avatar1.CacheTransform.localPosition.z > avatar2.CacheTransform.localPosition.z ? avatar2.CacheTransform.localPosition.z : avatar1.CacheTransform.localPosition.z; Vector3 vec1 = avatar1.getRealPosition2() + delta1 + SFOut.IScene.CahceWorldTrans.TransformPoint(new Vector3(0, 0, z - 1000)); Vector3 vec2 = avatar2.getRealPosition2() + delta2 + SFOut.IScene.CahceWorldTrans.TransformPoint(new Vector3(0, 0, z - 1000)); mLine.SetPosition(0, vec1); mLine.SetPosition(1, vec2); }
public static int DistancePow2(SFMisc.Dot2 dot0, SFMisc.Dot2 dot1) { SFMisc.Dot2 d = dot0 - dot1; return(d.x * d.x + d.y * d.y); }