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


C# SPoint类代码示例

本文整理汇总了C#中SPoint的典型用法代码示例。如果您正苦于以下问题:C# SPoint类的具体用法?C# SPoint怎么用?C# SPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: AttkData

 public AttkData(int arrNum)
 {
     noHit=false;
     isThrow = false;
     isVacuum = false;
     mag=0;
     dir=0;
     dmg=0;
     wgt=1;
     adir=1;
     vCount=0;
     dirHold=0;
     lastDist=0;
     firstDist=0;
     perimeter=0;
     curInd=0;
     if(arrNum>MAX_VERTS/2)
         arrNum=MAX_VERTS/2;
     attLen=arrNum;
     arrLmt = arrNum*2 +1;
     //vtxArr = new AttkVtx[arrLmt];
     int i=4;
     cenPt = new SPoint (0, 0);
     pBds = new SPoint[i];
     tSz=3;//determines the 'containment box' around the attack data
     // will occupy 1/tSz of the availiable window
 }
开发者ID:cWalters2,项目名称:NeonNinja,代码行数:27,代码来源:AttkData.cs

示例2: Stats

 public Stats()
 {
     motion.lastPos=new SPoint();
     motion.pos=new SPoint();
     motion.accl=new SPoint();
     motion.move=new SPoint();
     motion.vel=new SPoint();
     walk.shuffle=new STimer(0.5f);
     walk.slopeAng=new SPoint();
     edgegrab.rollSpd = 1.0f;
     edgegrab.edgeTmr=new STimer(1.0f);
     edgegrab.delayTmr=new STimer(0.2f);
     pivot.pTmr = new STimer (0.125f);
     pivot.fastTime=0.125f;
     pivot.slowTime = 0.4f;
     jump.tmr = new STimer (0.1f);
     guard.max = 60.0f*(Mathf.PI/180.0f);
     guard.arc=guard.max;
     guard.dir = 0;
     jump.tmr = new STimer (0.12f);
     jump.airJumps=0;
     jump.maxJumps=1;
     tumble.tmr = new STimer (1.1f);
     thr.dmg = 20;
     thr.dir = -1.0f;
     thr.mag = 3.0f;
     grav = 0.04f;
     grabRange = 24f;
     size = new SPoint ();
     land=new STimer(1.0f);
     dodge = new STimer ();
     flags.mBusy = false;
     flags.aBusy = false;
 }
开发者ID:cWalters2,项目名称:ShSoul,代码行数:34,代码来源:Stats.cs

示例3: addVal

 public void addVal(SPoint p, float m, float di, float diDist, float dm, float w)
 {
     vtxArr[curInd]= new AttkVtx(p, m, di, dm, w);
     curInd++;
     if(vCount==0){//indicates a reset
         dir=0;
         wgt=0;
         perimeter=0;
         diDist=0;
         xMin = p.x;
         xMax = p.x;
         yMin = p.y;
         yMax = p.y;
     }
     dir+=di;
     perimeter+=1;
     wgt+=w;
     vCount++;
     if(m>mag)
         mag=m;
     if(dm>dmg)
         dmg=dm;
     if(xMin>p.x)
         xMin=p.x;
     if(xMax<p.x)
         xMax = p.x;
     if(yMin>p.y)
         yMin=p.y;
     if(yMax<p.y)
         yMax=p.y;
 }
开发者ID:cWalters2,项目名称:NeonNinja,代码行数:31,代码来源:AttkData.cs

示例4: DrawStageBox

    public bool DrawStageBox(SPoint[] v, string mat, int vTot, int ind)
    {
        subMesh[ind].Clear();
        Vector3[] vertices = new Vector3[vTot];
        Color32[] col = new Color32[vTot];
        int vT = (vTot-2)*3;
        if (vT < 1)
            vT = 1;

        int[] tri = new int[vT];

        for (int i = 0; i<vTot; i++) {
            vertices[i]=new Vector3(v[i].x , v[i].y , 0);
            if(mat.CompareTo("platform")==0)
                col[i] = new Color32(130, 150,210,155);
            else
                col[i] = new Color32(20, 20, 210,255);
            if(i==vT){
                i=vT;
            }
            if(i>1){//basic triangle fan
                tri[(i-2)*3]=0;
                tri[(i-2)*3+1]=i-1;
                tri[(i-2)*3+2]=i;
            }

        }
        subMesh[ind].vertices=vertices;
        subMesh[ind].triangles = tri;
        subMesh[ind].colors32 = col;
        return true;
    }
