protected bool IsPointHitWall(Vector2 pos) { if (!_aiRunNear) { _aiRunNear = GetComponent <AIAirRunNear>(); } if (_aiRunNear == null) { return(true); } //检测 点是否撞墙 if (_aiRunNear.IsHitDiBan(pos, TcDistance) || _aiRunNear.IsHitDiBan(pos, -TcDistance) || _aiRunNear.IsHitDiBan(pos, TcDistance, "") || _aiRunNear.IsHitDiBan(pos, -TcDistance, "")) { return(true); } return(false); }
// Start is called before the first frame update void Start() { _airGameBody = GetComponent <AirGameBody>(); _roleDate = GetComponent <RoleDate>(); _aiAirRunNear = GetComponent <AIAirRunNear>(); }
// Start is called before the first frame update void Start() { _aiAirRunNear = GetComponent <AIAirRunNear>(); }
void GetShow() { //显示时候 可以释放特效 替身术 等 //隐身 去哪 1.玩家头顶 2.玩家前后 if (!_airRun) { _airRun = GetComponent <AIAirRunNear>(); } //找点 先找身后 再找前面 float __x; float __y; if (YinShenType == 2) { int yu = ChoseNums % 3; if (yu == 1) { __x = thePlayer.transform.position.x + 2 + GlobalTools.GetRandomDistanceNums(4); __y = thePlayer.transform.position.y - 1 + GlobalTools.GetRandomDistanceNums(2); } else if (yu == 2) { __x = thePlayer.transform.position.x - 2 - GlobalTools.GetRandomDistanceNums(4); __y = thePlayer.transform.position.y - 1 + GlobalTools.GetRandomDistanceNums(2); } else { if (_yinShenPosType == "s") { //print(" ssssss "); //上方 __x = thePlayer.transform.position.x; __y = __y = thePlayer.transform.position.y + 5 + GlobalTools.GetRandomDistanceNums(3); } else if (_yinShenPosType == "zy") { __x = GlobalTools.GetRandomNum() > 50 ? thePlayer.transform.position.x - atkDistanceX : thePlayer.transform.position.x + atkDistanceX; __y = thePlayer.transform.position.y + 1 + GlobalTools.GetRandomDistanceNums(1); } else { __x = GlobalTools.GetRandomNum() > 50 ? thePlayer.transform.position.x - atkDistanceX : thePlayer.transform.position.x + atkDistanceX; __y = thePlayer.transform.position.y - 1 + GlobalTools.GetRandomDistanceNums(4); } } } else { if (this.transform.position.x > thePlayer.transform.position.x) { if (ChoseNums == 0) { __x = thePlayer.transform.position.x - atkDistanceX; } else { __x = thePlayer.transform.position.x + atkDistanceX; } } else { if (ChoseNums == 0) { __x = thePlayer.transform.position.x + atkDistanceX; } else { __x = thePlayer.transform.position.x - atkDistanceX; } } __y = thePlayer.transform.position.y; } showPos = new Vector2(__x, __y); if (ChoseNums >= 3) { showPos = yinshenQianPos; } else { //检测 点 是否 被碰撞 左右 上下 判断 if (_airRun.IsHitDiBan(showPos, hitDiBanDistance) || _airRun.IsHitDiBan(showPos, -hitDiBanDistance) || _airRun.IsHitDiBan(showPos, hitDiBanDistance, "") || _airRun.IsHitDiBan(showPos, -hitDiBanDistance, "")) { ChoseNums++; if (ChoseNums == 1) { GetShow(); } else { if (YinShenType == 2) { GetShow(); } else { // 没有可以用的点 ChoseNums = 0; //原地 显示 showPos = this.transform.position; } return; } } } if (!IsShowing) { IsShowing = true; ShowXuetiao(); ChoseNums = 0; this.transform.position = showPos; } //print(" 找到点 "+showPos); }