Exemple #1
0
    private IEnumerator CamToPosition(Vector3 dest, float size, NPlayerController player)
    {
        if (player != null)
        {
            player.Vibrate(1, 0.5f, 0.5f);
        }
        while (Vector2.Distance(cam.transform.position, dest) > 0.05f)
        {
            cam.transform.position += (dest - cam.transform.position) * 0.125f;
            if (Mathf.Abs(cam.orthographicSize - size) > 0.05f)
            {
                cam.orthographicSize += (size - cam.orthographicSize) * 0.75f;
            }
            else
            {
                cam.orthographicSize = size;
            }
            yield return(new WaitForEndOfFrame());
        }
        cam.transform.position = dest;
        yield return(new WaitForSeconds(0.6f));

        if (cameraQueue.Count > 1)
        {
            cameraCoroutine = cameraQueue.Dequeue();
            StartCoroutine(cameraCoroutine);
        }
        else if (cameraQueue.Count == 1)
        {
            cameraCoroutine = cameraQueue.Dequeue();
            StartCoroutine(cameraCoroutine);
        }
        else
        {
            BeginMatch();
        }
    }