Example #1
0
    IEnumerator SnapToRotation()
    {
        if (dragDir.magnitude >= minSwipeLength)
        {
            playManager.DeselectCube();
        }
        while (transform.rotation != toRotation)
        {
            transform.rotation = Quaternion.Lerp(transform.rotation, toRotation, Time.deltaTime * lerpSpeed);
            yield return(null);
        }

        transform.rotation = toRotation;
        cuboid.ToggleParent();
        toRotation         = Quaternion.Euler(0, 0, 0);
        transform.rotation = Quaternion.identity;
        cuboid.ToggleParent();
        isRotating = false;
        playManager.CreatePlayableArea();
        PlayManager.lockInput = false;
    }