Exemple #1
0
 public bool CreateColBox()
 {
     if (debugHitbox == null) {
         debugHitbox = new GameObject ();
         debugHitbox.name = "hb"+stats.id.num;
         debugHitbox.AddComponent<MeshFilter>();
         debugHitbox.AddComponent<MeshRenderer>();
         debugHitbox.GetComponent<MeshRenderer>().material = hitboxMat;
         HitBox cfHB = new HitBox();
         cfHB.AllocateFirstIndices(1);
         cfHB.AllocateSecondIndices(0,4);
         SPoint[]  cmbHB=GetHitBox();
         for(int i=0;i<4;i++){
             cfHB.SetVertex(cmbHB[i].x-GetPos().x*2, cmbHB[i].y-GetPos().y*2, 0, i);
         }
         cfHB.Render("HitBox", GetPos(), stats.id.num);
         MeshFilter mf = debugHitbox.GetComponent<MeshFilter>();
         mf.mesh = cfHB.mesh;
         DontDestroyOnLoad(debugHitbox);
         debugHitbox.transform.position = new Vector3(stats.motion.pos.x, stats.motion.pos.y, 0);
         return true;
     } else
         return false;
 }