|
|
|
@ -97,32 +97,30 @@ public class getNodeTools |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public static void checkListPass(List<MapUnity> mapUnityList) |
|
|
|
public static void checkListPass(List<MapUnity> mapUnityList, MapUnity mapUnity) |
|
|
|
{ |
|
|
|
|
|
|
|
for (int i = 0; i < mapUnityList.Count; i++) |
|
|
|
for (int i = mapUnityList.Count - 1; i >= 0; i--) |
|
|
|
{ |
|
|
|
Debug.Log( "XÊÇ£º" + mapUnityList[i].locationX + "YÊÇ£º" + mapUnityList[i].locationY); |
|
|
|
if (!checkNodePass(mapUnityList[i])) |
|
|
|
if (!checkNodePass(mapUnityList[i], mapUnity)) |
|
|
|
{ |
|
|
|
mapUnityList.Remove(mapUnityList[i]); |
|
|
|
mapUnityList.RemoveAt(i); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public static bool checkNodePass(MapUnity mapUnity) |
|
|
|
public static bool checkNodePass(MapUnity mapUnity, MapUnity centerMapUnity) |
|
|
|
{ |
|
|
|
LayerMask layerMask=new LayerMask(); |
|
|
|
int blockLayer = LayerMask.NameToLayer("Block"); |
|
|
|
layerMask |= (1 << blockLayer); |
|
|
|
bool canPass=true; |
|
|
|
//MapUnity playerOnNode = GameManager.Instance.playerOn.transform.GetComponent<MapUnity>();
|
|
|
|
var playerOnNode=GameManager.Instance.player; |
|
|
|
float distance = Vector3.Distance(playerOnNode.transform.position, mapUnity.transform.position); |
|
|
|
Vector3 dir = mapUnity.transform.position - playerOnNode.transform.position; |
|
|
|
Ray ray = new Ray(playerOnNode.transform.position, dir); |
|
|
|
//var playerOnNode=GameManager.Instance.player;
|
|
|
|
float distance = Vector3.Distance(centerMapUnity.transform.position, mapUnity.transform.position); |
|
|
|
Vector3 dir = mapUnity.transform.position - centerMapUnity.transform.position; |
|
|
|
Ray ray = new Ray(centerMapUnity.transform.position, dir); |
|
|
|
if (Physics.Raycast(ray, out RaycastHit raycastHit, distance, layerMask.value)) |
|
|
|
{ |
|
|
|
canPass = false; |
|
|
|
|