public bool ClashCheck(Ninja opp, SPoint[][] pBox, float[][] pAng) { if (opp.atkTmr.IsReady ()) return false; SPoint[][] oBox=null; float [][] oAngs=null; oBox = opp.GetClashBox (oBox); int pLen = pBox.Length; //abox = obox //plBox = pBox; if (oBox == null) return false; oAngs = opp.GetClashAngs (oAngs); int numPoly = pBox.Length; bool hitCheck = false; bool hitflag = false; int atkLen = 0; int pInd = 0; for(int oInd=0;oInd<numPoly;oInd++){//iterate per poly hitflag=true; atkLen = pBox[oInd].Length; for(int j = 0; j < atkLen; j++) if(!CheckAxis(oBox[oInd][j], oAngs[oInd][j], pBox[pInd], oBox[oInd], pLen, oBox[oInd].Length) ) //no axis intersection hitflag = false; if(hitflag)//test on the axis of the player hit box to confirm for(int j = 0; j < pLen; j++) if(!CheckAxis(pBox[pInd][j], pAng[pInd][j], pBox[pInd], oBox[oInd], pLen, oBox[oInd].Length)) //no axis intersection hitflag = false; if(hitflag) hitCheck=true; } hitflag=hitCheck; if (hitCheck) { if(GetCurPriority()>=opp.GetCurPriority()) opp.Recoil (1); if(GetCurPriority()<=opp.GetCurPriority()){ Recoil(1); return true; }else return false; }else return false; }
public bool ClashCheck(Ninja opp) { SPoint[] pBox = new SPoint[8]; int hbLen = 4; float[] pAng = { 0, Mathf.PI / 2, Mathf.PI, -Mathf.PI / 2 }; for (int i = 0; i < 8; i++) pBox[i] = new SPoint(v[i].x + pos.x, v[i].y + pos.y); float atkLen = GetVNum(); if (opp.atkTmr.IsReady()) return false; SPoint[][] oBox = null; float[][] oAngs = null; oBox = opp.GetClashBox(oBox); int pLen = pBox.Length; //abox = obox //plBox = pBox; if (oBox == null) return false; oAngs = opp.GetClashAngs(oAngs); int numPoly = oBox.Length; bool hitCheck = false; bool hitflag = false; int pInd = 0; for (int oInd = 0; oInd < numPoly; oInd++) {//iterate per poly hitflag = true; atkLen = oBox[oInd].Length; for (int j = 0; j < atkLen; j++) if (!CheckAxisO(oBox[oInd][j], oAngs[oInd][j], pBox, oBox[oInd], pLen, oBox[oInd].Length)) //no axis intersection hitflag = false; if (hitflag)//test on the axis of the player hit box to confirm for (int j = 0; j < pLen; j++) if (!CheckAxisO(pBox[j], ang[j], pBox, oBox[oInd], pLen, oBox[oInd].Length)) //no axis intersection hitflag = false; if (hitflag) hitCheck = true; } hitflag = hitCheck; if (hitCheck) { return true; } else return false; }