Added Rip static Images for every animal

posted in: Weekly Progress | 0

In camera controller script functionality is added:

 

private Vector3 _VecPos;

_VecPos = new Vector3(transform.position.x, transform.position.y, transform.position.z);

 
if (IsFollowing)
{
if (Mathf.Abs (x – _playerTransform.position.x) > Margin.x)
x = Mathf.Lerp (x, _playerTransform.position.x + _xOffset, Smoothing.x * Time.deltaTime);

if (Mathf.Abs (y – _playerTransform.position.y) > Margin.y)
y = Mathf.Lerp (y, _playerTransform.position.y, Smoothing.y * Time.deltaTime);
}

Camera camera = GetComponent<Camera>();
var cameraHalfWidth = camera.orthographicSize * ((float) Screen.width/Screen.height);

x = Mathf.Clamp (x, _min.x + cameraHalfWidth, _max.x – cameraHalfWidth);
y = Mathf.Clamp (y, _min.y + camera.orthographicSize, _max.y – camera.orthographicSize);

_VecPos.x = x;
_VecPos.y = y;
_VecPos.z = transform.position.z;
transform.position = _VecPos;
}

 

     

Leave a Reply