Example #1
0
    void Awake()
    {
        if (manager == null)
        {
            manager = this;
        }
        else if (manager != this)
        {
            Destroy(this.gameObject);
        }
        GameObject adManagerObject = new GameObject();

        adManager = adManagerObject.AddComponent <AdManager>();
        adManager.GetComponent <AdManager>().Initialize(this);
        Instantiate(adManagerObject);
        pageBackgrounds = Resources.LoadAll <GameObject>(resourcesPath);
        camera          = Camera.main;
        float frustumHeight = 2f * camera.orthographicSize;
        float frustumWidth  = frustumHeight * camera.aspect;

        cameraMinX = (camera.transform.position.x - 0.5f * frustumWidth) * .8f;
        cameraMaxX = (camera.transform.position.x + 0.5f * frustumWidth) * .8f;
        cameraMinY = (camera.transform.position.x - 0.5f * frustumHeight) * .8f;
        cameraMaxY = (camera.transform.position.x + 0.5f * frustumHeight) * .8f;
    }