Example #1
0
 void Dash()
 {
     if (m_playerInputHandler.GetDashDown() && DashCDTimeCount >= DashingCooldownTime)
     {
         audioSource.clip = GameManager.getGM.audioEffect[0];
         if (!audioSource.isPlaying)
         {
             audioSource.Play();
         }
         DashTimeCount = 0f;
         IsDashing     = true;
     }
     if (DashTimeCount >= DashingTime)
     {
         audioSource.Pause();
         DashCDTimeCount = 0f;
         speedModifier   = 1f;
         IsDashing       = false;
         DashTimeCount   = 0f;
     }
     if (!IsDashing && DashCDTimeCount < DashingCooldownTime)
     {
         DashCDTimeCount += Time.deltaTime;
     }
 }
Example #2
0
 void Dash()
 {
     if (m_playerInputHandler.GetDashDown() && DashCDTimeCount >= DashingCooldownTime)
     {
         DashTimeCount = 0f;
         IsDashing     = true;
     }
     if (IsDashing && DashTimeCount < DashingTime)
     {
         speedModifier  = DashSpeedMultiplier;
         DashTimeCount += Time.deltaTime;
     }
     if (DashTimeCount >= DashingTime)
     {
         DashCDTimeCount = 0f;
         speedModifier   = 1f;
         IsDashing       = false;
         DashTimeCount   = 0f;
     }
     if (!IsDashing && DashCDTimeCount < DashingCooldownTime)
     {
         DashCDTimeCount += Time.deltaTime;
     }
     Debug.Log(DashCDTimeCount);
     Debug.Log(DashTimeCount);
 }