public float TicksToFillBar(int start, int spd, SpeedMod speedMod = SpeedMod.Normal) { int top = (ATBBarSize - start); int bot = BarIncrement(spd, speedMod); if (bot == 0) { return(float.MinValue); } return(top / bot); }
// APPLY A SPEED MOD TO THE PLAYER ( +/- ) public void activateFastPowerup(float time, float mod) { mFastObject = GameObject.Instantiate(mFastPrefab); mFastObject.transform.position = this.transform.position; mFastObject.transform.parent = this.transform; // CREATE THE SPEED MOD SpeedMod fm = new SpeedMod(); fm.time = time; fm.mod = mod; // START THE SPEED MOD COROUTINE this.mFastIsActive = true; StartCoroutine("FastRoutine", fm); }
// APPLY A SPEED MOD TO THE PLAYER ( +/- ) public void activateSpeedPowerup(float time, float mod) { // CREATE THE SPEED MOD SpeedMod fm = new SpeedMod(); fm.time = time; fm.mod = mod; // START THE SPEED MOD COROUTINE this.mFreezeIsActive = true; StartCoroutine("FreezeRoutine", fm); }
// COROUTINE FOR SPEED MOD IEnumerator FreezeRoutine(SpeedMod fm) { float prevSpeedMod = mPlayerMovement.mSpeedMod; // SAVE THE PREV SPEED MOD FOR RETIEIVAL AFTER MOD IS FINISHED mPlayerMovement.mSpeedMod = fm.mod; // SET THE NEW SPEED MOD yield return new WaitForSeconds(fm.time); // WAIT FOR THE MOD DURATION TO FINISH if(this.mFreezeIsActive){ deactivateFreezePowerup(prevSpeedMod); } }
public float TimeToFillBar(int start, int spd, SpeedMod speedMod = SpeedMod.Normal) { float tickspersec = 60f; return(TicksToFillBar(start, spd, speedMod) / tickspersec); }
/// <summary> /// Per tick increment /// </summary> /// <param name="spd"></param> /// <param name="speedMod"></param> /// <returns></returns> /// <see cref="https://gamefaqs.gamespot.com/ps/197343-final-fantasy-viii/faqs/58936"/> public static int BarIncrement(int spd, SpeedMod speedMod = SpeedMod.Normal) => (spd + 30) * ((byte)speedMod / 2);