当前位置: 首页>>代码示例>>C#>>正文


C# Fighter.GetHit方法代码示例

本文整理汇总了C#中Fighter.GetHit方法的典型用法代码示例。如果您正苦于以下问题:C# Fighter.GetHit方法的具体用法?C# Fighter.GetHit怎么用?C# Fighter.GetHit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fighter的用法示例。


在下文中一共展示了Fighter.GetHit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AttackDetect

    public void AttackDetect(Fighter plr)
    {
        //projectile checks
        SPoint[] pHdr = new SPoint[8];
        SPoint[] plBox;
        plBox = plr.GetHitBox();
        int hbLen=4;
        float[] plAng ={0, Mathf.PI/2, Mathf.PI, -Mathf.PI/2};
        bool hitflag = true;
                for (int i=0; i<8; i++)
                        pHdr [i] = new SPoint (v [i].x + pos.x, v [i].y +pos.y);
        float atkLen = GetVNum ();
                for (int j = 0; j < atkLen; j++)
                        if (!CheckAxis (pHdr [0], ang [j], plBox, pHdr, hbLen, GetVNum ())) //no axis intersection
                                hitflag = false;

                if (hitflag)//test on the axis of the player hit box to confirm
                        for (int j = 0; j < 4; j++)
                                if (!CheckAxis (plBox [j], plAng [j], plBox, pHdr, hbLen,GetVNum ())) //no axis intersection
                                        hitflag = false;
                if (hitflag) {
                        active = false;
                        plr.GetHit (hitdata);
                        Detonate ();
                }
    }
开发者ID:cWalters2,项目名称:ShSoul,代码行数:26,代码来源:projectile.cs

示例2: AttackDetect

    public virtual void AttackDetect(Fighter plr)
    {
        bool multiHitFlag = false;
        string hitText;
        //std::stringstream log;
        bool hitflag = true;
        int atkLen;
        int spI=0;
        int spJ=0;
        int hbLen=4;
        SPoint[] plBox;
        SPoint[][] spBox;
        float[] plAng ={0, Mathf.PI/2, Mathf.PI, -Mathf.PI/2};
        int il = 0;
        if (fHelper.atkType  == GRAB)
             il = 1;
        else
            il = attackBox.trackList[fHelper.atkType].iLength;//num of tracks
        AttkTrack aBox = new AttkTrack();

        int polyHit=-1;
        plBox = plr.GetHitBox();//loads victim hitbox into plBox
        //each side is made from the vertices [i] and [+1]
        int numPoly = 0; //number of polygons in a track;
        int pInd = 0;//polygon index
        SPoint[] pHdr = new SPoint[8];

        //projectile checks
        for(int p=0;p<PROJ_LMT;p++){
            if(projectile[p].active){
                for(int i=0;i<8;i++)
                    pHdr[i]=new SPoint(projectile[p].v[i].x+projectile[p].pos.x,projectile[p].v[i].y+projectile[p].pos.y);
                atkLen =  projectile[p].GetVNum();
                for(int j = 0; j < atkLen; j++)
                    if(!CheckAxis(pHdr[0], projectile[p].ang[j], plBox, pHdr, hbLen, projectile[p].GetVNum()) ) //no axis intersection
                        hitflag = false;

                if(hitflag)//test on the axis of the player hit box to confirm
                    for(int j = 0; j < 4; j++)
                        if(!CheckAxis(plBox[j], plAng[j], plBox, pHdr, hbLen, projectile[p].GetVNum())) //no axis intersection
                            hitflag = false;
                if(hitflag){
                    projectile[p].active=false;
                    plr.GetHit(projectile[p].hitdata);
                }

            }
        }
        if(!atkTmr.IsReady()){//only continue if an attack is out
            if(fHelper.atkType==GRAB){
                aBox= new AttkTrack();
                aBox.noHit=false;
                float gCheck = grabTime/fHelper.actionTmr.GetLen();
                float fCheck = fHelper.frame/fHelper.actionTmr.GetLen();
                if(Mathf.Abs(fCheck-gCheck)<Time.deltaTime){

                    aBox.SetGrabBox(GetPos (), stats.grabRange);

                    float[] atAng = new float[4];
                    atAng[0]=0;
                    atAng[1]=Mathf.PI/2;
                    atAng[2]=Mathf.PI;
                    atAng[3]=-Mathf.PI/2;
                    //for(pInd=0;pInd<numPoly;pInd++)//iterate per poly
                    atkLen =  4;
                    hitflag=true;
                    attackBox.grabRange= stats.grabRange;
                    SPoint[] spArr = attackBox.FetchGrabRenderFrame(fHelper.frame, GetPos (), fHelper.IsFacingRight());

                    for(int j = 0; j < atkLen; j++)
                        if(!CheckAxis(spArr[j], atAng[j], plBox, spArr, hbLen, atkLen) ) //no axis intersection
                            hitflag = false;

                    if(hitflag)//test on the axis of the player hit box to confirm
                        for(int j = 0; j < 4; j++)
                            if(!CheckAxis(plBox[j], plAng[j], plBox, spArr, hbLen, atkLen)) //no axis intersection
                                hitflag = false;

                    if(hitflag){//hit
                        if(plr.grabbedPlr!=null){
                            plr.grabbedPlr. state=IDLE;
                            plr.grabbedPlr.Idle();
                            plr.grabbedPlr.fHelper.Animate ("Idle", true, 0);
                            plr.fHelper.Animate ("Idle", true, 0);
                            plr.grabbedPlr.stats.flags.mBusy=false;
                            plr.grabbedPlr.stats.flags.aBusy=false;
                            plr.grabbedPlr=null;
                            Idle();
                            fHelper.Animate ("Idle", true, 0);

                        }
                        else if(plr.stats.dodge.IsReady()){
                        grabbedPlr=plr;
                            plr.Grabbed ();}
                    }
                }

            }else{
            //attack checks

//.........这里部分代码省略.........
开发者ID:cWalters2,项目名称:ShSoul,代码行数:101,代码来源:Fighter.cs


注:本文中的Fighter.GetHit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。