using UnityEngine;


    public class CameraLimits : MonoBehaviour
    {

        public int width;

        public int height;

        void OnDrawGizmosSelected()
        {
            Gizmos.color = Color.green;

            /*Gizmos.DrawLine(
                new Vector3(worldLimits.x + transform.position.x, worldLimits.y + transform.position.y),
                new Vector3(worldLimits.x + worldLimits.width + transform.position.x, worldLimits.y + transform.position.y)
            );

            Gizmos.DrawLine(
                new Vector3(worldLimits.x + worldLimits.width + transform.position.x, worldLimits.y + transform.position.y),
                new Vector3(worldLimits.x + worldLimits.width + transform.position.x, worldLimits.y + worldLimits.height + transform.position.y)
            );

            Gizmos.DrawLine(
                new Vector3(worldLimits.x + transform.position.x, worldLimits.y + worldLimits.height, 0 + transform.position.y),
                new Vector3(worldLimits.x + worldLimits.width + transform.position.x, worldLimits.y + worldLimits.height + transform.position.y)
            );

            Gizmos.DrawLine(
                new Vector3(worldLimits.x + transform.position.x, worldLimits.y, 0 + transform.position.y),
                new Vector3(worldLimits.x + transform.position.x, worldLimits.y + worldLimits.height + transform.position.y)
            );*/

            Gizmos.DrawLine(
                new Vector3(X0, Y0),
                new Vector3(X1, Y0)
            );

            Gizmos.DrawLine(
                new Vector3(X1, Y0),
                new Vector3(X1, Y1)
            );

            Gizmos.DrawLine(
                new Vector3(X1, Y1),
                new Vector3(X0, Y1)
            );

            Gizmos.DrawLine(
                new Vector3(X0, Y1),
                new Vector3(X0, Y0)
            );
        }

        public int X0
        {
            get
            {
                return (int)transform.position.x - width / 2;
            }
        }

        public int Y0
        {
            get
            {
                return (int)transform.position.y - height / 2;
            }
        }

        public int X1
        {
            get
            {
                return (int)transform.position.x + width / 2;
            }
        }

        public int Y1
        {
            get
            {
                return (int)transform.position.y + height / 2;
            }
        }

    }

