IEnumerator Dashing()
    {
        float timer = 0f;

        while (timer < dashDuration)
        {
            //print("Hello hello hola, let the movement go dash");
            timer += Time.deltaTime;
            curPos = charMove.transform.position;
            newPos = curPos + (dashDirection * dashSpeed * Time.deltaTime);
            charMove.MoveThePlayer(dashDirection, newPos, curPos);
            yield return(null);
        }
        StopMovementSkill();
    }
Ejemplo n.º 2
0
 void Update()
 {
     // Can be transfered to the coroutine for the animation, specially since they both rely on the same get hit duration.
     if (charHitMoveOn)
     {
         moveTimer += Time.deltaTime / getHitDuration;
         if (moveTimer >= getHitDuration)
         {
             charHitMoveOn = false;
             moveTimer     = 0f;
         }
         //print(curPosition.z + "And new posz: " + newPosition.z);
         curPosition = charMov.transform.position;
         newPosition = curPosition + (normHitDirection * moveSpeed * Time.deltaTime);
         charMov.MoveThePlayer(normHitDirection, newPosition, curPosition);
     }
 }
 IEnumerator CharAttackMotionTimer()
 {
     while (moveTimer < 1)
     {
         curPosition = this.transform.position;
         newPosition = curPosition + (curDirection * curSpeed * Time.deltaTime);
         //print("direction: "+curDirection+" newposition: "+newPosition+" curposition: "+curPosition);
         charMov.MoveThePlayer(curDirection, newPosition, curPosition);
         moveTimer += Time.deltaTime / curDuration;
         if (exitPlayerMotion)
         {
             break;
         }
         if (finalMotion && moveTimer >= 1f)
         {
             moveTimer = 0f;
         }
         yield return(null);
     }
     exitPlayerMotion = false;
     finalMotion      = false;
     SetupNextMotion();
 }