Ejemplo n.º 1
0
 public void Register(int id, CameraManagerClient camera)
 {
     if (!_camerasByID.ContainsKey(id))
     {
         _camerasByID.Add(id, camera);
     }
 }
Ejemplo n.º 2
0
    private IEnumerator ShakeRoutine(CameraManagerClient cam, float intensity)
    {
        var startPos = cam.Position;

        var elapsed  = 0f;
        var duration = intensity * 0.02f;

        intensity *= shakeIntensityFactor;

        while (!_shakeCancelToken && cam.CanShake && elapsed < duration)
        {
            elapsed += Time.deltaTime;

            var deltaX = Random.Range(-intensity, intensity);
            var deltaY = Random.Range(-intensity, intensity);

            cam.Position = startPos + new Vector3(deltaX, deltaY);

            yield return(null);
        }

        cam.Position = startPos;
        _shakingCameraCount--;
    }