void Load(string file, SPoint p) { hitbox = new HitBox(); hitbox.AllocateFirstIndices(1);//for a 1 dimensional array of vertices hitbox.AllocateSecondIndices(0, 4); hitbox.SetVertex(-stats.size.x/2, 0, 0, 3); hitbox.SetVertex(stats.size.x/2, 0, 0, 2); hitbox.SetVertex(stats.size.x/2, stats.size.y, 0, 1); hitbox.SetVertex(-stats.size.x/2, stats.size.y, 0, 0); //fHelper.Load(); int pNum=5;//stats.id.num; oRotQuat = GetRotation(); //pPtcl.LoadSerenitySwordParticles(fHelper.spriteNode, eng, pNum); //pPtcl.Emit(0, SPoint(0, 0), 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; }
public virtual void LoadPlayer() { attackBox = new AttkBox(MOVENUM); hitbox = new HitBox(); stats.LoadStats(STATS_FILE); attackBox.LoadFromScript(SCRIPT_FILE, 1, stats.size.y); LoadMoveScript(MOVESCRIPT); stats.id.num = plNum;//todo not hard code attackBox.grabRange = stats.grabRange; hitbox = new HitBox(); fHelper = new NinjaHelper (); SetPlayer(); transform.Rotate(0, 90.0f, 0); fHelper.Animate("Idle", true, 0); FindPNum(); hitbox.AllocateFirstIndices(1);//for a 1 dimensional array of vertices hitbox.AllocateSecondIndices(0, 4); hitbox.SetVertex(-stats.size.x/2, 0, 0, 3); hitbox.SetVertex(stats.size.x/2, 0, 0, 2); hitbox.SetVertex(stats.size.x/2, stats.size.y, 0, 1); hitbox.SetVertex(-stats.size.x/2, stats.size.y, 0, 0); //pPtcl.LoadParticles(eng, stats.id.num, "Yara"); //LoadMoveScript(MOVESCRIPT); }
public virtual void LoadPlayer() { FindPNum (); attackBox = new AttkBox (); attackBox.grabRange = stats.grabRange; hitbox = new HitBox(); fHelper = new FighterHelper (); hitbox.AllocateFirstIndices(1);//for a 1 dimensional array of vertices hitbox.AllocateSecondIndices(0, 4); hitbox.SetVertex(-stats.size.x/2, 0, 0, 3); hitbox.SetVertex(stats.size.x/2, 0, 0, 2); hitbox.SetVertex(stats.size.x/2, stats.size.y, 0, 1); hitbox.SetVertex(-stats.size.x/2, stats.size.y, 0, 0); fHelper.grabBox = new HitBox (); fHelper.grabBox.AllocateFirstIndices (1); fHelper.grabBox.AllocateSecondIndices (0, 4); fHelper.grabBox.SetVertex (-stats.size.x / 2, stats.size.y + stats.edgegrab.hgt, 0, 0); fHelper.grabBox.SetVertex (-stats.size.x / 2, stats.size.y, 0, 3); fHelper.grabBox.SetVertex (-stats.size.x / 2 - stats.edgegrab.wid, stats.size.y, 0, 2); fHelper.grabBox.SetVertex (-stats.size.x / 2 - stats.edgegrab.wid, stats.size.y + stats.edgegrab.hgt, 0, 16); fHelper.grabBox.isActive = false; fHelper.sScale=1; //pPtcl.LoadParticles(eng, stats.id.num, "Yara"); //LoadMoveScript(MOVESCRIPT); }
/*void LoadMoveScript(string s){ int endL, enPos; float dVal; std:string par, val, line; ifstream infile;//get the polygon count for the arrays infile.open(s); if (infile.is_open()){ while ( infile.good() ){ getline (infile,line); endL = line.length()-1; enPos = line.find_first_of("="); par = line.substr(0, enPos); val = line.substr(enPos+1, line.length()); dVal = atof(val.c_str()); if(par.compare("scSpeed") == 0) scSpd=dVal; } } }*/ bool LoadPlayer() { FindPNum (); attackBox = new AttkBox (); hitbox = new HitBox(); hitbox.AllocateFirstIndices(1);//for a 1 dimensional array of vertices hitbox.AllocateSecondIndices(0, 4); hitbox.SetVertex(-stats.size.x/2, 0, 0, 3); hitbox.SetVertex(stats.size.x/2, 0, 0, 2); hitbox.SetVertex(stats.size.x/2, stats.size.y, 0, 1); hitbox.SetVertex(-stats.size.x/2, stats.size.y, 0, 0); fHelper.grabBox = new HitBox(); fHelper.grabBox.AllocateFirstIndices(1); fHelper.grabBox.AllocateSecondIndices(0, 4); fHelper.grabBox.SetVertex(-stats.size.x/2, stats.size.y + stats.edgegrab.hgt, 0, 0); fHelper.grabBox.SetVertex(-stats.size.x/2, stats.size.y, 0, 3); fHelper.grabBox.SetVertex(-stats.size.x/2 - stats.edgegrab.wid, stats.size.y, 0, 2); fHelper.grabBox.SetVertex(-stats.size.x/2 - stats.edgegrab.wid, stats.size.y + stats.edgegrab.hgt, 0, 16); fHelper.grabBox.isActive = false; fHelper.sScale=1; //fHelper.Load(eng, MESH_FILE, GetPos()); stats.LoadStats(STATS_FILE); attackBox.LoadFromScript(SCRIPT_FILE, fHelper.sScale, stats.size.y); stats.id.num = plNum;//todo not hard code SetPlayer (); transform.Rotate (0, 90.0f, 0); fHelper.Animate ("Idle", true, 0); LoadMoveScript (MOVE_FILE); // //psysword.Load( PSYSWORD_MESH_FILE, GetPos());//load sword model //psysword.LoadAnimHolder( PSYSWORD_ANIMHELP, GetPos());//load serenity's anims for reference psysword.attackBox.LoadFromScript(SCRIPT_FILE, fHelper.sScale, stats.size.y); SPoint bT = new SPoint(0, -psysword.stats.size.y); psysword.attackBox.TranslateAttack(bT, NB); psysword.attackBox.TranslateAttack(bT, SB); psysword.attackBox.TranslateAttack(bT, UB); psysword.attackBox.TranslateAttack(bT, DB); //LoadMoveScript(MOVESCRIPT); return true; }