public Vector2 ObstacleAvoidance(Nr3DCharBase kChar, Vector2 curPos, Vector2 dir) { if (kChar.GetCharController() == null) { return(Vector2.zero); } float num = 10f; float num2 = 3.40282347E+38f; Nr3DCharBase nr3DCharBase = null; Vector2 vector = Vector2.zero; NkBattleChar[] charArray = this.GetCharArray(); for (int i = 0; i < charArray.Length; i++) { NkBattleChar nkBattleChar = charArray[i]; if (nkBattleChar != null) { Nr3DCharBase nr3DCharBase2 = nkBattleChar.Get3DChar(); if (nkBattleChar.GetBUID() != kChar.GetParentBattleChar().GetBUID()) { if (!(nr3DCharBase2.GetCharController() == null)) { Vector2 pos = new Vector2(nr3DCharBase2.GetCharController().transform.position.x, nr3DCharBase2.GetCharController().transform.position.z); Vector2 vector2 = this.PointToLocalSpace(pos, dir, curPos); if (vector2.x >= 0f) { float num3 = kChar.GetParentBattleChar().GetCharHalfBound() + nr3DCharBase2.GetParentBattleChar().GetCharHalfBound(); if (Mathf.Abs(vector2.y) < num3) { float x = vector2.x; float y = vector2.y; float num4 = Mathf.Sqrt(num3 * num3 - y * y); float num5 = x - num4; if (num5 <= 0f) { num5 = x + num4; } if (num5 < num2) { num2 = num5; nr3DCharBase = nr3DCharBase2; vector = vector2; } } } } } } } Vector2 zero = Vector2.zero; if (nr3DCharBase != null) { float num6 = 1f + (num - vector.x) / num; zero.y = (nr3DCharBase.GetParentBattleChar().GetCharHalfBound() - vector.y) * num6; zero.x = (nr3DCharBase.GetParentBattleChar().GetCharHalfBound() - vector.x) * 0.2f; if (kChar.GetParentBattleChar().GetBUID() == 0) { Debug.Log("*** TYS : steering Force " + zero); Debug.Log("*** TYS : closestIntersectionObstacle " + nr3DCharBase.GetCharCode()); } } return(this.VectorToWorldSpace(zero, dir)); }