Пример #1
0
 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;
 }
Пример #2
0
    public void Awake()
    {
        PROJ_LMT = 3;
        chLv = 2.0f;
        chMx = 4.0f;
        stunTimer = new STimer ();
        thwTmr = new STimer (throwTime);
        grbTmr = new STimer (grabTime);
        attackBox=new AttkBox(KIR_NUMANIMS);
        hitbox = new HitBox();

        LoadPlayer ();
        stats.id.fighter = KIROCH;

        chargeT=0;
        if (projectile == null)
            projectile = new plProjectile[PROJ_LMT];
        for (int i=0; i<PROJ_LMT; i++)
            projectile [i]=new plProjectile();
        for(int i=0;i<PROJ_LMT;i++){
            projectile[i].SetAtkData(12.0f, 1.6f, 2.0f);
            projectile[i].Scale(5.0f);
            projectile[i].ps = fireBall[i];
        }
        sbSpd=0;
        scSpd=0;
    }
Пример #3
0
 // 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);
 }
Пример #4
0
 // Use this for initialization
 void Start()
 {
     mh = GameObject.FindGameObjectWithTag ("MatchHelper").GetComponent ("MatchHelper") as MatchHelper;
     numPos = 4;
     menuSel = 0;
     vThresh = 0.5f;
     mLoc = new SPoint [4];
     mLoc [0] = new SPoint (-280.0f, 120.0f);
     mLoc [1] = new SPoint (-280.0f, 60.0f);
     mLoc [2] = new SPoint (-280.0f, 0.0f);
     mLoc [3] = new SPoint (-280.0f, -100.0f);
     inputTmr = new STimer (0.2f);
     isSelected = false;
 }
Пример #5
0
 // Use this for initialization
 void Start()
 {
     numPos = 4;
     menuSel = 1;
     vThresh = 0.5f;
     mLoc = new SPoint [4];
     mLoc [0] = new SPoint (100.0f, 5.0f);
     mLoc [1] = new SPoint (100.0f,-35.0f);
     mLoc [2] = new SPoint (100.0f, -75.0f);
     mLoc [3] = new SPoint (100.0f, -115.0f);
     inputTmr = new STimer (0.3f);
     if (Time.deltaTime == 0)
         Time.timeScale = 1;
 }
Пример #6
0
 // Use this for initialization
 void Start()
 {
     numPos = 3;
     menuSel = 0;
     vThresh = 0.5f;
     mLoc = new SPoint [numPos];
     mLoc [0] = new SPoint (100.0f, 5.0f);
     mLoc [1] = new SPoint (100.0f, -15.0f);
     mLoc [2] = new SPoint (100.0f, -35.0f);
     inputTmr = new STimer (lTime);
     selTmr = new STimer (lTime);
     mh = GameObject.FindGameObjectWithTag ("MatchHelper").GetComponent ("MatchHelper") as MatchHelper;
     DebugSelDisplay (mh.GetDebugMode ());
     stockNum = mh.GetStocks ();
     stockDisp.text=stockNum.ToString();
 }
Пример #7
0
    //Player grabbedPlr;
    public void Awake()
    {
        thwLockTmr = new STimer();
        specThrowTmr = new STimer (specThwTime);
        specGrabTmr = new STimer (specGrabTime);
        aSpecThrowTmr = new STimer(airspecThrowTime);
        thwTmr = new STimer (throwTime);
        grbTmr = new STimer (grabTime);
        stunTimer = new STimer ();
        spb1 = new STimer ();
        spb2 = new STimer ();
        aSpecGrabTmr = new STimer ( );

        LoadPlayer();
        stats.id.fighter = YARA;
        rage=0;
    }
Пример #8
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public KeyboardInputSender()
        {
            TimeLeftForKey = new Dictionary <Keys, double>();
            foreach (Keys key in (Keys[])Enum.GetValues(typeof(Keys)))
            {
                if (TimeLeftForKey.ContainsKey(key))
                {
                    continue;
                }
                TimeLeftForKey.Add(key, 0.0);
            }

            Timer           = new STimer();
            Timer.Elapsed  += OnTimerElapsed;
            Timer.AutoReset = true;
            Timer.Interval  = TIMER_INTERVAL;
            Timer.Start();
        }
