// Use this for initialization
    void Start()
    {

        if (instance == null)
        {
            DontDestroyOnLoad(this.gameObject);
            instance = this;
        }
        else
        {
            Destroy(this.gameObject);
        }

        // 씬에 맞게 자동으로 할당
        if (target == null && GameObject.FindGameObjectWithTag("Mary") != null)
            target = GameObject.FindGameObjectWithTag("Mary");
        if (bound == null && GameObject.FindGameObjectWithTag("Background") != null)
            bound = GameObject.FindGameObjectWithTag("Background").GetComponent<BoxCollider2D>();

        // 각 변수 초기화
        zoomCtrl = GetComponent<ZoomInOut>();
        getCamera = GetComponent<Camera>();
        minBound = bound.bounds.min;
        maxBound = bound.bounds.max;
        halfHeight = getCamera.orthographicSize;
        halfWidth = halfHeight * Screen.width / Screen.height;



    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        if (instance == null)
        {
            DontDestroyOnLoad(this.gameObject);
            instance = this;
        }
        else
        {
            Destroy(this.gameObject);
        }

        initCamera();
    }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        if (instance == null)
        {
            DontDestroyOnLoad(this.gameObject);
            instance = this;
        }
        else
        {
            Destroy(this.gameObject);
        }

        // 각 변수 초기화
        zoomCtrl   = GetComponent <ZoomInOut>();
        getCamera  = GetComponent <Camera>();
        minBound   = bound.bounds.min;
        maxBound   = bound.bounds.max;
        halfHeight = getCamera.orthographicSize;
        halfWidth  = halfHeight * Screen.width / Screen.height;
    }