Ejemplo n.º 1
0
    IEnumerator TrackToPosition(Vector2 position, bool unlock = false, PostLockDelegate postLock = null)
    {
        float   elapsedTime = 0.0f;
        Vector3 startPos    = transform.position;
        Vector3 endPos      = new Vector3(position.x, position.y, startPos.z);

        while (elapsedTime < trackingDuration)
        {
            yield return(null);

            elapsedTime       += Time.deltaTime;
            transform.position = Vector3.Lerp(startPos, endPos, elapsedTime / trackingDuration);
        }
        if (unlock)
        {
            locked = false;
        }
        if (postLock != null)
        {
            postLock();
        }
    }
Ejemplo n.º 2
0
 public void UnlockCamera(PostLockDelegate postLock = null)
 {
     StartCoroutine(TrackToPosition(DefaultPosition(), true, postLock));
 }
Ejemplo n.º 3
0
 public void LockCamera(Vector2 position, PostLockDelegate postLock = null)
 {
     locked = true;
     StartCoroutine(TrackToPosition(position, false, postLock));
 }