Пример #9
0
    // Use this for initialization
    public void Awake()
    {
        PROJ_LMT = 0;
        stunTimer = new STimer ();
        thwTmr = new STimer (throwTime);
        grbTmr = new STimer (grabTime);
        scTmr = new STimer ();
        spa1 = new STimer ();
        spb1 = new STimer ();
        spc1 = new STimer ();
        spc2 = new STimer ();
        spc3 = new STimer ();
        spaTmr = new STimer (1.5f);
        hitbox = new HitBox();
        fHelper = new FighterHelper ();

        stats.id.fighter = SERENITY;
        attackBox=new AttkBox(SER_NUMANIMS);
        stats.tumble.loop=true;
        //psysword=plSerenSword(plNum);
        scSpd=0;

        //for(int i=0;i<PROJ_LMT;i++){
        //	projectile[i].SetAtkData(12.0f, 1.6f, 2.0f);
        //	projectile[i].Scale(5.0f);
        //}

        scSpd=0;

        GameObject goSword = Instantiate(Resources.Load("SerenSword")) as GameObject;
        DontDestroyOnLoad(goSword);

        psysword = goSword.GetComponent ("plSerenSword") as plSerenSword;
        psysword.fHelper.TR.Rotate (0, -90, 0);
        psysword.fHelper.FaceRight (true);
        LoadPlayer ();
        psysword.transform.position = new Vector3 (transform.position.x + 10, transform.position.y + 10, 0);
        psysword.stats.motion.pos = new SPoint (transform.position.x + 10, transform.position.y + 10);
        psysword.plNum=11;
    }
Пример #10
0
    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();

        jump.tmr = new STimer (0.1f);

        jump.tmr = new STimer (0.12f);

        grav = 0.04f;
        grabRange = 24f;
        size = new SPoint ();
        land=new STimer(1.0f);
        dodge = new STimer ();
        flags.mBusy = false;
        flags.aBusy = false;
    }
Пример #11
0
 public plProjectile()
 {
     dbgBox = null;
     hitdata = new AttkData ();
     active=false;
     vNum = V_NUM;
     pScale = 1.0f;
     v = new SPoint[V_NUM];
     ang = new float[V_NUM];
     v[0]=new SPoint(0,  1);
     v[1]=new SPoint(-0.71f, .71f);
     v[2]=new SPoint(-1, 0);
     v[3]=new SPoint(-0.71f,-0.71f);
     v[4]=new SPoint(0, -1);
     v[5]=new SPoint(0.71f,-0.71f);
     v[6]=new SPoint(1, 0);
     v[7]=new SPoint(0.71f,0.71f);
     ttl = new STimer ();
     for(int j = 0; j < vNum-1; j++)
         ang[j] = Mathf.Atan2(v[j+1].y - v[j].y, v[j+1].x - v[j].x); //store angles for detection
     ang[V_NUM-1] = Mathf.Atan2(v[0].y - v[vNum-1].y, v[0].x - v[vNum-1].x);
 }
Пример #12
0
    public static bool UpdateFadeState(out float factor, ref FadeState fadeState, ref STimer fadeTime, float fadeInterval)
    {
        bool flag = false;

        factor = 1f;
        if (fadeState == FadeState.FadeIn)
        {
            float num = fadeTime.Update();
            if (num >= fadeInterval)
            {
                factor    = 1f;
                fadeState = FadeState.Normal;
            }
            else
            {
                factor = num / fadeInterval;
            }
            return(true);
        }
        if (fadeState != FadeState.FadeOut)
        {
            return(flag);
        }
        float num2 = fadeTime.Update();

        if (num2 >= fadeInterval)
        {
            factor    = 0f;
            fadeState = FadeState.Stopped;
        }
        else
        {
            factor = 1f - (num2 / fadeInterval);
        }
        return(true);
    }
Пример #13
0
 public void SetInstruct(int acInd, float ti, string ins, SPoint s)
 {
     iTmr [acInd] = new STimer(ti);
     valSp [acInd] = new SPoint (s.x, s.y);
     valSpEnd[acInd] = new SPoint(s.x, s.y);
     act[acInd] = ActToInd (ins);
 }
