Exemplo n.º 1
0
    IEnumerator BlinkCoroutine()
    {
        m_PlayerController.ResetCharacterVelocity();
        m_PlayerController.enabled = false;
        isBlinking = true;
        Vector3 endPosition = new Vector3(
            blinkDistanceVisual.transform.position.x,
            transform.position.y,
            blinkDistanceVisual.transform.position.z);

        while (Vector3.Distance(transform.position, endPosition) > 0.1f)
        {
            print(Vector3.Distance(transform.position, endPosition));
            transform.position = Vector3.MoveTowards(transform.position, endPosition, blinkSpeed * Time.deltaTime);
            yield return(null);
        }

        isBlinking = false;
        m_PlayerController.enabled = true;
    }