public override List <WayNode> GetSurround(Map map, WayNode center) { var result = new List <WayNode>(); var centerPos = center.Current; var lPos = centerPos + new int2(-1, 0); var rPos = centerPos + new int2(1, 0); var uPos = centerPos + new int2(0, 1); var dPos = centerPos + new int2(0, -1); if (map.Avaliable(lPos) && map.FindWayData[lPos].Walkable) { if (!WayNodes.ContainsKey(lPos)) { WayNodes[lPos] = new AStarWayNode(lPos, new int2(-1, -1)); } result.Add(this[lPos]); } if (map.Avaliable(rPos) && map.FindWayData[rPos].Walkable) { if (!WayNodes.ContainsKey(rPos)) { WayNodes[rPos] = new AStarWayNode(rPos, new int2(-1, -1)); } result.Add(this[rPos]); } if (map.Avaliable(uPos) && map.FindWayData[uPos].Walkable) { if (!WayNodes.ContainsKey(uPos)) { WayNodes[uPos] = new AStarWayNode(uPos, new int2(-1, -1)); } result.Add(this[uPos]); } if (map.Avaliable(dPos) && map.FindWayData[dPos].Walkable) { if (!WayNodes.ContainsKey(dPos)) { WayNodes[dPos] = new AStarWayNode(dPos, new int2(-1, -1)); } result.Add(this[dPos]); } return(result); }