Пример #14
0
    // Use this for initialization
    void Awake()
    {
        swordTarget = new SPoint (0,0);
        aBox=null;
        lastMove = new SPoint ();
        thwTmr = new STimer (throwTime);
        psMove = new SPoint ();
        accl = new SPoint ();
        vel = new SPoint ();
        stunTmr = new STimer ();
        atkMode=0;
        hovHgt = 5;
        hovDst = 7;
        trackWgt = 0.04f;
        spdLmt = 0.5f;
        idleRotSpd = 30;
        oRotQuat = new Quaternion();
        oRotVec = new Vector3(0, -1, 0);
        cRespTimer=0;
        isFacingRight=true;
        //C psMove info here
        cRespDist=new float[5];
        cRespTime=new float[5];
        cRespDist[0]=30;
        cRespDist[1]=60;
        cRespDist[2]=30;
        cRespDist[3]=30;
        cRespDist[4]=30;
        for(int i=0;i<5;i++)//square this for efficiency
            cRespDist[i]=cRespDist[i]*cRespDist[i];
        cRespTime[0]=0.3f;
        cRespTime[1]=0.5f;
        cRespTime[2]=0.3f;
        cRespTime[3]=0.3f;
        cRespTime[4] = 0.2f;
        cStartPos=new SPoint(0, 0);
        cAtk=0;
        LoadPlayer ();
        stats.id.fighter=SERENITYSWORD;
        stats.id.num=plNum*100+11;
        stats.size.y=9;
        stats.size.x=9;

        SetPlayer ();
        startCol = new Color32 (230, 42, 84, 255);
        readyCol = new Color32 (24, 142, 230, 255);
    }
Пример #15
0
 public void Start()
 {
     fHelper.Animate ("Idle", true, 0);
     Vector3 oRotFoc = new Vector3(0, -1, 0);
     oRotFoc.Normalize();
     Quaternion q = Quaternion.FromToRotation( oRotVec,oRotFoc)*GetRotation();
     Rotate(q);
     grbTmr = new STimer (0.2f);
     debugFadeTmr = new STimer (0.5f);
 }
Пример #16
0
    public void Start()
    {
        //stats=new Stats();
        FindConsole ();
        hovTmr = new STimer(1.0f);
        hovDir = new SPoint(0, 0);
        hovFin = new SPoint(0, 0);
        hovRec = 1;
        dashTmr = new STimer(DASH_TIME);
        rollInvOn = new STimer ();
        rollInvOff = new STimer ();
        debugFadeTmr = new STimer (0.5f);
        atkTmr = new STimer ();
        NORM_ORIENT = new Vector3 (0, 90.0f, 0);
        if (debugModeOn)
            CreateColBox ();
        GameObject go;
        int pCt = 0;
        for (int i=1; i<5; i++) {
            go = GameObject.FindGameObjectWithTag ("Player" + i);
            if (go != null)
                pCt++;
            }
        hitHolder = null;
        stunTimer = new STimer ();
        fighterList = new Fighter[pCt-1];
        int plC=0;
        int otC = 0;
        go=new GameObject();
        for(int i=1;i<pCt+1;i++){
            go =  GameObject.FindGameObjectWithTag("Player"+i);
            if(go!=null){

                if(i!=plNum){
                    fighterList[otC]=go.GetComponent<Fighter>();
                    otC++;
                }
            plC++;
            }
        }
    }
Пример #17
0
    public void Roll()
    {
        if (state == GUARD)
                        stats.flags.mBusy = false;
        if ((stats.flags.aBusy)||(stats.flags.mBusy)||(fHelper.airborne)||(!atkTmr.IsReady()))
                        return;
        PivotEnd ();
        stats.flags.mBusy = true;
        stats.flags.aBusy = true;

        float rTime = fHelper.Animate ("Roll", false, 0);
        fHelper.actionTmr.SetTimer(rTime);
        stats.flags.invuln = true;
        fHelper.TurnAfterAnim();
         state =  ROLLING;
        stats.walk.gndSpeed = fHelper.IntFacingRight()*rollBurstSpeed;
        if(((leftLip!=0)&&(rightLip!=0))&&((stats.motion.pos.x == leftLip) || (stats.motion.pos.x == rightLip)))
                        stats.walk.gndSpeed = 0;
        rollInvOn.SetTimer (rTime * rollInvulnStart);
        rollInvOff = new STimer(rTime*(rollInvulnEnd-rollInvulnStart));
    }
