public void ExecAction(NinjaHelper fh, Stats stats, int ind) { if (act[ind] == BURST) { stats.walk.gndSpeed=val[ind]*fh.IntFacingRight(); } if (act[ind] == AIRBURST) { stats.motion.vel.x =valSp[ind].x*fh.IntFacingRight(); stats.motion.vel.y =valSp[ind].y; fh.airborne=true; } if (act[ind] == BRAKE) { stats.walk.gndSpeed=stats.walk.gndSpeed*val[ind]; } if (act[ind] == AIRBRAKE) { stats.motion.vel.x = (1.0f-valSp[ind].x)*stats.motion.vel.x; stats.motion.vel.y =(1.0f-valSp[ind].y)*stats.motion.vel.y; } if (act[ind] == AIRHOVER) { if ((valSp[ind].x == valSpEnd[ind].x) && (valSp[ind].y == valSpEnd[ind].y)) { stats.motion.vel.x = valSp[ind].x * fh.IntFacingRight(); stats.motion.vel.y = valSp[ind].y + stats.grav; }else{ float a = iTmr[cInd].tmr/ iTmr[cInd].GetLen(); float b = 1.0f - a; stats.motion.vel.x = a*valSp[ind].x + b*valSpEnd[ind].x * fh.IntFacingRight(); stats.motion.vel.y = a*valSp[ind].y + b*valSpEnd[ind].y + stats.grav; } } if (act[ind] == SLIDE) { stats.walk.gndSpeed=val[ind]*fh.IntFacingRight(); } }
public void RunTimers(float timeLapsed, NinjaHelper fh, Stats st) { if (cInd >= 0) { if (iTmr [cInd].RunTimer (timeLapsed)) { ExecAction(fh, st, cInd); if (cInd < len-1) cInd++; else cInd = -1; }else{ if(act[cInd]==SLIDE){ ExecAction(fh, st, cInd); } else if (act[cInd] == AIRHOVER) { fh.airborne = true; ExecAction(fh, st, cInd); } } } }
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); }