开发者ID:cWalters2,项目名称:NeonNinja,代码行数:32,代码来源:TerrainBox.cs

示例5: Fire

    public virtual bool Fire(Fighter plr, SPoint o, SPoint v)
    {
        plNum = plr.plNum;
        vel = new SPoint (velx*v.x, vely);
        float diff;
        if (!plr.fHelper.IsFacingRight()) {
            diff = ((Mathf.PI / 2) - dir) * 2.0f;
            dir += diff;
        }
        //dir 2.0fis the vector to travel in per second
        //if(active)
        //	return false;
        active=true;
        pos=new SPoint(o.x,o.y+16);
        transform.position = new Vector3 (pos.x, pos.y, 0);

        ttl.SetTimer(2);
        for (int i=0; i<ps.Length; i++) {
            if (ps != null) {
                ps[i].transform.position = new Vector3 (pos.x, pos.y, 0);
                ps[i].enableEmission = true;
                ps[i].Play ();

            }
        }
        return true;
    }
开发者ID:cWalters2,项目名称:ShSoul,代码行数:27,代码来源:plKirochFBall.cs

示例6: Render

 public bool Render(string mat, SPoint p, int i)
 {
     bool hr = true;
     if(isActive)
         hr =  DrawColBox(pBounds[0], mat, p, i, GetJlength(0));
     return hr;
 }
开发者ID:cWalters2,项目名称:NeonNinja,代码行数:7,代码来源:HitBox.cs

示例7: 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

示例8: UpdatePos

 public void UpdatePos()
 {
     SPoint vec = new SPoint();
     vec.y=target.y-at.y;
     vec.x=target.x-at.x;
     if(distTarget<minDist)
         distTarget=minDist;
     float movDistSq = vec.SqDistFromOrigin();
     float decel=0.5f;
     if(movDistSq>panSpeed*panSpeed){//moving too fast
         float dir = Mathf.Atan2(vec.y, vec.x);
         vec.x=Mathf.Cos(dir)*panSpeed;
         vec.y=Mathf.Sin(dir)*panSpeed;
         at.x+=vec.x*decel;
         at.y+=vec.y*decel;
     }else{
         at.x+=vec.x*decel;
         at.y+=vec.y*decel;
     }
     if(distTarget>dist)
         if(distTarget>dist+zoomSpeed)
             dist+=zoomSpeed;
     else
         dist=distTarget;
     else
         if(distTarget<dist-zoomSpeed)
             dist-=zoomSpeed;
     else
         dist=distTarget;
 }
开发者ID:cWalters2,项目名称:NeonNinja,代码行数:30,代码来源:CameraController.cs

示例9: DrawAttkBox

    public void DrawAttkBox(SPoint[] v, string mat, int n, int endN, SPoint p, int pNum,  int t, int poly)
    {
        //specialized manual function for attackboxes
        subMesh [poly] = new Mesh ();
        int vTot = endN - n + 1;
        Vector3[] vertices = new Vector3[vTot];
        Color32[] col = new Color32[vTot];

        //std::stringstream hbName;
        string hbName = "P#" + pNum + "HB-" + t + "-" + poly;

        for (int i = n; i <= endN; i++) {
            vertices [i-n] = new Vector3 (v [i].x + p.x, v [i].y + p.y, 0);
            col [i-n] = new Color32 (0, 250, 20, 150);
        }
        int tTot = (vTot - 2) * 3;
        int[] tri = new int[tTot];
        for (int i = 0; i<(tTot/3);i++) {//triangle fan
            tri[i*3]=0;
            tri[(i*3)+1]=i+1;
            tri[(i*3)+2]=i+2;
        }
        subMesh[poly].vertices=vertices;
        subMesh[poly].triangles = tri;
        subMesh[poly].colors32 = col;
    }
开发者ID:cWalters2,项目名称:NeonNinja,代码行数:26,代码来源:AttkBox.cs

示例10: AllocateSecondIndices

 public void AllocateSecondIndices(int ind, int num)
 {
     jLength[ind] = num;
     pBounds[ind] = new SPoint[num];
     jLength[ind] = num;
     ang[ind] = new float[num];
     subMesh [ind] = new Mesh ();
 }
开发者ID:cWalters2,项目名称:NeonNinja,代码行数:8,代码来源:TerrainBox.cs