Пример #18
0
 void Start()
 {
     ps = new Stats[2];
     GameObject g1 = GameObject.FindGameObjectWithTag ("Player1");
     GameObject g2 = GameObject.FindGameObjectWithTag ("Player2");
     Fighter f1 = g1.GetComponent<Fighter> ();
     Fighter f2 = g2.GetComponent<Fighter> ();
     ps [0] = f1.stats;
     ps [1] = f2.stats;
     numPos = 3;
     menuSel = 0;
     vThresh = 0.3f;
     mLoc = new SPoint [4];
     mLoc [0] = new SPoint (-80.0f, 5.0f);
     mLoc [1] = new SPoint (-80.0f, -15.0f);
     mLoc [2] = new SPoint (-80.0f, -35.0f);
     paused = false;
     plrP = 0;
     inputTmr = new STimer (0.35f);
     tmrT = Time.deltaTime;
 }
Пример #19
0
 // Use this for initialization
 void Start()
 {
     fTimer = new STimer (1.0f);
     fTimer.SetTimer ();
 }
Пример #20
0
    public bool LoadStats(TextAsset file)
    {
        //loads the player's stats from the designated script
        //if not called, defaults from pl[NAME] will be used
        //should these be undefined, defaults from c_PlayerStats will be used
        bool hr = true;
        string line = "";
        int splitInd = 0;
        string[] lines = file.text.Split('\n');
        try{

            foreach (string rline in lines){
                line = rline.Trim();
                //while ((line = infile.ReadLine()) != null) {

                    if((line.Length>10)&&(line.Substring(0,10).CompareTo("guard.max=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        guard.max=float.Parse(line.Substring(splitInd, line.Length-10) )*(Mathf.PI/180.0f);

                    }else if((line.Length>15)&&(line.Substring(0,15).CompareTo("walk.loopstart=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        walk.loopStart=float.Parse(line.Substring(splitInd, line.Length-15) );
                    }else if((line.Length>9)&&(line.Substring(0,9).CompareTo("walk.vel=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        walk.vel=float.Parse(line.Substring(splitInd, line.Length-9) );
                    }else if((line.Length>14)&&(line.Substring(0,14).CompareTo("walk.maxspeed=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        walk.maxSpeed=float.Parse(line.Substring(splitInd, line.Length-14) );
                    }else if((line.Length>15)&&(line.Substring(0,15).CompareTo("walk.shuffletime=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        walk.shuffle= new STimer(float.Parse(line.Substring(splitInd, line.Length-15) ) );//tmr
                    }else if((line.Length>14)&&(line.Substring(0,14).CompareTo("edgegrab.time=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        edgegrab.edgeTmr=new STimer(float.Parse(line.Substring(splitInd, line.Length-14) ) );//tmr
                    }else if(((line.Length>19)&&line.Substring(0,19).CompareTo("edgegrab.climbdist=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        edgegrab.climbDist=float.Parse(line.Substring(splitInd, line.Length-19) );
                    }else if(((line.Length>18)&&line.Substring(0,18).CompareTo("edgegrab.rolldist=") == 0)){//TODO: Correct this discrepancy in naming
                        splitInd = line.IndexOf("=")+1;
                        edgegrab.rollSpd=float.Parse(line.Substring(splitInd, line.Length-18) );
                    }else if((line.Length>13)&&(line.Substring(0,13).CompareTo("edgegrab.hgt=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        edgegrab.hgt=float.Parse(line.Substring(splitInd, line.Length-13) );
                    }else if((line.Length>13)&&(line.Substring(0,13).CompareTo("edgegrab.wid=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        edgegrab.wid=float.Parse(line.Substring(splitInd, line.Length-13) );
                    }else if((line.Length>12)&&(line.Substring(0,12).CompareTo("pivot.time=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        pivot.pTmr=new STimer(float.Parse(line.Substring(splitInd, line.Length-12) ) ); //tmr
                    }else if((line.Length>11)&&(line.Substring(0,11).CompareTo("jump.delay=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        jump.tmr=new STimer(float.Parse(line.Substring(splitInd, line.Length-11) ) );//tmr
                    }else if((line.Length>9)&&(line.Substring(0,9).CompareTo("jump.vel=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        jump.vel=float.Parse(line.Substring(splitInd, line.Length-9) );
                    }else if((line.Length>16)&&(line.Substring(0,16).CompareTo("jump.airjumpvel=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        jump.airJumpVel=float.Parse(line.Substring(splitInd, line.Length-16) );
                    }else if((line.Length>8)&&(line.Substring(0,8).CompareTo("jump.maxjumps=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        jump.maxJumps=int.Parse(line.Substring(splitInd, line.Length-8) );
                    }else if((line.Length>10)&&(line.Substring(0,10).CompareTo("land.time=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        land=new STimer(float.Parse(line.Substring(splitInd, line.Length-10) ) );//tmr
                    }else	if((line.Length>11)&&(line.Substring(0,11).CompareTo("dodge.time=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        dodge=new STimer(float.Parse(line.Substring(splitInd, line.Length-11) ));//tmr
                    }else if((line.Length>7)&&(line.Substring(0,7).CompareTo("size.y=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        size.y=float.Parse(line.Substring(splitInd, line.Length-7) );
                    }else if((line.Length>7)&&(line.Substring(0,7).CompareTo("size.x=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        size.x=float.Parse(line.Substring(splitInd, line.Length-7) );
                    }else if((line.Length>12)&&(line.Substring(0,12).CompareTo("tumble.time=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        tumble.tmr=new STimer(float.Parse(line.Substring(splitInd, line.Length-12) ) );
                    }else if((line.Length>14)&&(line.Substring(0,13).CompareTo("tumble.thresh=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        tumble.thresh=float.Parse(line.Substring(splitInd, line.Length-14) );
                    }else if((line.Length>10)&&(line.Substring(0,10).CompareTo("throw.dmg=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        thr.dmg=float.Parse(line.Substring(splitInd, line.Length-10) );
                    }else if((line.Length>10)&&(line.Substring(0,10).CompareTo("throw.dir=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        thr.dir=float.Parse(line.Substring(splitInd, line.Length-10) );
                    }else if((line.Length>10)&&(line.Substring(0,10).CompareTo("throw.mag=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        thr.mag=float.Parse(line.Substring(splitInd, line.Length-10) );
                    }else if((line.Length>8)&&(line.Substring(0,8).CompareTo("defence=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        defence=float.Parse(line.Substring(splitInd, line.Length-8) );
                    }else if((line.Length>5)&&(line.Substring(0,5).CompareTo("grav=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        grav=float.Parse(line.Substring(splitInd, line.Length-5) );
                    }else	if((line.Length>5)&&(line.Substring(0,5).CompareTo("fric=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        fric=float.Parse(line.Substring(splitInd, line.Length-5));
                    }else	if((line.Length>10)&&(line.Substring(0,10).CompareTo("grabrange=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        string sampSub = line.Substring(splitInd, line.Length-10);
                        grabRange=float.Parse(sampSub);
                    }
            //	}
            }
        }catch(FileNotFoundException e){
            return false;
        }

        return hr;
    }
Пример #21
0
    public void Start()
    {
        startPos = new SPoint(transform.position.x, transform.position.y);
        //transform.position = new Vector3(0, 0, 0);

        SetPos(startPos);
        projTmr = new STimer(starCooldown);
        parryTimeout = new STimer(1.0f);
        parryTmr = new STimer(1.0f);
        hovTmr = new STimer(1.0f);
        hovDir = new SPoint(0, 0);
        hovFin = new SPoint(0, 0);
        hovRec = 1;
        dashTmr = new STimer(DASH_TIME);
        ls = transform.localScale;
        rollInvOn = new STimer ();
        rollInvOff = new STimer ();
        debugFadeTmr = new STimer (0.5f);
        atkTmr = new STimer ();
        NORM_ORIENT = new Vector3 (0, 90.0f, 0);
        if (debugModeOn)
            CreateColBox ();
        GameObject go;
        int pCt = 0;
        for (int i=1; i<3; i++) {
            go = GameObject.FindGameObjectWithTag ("Player" + i);
            if (go != null)
                pCt++;
            }
        hitHolder = null;
        stunTimer = new STimer ();
        wallhang = false;
        starTmr = new STimer(starCooldown);
        go=new GameObject();
        for(int i=1;i<pCt+1;i++){
            go =  GameObject.FindGameObjectWithTag("Player"+i);

        }
    }
Пример #22
0
 public void SetInstruct(int acInd, float ti, string ins, float v)
 {
     iTmr [acInd] = new STimer(ti);
     val [acInd] = v;
     valEnd[acInd] = v;
     act[acInd] = ActToInd (ins);
 }
Пример #23
0
 void Start()
 {
     numPos = 3;
     menuSel = 0;
     vThresh = 0.3f;
     mLoc = new SPoint [4];
     mLoc [0] = new SPoint (-60.0f, -10.0f);
     mLoc [1] = new SPoint (-60.0f, -35.0f);
     mLoc [2] = new SPoint (-60.0f, -60.0f);
     paused = false;
     plrP = 0;
     inputTmr = new STimer (0.35f);
     tmrT = Time.deltaTime;
     //transform.Translate( new Vector3(-1000.0f, -1000.0f,0.0f) );
 }
Пример #24
0
    public bool LoadStats(TextAsset file)
    {
        //loads the player's stats from the designated script
        //if not called, defaults from pl[NAME] will be used
        //should these be undefined, defaults from c_PlayerStats will be used
        bool hr = true;
        string line = "";
        int splitInd = 0;
        string[] lines = file.text.Split('\n');
        try{

            foreach (string rline in lines){
                line = rline.Trim();
                //while ((line = infile.ReadLine()) != null) {

                     if((line.Length>15)&&(line.Substring(0,15).CompareTo("walk.loopstart=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        walk.loopStart=float.Parse(line.Substring(splitInd, line.Length-15) );
                    }else if((line.Length>9)&&(line.Substring(0,9).CompareTo("walk.vel=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        walk.vel=float.Parse(line.Substring(splitInd, line.Length-9) );
                    }else if((line.Length>14)&&(line.Substring(0,14).CompareTo("walk.maxspeed=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        walk.maxSpeed=float.Parse(line.Substring(splitInd, line.Length-14) );
                    }else if((line.Length>15)&&(line.Substring(0,15).CompareTo("walk.shuffletime=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        walk.shuffle= new STimer(float.Parse(line.Substring(splitInd, line.Length-15) ) );//tmr

                    }else if((line.Length>11)&&(line.Substring(0,11).CompareTo("jump.delay=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        jump.tmr=new STimer(float.Parse(line.Substring(splitInd, line.Length-11) ) );//tmr
                    }else if((line.Length>9)&&(line.Substring(0,9).CompareTo("jump.vel=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        jump.vel=float.Parse(line.Substring(splitInd, line.Length-9) );
                    }else if((line.Length>16)&&(line.Substring(0,16).CompareTo("jump.airjumpvel=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        jump.airJumpVel=float.Parse(line.Substring(splitInd, line.Length-16) );
                    }else if((line.Length>10)&&(line.Substring(0,10).CompareTo("land.time=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        land=new STimer(float.Parse(line.Substring(splitInd, line.Length-10) ) );//tmr
                    }else	if((line.Length>11)&&(line.Substring(0,11).CompareTo("dodge.time=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        dodge=new STimer(float.Parse(line.Substring(splitInd, line.Length-11) ));//tmr
                    }else if((line.Length>7)&&(line.Substring(0,7).CompareTo("size.y=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        size.y=float.Parse(line.Substring(splitInd, line.Length-7) );
                    }else if((line.Length>7)&&(line.Substring(0,7).CompareTo("size.x=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        size.x=float.Parse(line.Substring(splitInd, line.Length-7) );
                    }else if((line.Length>8)&&(line.Substring(0,8).CompareTo("defence=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        defence=float.Parse(line.Substring(splitInd, line.Length-8) );
                    }else if((line.Length>5)&&(line.Substring(0,5).CompareTo("grav=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        grav=float.Parse(line.Substring(splitInd, line.Length-5) );
                    }else	if((line.Length>5)&&(line.Substring(0,5).CompareTo("fric=") == 0)){
                        splitInd = line.IndexOf("=")+1;
                        fric=float.Parse(line.Substring(splitInd, line.Length-5));
                    }
            //	}
            }
        }catch(FileNotFoundException e){
            return false;
        }

        return hr;
    }