예제 #1
0
파일: Fighter.cs 프로젝트: cWalters2/ShSoul
    protected bool ClashCheck(Fighter 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;
    }