Exemple #1
0
    public void FocusGlobe()
    {
        StartCoroutine(LerpToPosition(PositionDesktop.z, GlobeZOffset, ScaleDesk, ScaleFocus, RotationDesktop, Quaternion.identity, EPaperworkStatus.FOCUS));
        Status = EPaperworkStatus.FOCUS;

        //AudioManager.instance.PlayOneShotEffect(ClipPaperFocus);
    }
Exemple #2
0
    IEnumerator LerpToPosition(float fromZ, float toZ, Vector3 fromScale, Vector3 toScale, Quaternion fromRotation, Quaternion toRotation, EPaperworkStatus status)
    {
        float   elapsedTime = 0;
        float   duration    = 0.4f;
        Vector3 tempPos     = gameObject.transform.position;

        while (elapsedTime < 0.4f)
        {
            tempPos.z = Mathf.Lerp(fromZ, toZ, (elapsedTime / duration));
            gameObject.transform.position   = tempPos;
            gameObject.transform.localScale = Vector3.Lerp(fromScale, toScale, (elapsedTime / duration));
            gameObject.transform.rotation   = Quaternion.Lerp(fromRotation, toRotation, (elapsedTime / duration));
            elapsedTime = Mathf.Clamp(elapsedTime + Time.deltaTime, 0.0f, 0.4f);
            yield return(null);
        }
        tempPos.z = toZ;
        gameObject.transform.position   = tempPos;
        gameObject.transform.localScale = toScale;
        gameObject.transform.rotation   = toRotation;
    }