示例11: CameraController

    public CameraController()
    {
        dist=defDist;

        panSpeed=3.1f;
        zoomSpeed=4.1f;
        yFOV_Rad=45.0f*(Mathf.PI/180.0f);//default for ogre's camera deg
        distTarget=90;
        at = new SPoint (0, defDist);
        target = new SPoint (0, 0);
    }
开发者ID:cWalters2,项目名称:NeonNinja,代码行数:11,代码来源:CameraController.cs

示例12: AllocateSecondIndices

 public void AllocateSecondIndices(int ind, int num)
 {
     jLength[ind] = num;
     aVtx[ind] = new AttkVtx[num];
     atkAng[ind] = new float[num];
     pBounds[ind] = new SPoint[num];
     for (int i=0; i<num; i++) {
             atkAng [ind] [i] = 0;
         aVtx[ind][i]=new AttkVtx();
         }
 }
开发者ID:cWalters2,项目名称:NeonNinja,代码行数:11,代码来源:AttkTrack.cs

示例13: CheckAxis

    public bool CheckAxis(SPoint origin, float dir, SPoint pCen, SPoint[] aBox, int aNum)
    {
        // helper function for the Separating Axis Theorem that takes an axis defined by origin and dir
        //re-conditioned to handle the parameters of the attack box
        bool isHit = true;
        float projMin, projMax, hitMin, hitMax, distSq, projVal, cVal;
        SPoint projVec, nVec, rVec, cVec;
        projVec = new SPoint();
        projMin = 100;
        projMax = -100;
        hitMin = 100;
        hitMax = -100;
          int   pNum = 1;//remove from param list!
        for (int i = 0; i < aNum; i++)
        {
            projVec.x = aBox[i].x - origin.x;
            projVec.y = aBox[i].y - origin.y;

            distSq = projVec.x * projVec.x + projVec.y * projVec.y;
            nVec = projVec.GetNormal();

            cVec = new SPoint(Mathf.Cos(dir + Mathf.PI / 2), Mathf.Sin(dir + Mathf.PI / 2));

            cVal = -cVec.Dot(nVec);
            //projVal = sin(rAng)*abs(sin(rAng))*distSq;
            projVal = cVal * Mathf.Abs(cVal) * distSq;

            if (projVal < projMin)
                projMin = projVal;
            if (projVal > projMax)
                projMax = projVal;
        }
        float eps = 0.00001f;

            projVec.x = pCen.x - origin.x;
            projVec.y = pCen.y - origin.y;
            distSq = projVec.x * projVec.x + projVec.y * projVec.y;
            cVec = new SPoint(Mathf.Cos(dir + Mathf.PI / 2), Mathf.Sin(dir + Mathf.PI / 2));
            nVec = projVec.GetNormal();
            cVal = -cVec.Dot(nVec);
            //projVal = sin(rAng)*abs(sin(rAng))*distSq;
            projVal = cVal * Mathf.Abs(cVal) * distSq;
            if (projVal < hitMin)
                hitMin = projVal;
            if (projVal > hitMax)
                hitMax = projVal;

        if ((projVal >= projMin) && (projVal <= projMax))
            isHit = true;
        else
            isHit = false;
        return isHit;
    }
开发者ID:cWalters2,项目名称:NeonNinja,代码行数:53,代码来源:Projectile.cs

示例14: Start

 // Use this for initialization
 void Start()
 {
     numPos = 4;
     menuSel = 0;
     vThresh = 0.5f;
     mLoc = new SPoint [4];
     mLoc [0] = new SPoint (-7.1f, 0.35f);
     mLoc [1] = new SPoint (-7.1f, -0.33f);
     mLoc [2] = new SPoint (-7.1f, -0.956f);
     mLoc [3] = new SPoint (-7.1f, -1.69f);
     inputTmr = new STimer (0.4f);
 }
开发者ID:cWalters2,项目名称:ShSoul,代码行数:13,代码来源:MenuHandler.cs

示例15: AttkVtx

    public float wgt; //weight used in the hit function

    #endregion Fields

    #region Constructors

    public AttkVtx( )
    {
        dmg=0;
        dir=0;
        wgt=0;
        mag=0;
        rad=0;
        pri = 0;
        pos = new SPoint(0,0);
        next = null;
        frame = -1;
        brk = false;
    }
开发者ID:cWalters2,项目名称:NeonNinja,代码行数:19,代码来源:AttkVtx.cs


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