Пример #1
0
    // ------------------------------------------------------------------ 
    // Desc: 
    // ------------------------------------------------------------------ 

    void Start () {
        ppfCamera = sprite.renderCamera.GetComponent<exPixelPerfectCamera>();
        if ( ppfCamera == null ) {
            ppfCamera = sprite.renderCamera.gameObject.AddComponent<exPixelPerfectCamera>();
        }

        UpdatePixelPerfectCamera (ppfCamera);
    }
Пример #2
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------
    public void UpdatePixelPerfectCamera( exPixelPerfectCamera _ppfCamera )
    {
        ppfCamera = _ppfCamera;
        if ( sprite.renderCamera.orthographic == false ) {
            cameraToSprite = transform.position - sprite.renderCamera.transform.position;
        }

        //
        ppfCamera.CalculatePixelPerfectScale ( sprite, cameraToSprite );
    }
Пример #3
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void UpdatePixelPerfectCamera(exPixelPerfectCamera _ppfCamera)
    {
        ppfCamera = _ppfCamera;
        if (sprite.renderCamera.orthographic == false)
        {
            toCamera = transform.position - sprite.renderCamera.transform.position;
        }

        //
        ppfCamera.CalculatePixelPerfectScale(sprite, toCamera.magnitude);
    }
Пример #4
0
    ///////////////////////////////////////////////////////////////////////////////
    // functions
    ///////////////////////////////////////////////////////////////////////////////

    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    void Awake()
    {
        sprite    = GetComponent <exSpriteBase>();
        ppfCamera = sprite.renderCamera.GetComponent <exPixelPerfectCamera>();
        if (ppfCamera == null)
        {
            ppfCamera = sprite.renderCamera.gameObject.AddComponent <exPixelPerfectCamera>();
        }

        UpdatePixelPerfectCamera(ppfCamera);
    }
Пример #5
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    void Start()
    {
        if (sprite.renderCamera != null)
        {
            ppfCamera = sprite.renderCamera.GetComponent <exPixelPerfectCamera>();
            if (ppfCamera == null)
            {
                ppfCamera = sprite.renderCamera.gameObject.AddComponent <exPixelPerfectCamera>();
            }

            UpdatePixelPerfectCamera(ppfCamera);
        }
    }
Пример #6
0
    // ------------------------------------------------------------------
    // Desc:
    // NOTE: if in LateUpdate, it may not go into sprite.Commit while changes
    // ------------------------------------------------------------------

    void Update()
    {
        if (sprite != null && sprite.renderCamera.orthographic == false)
        {
            Vector3 newToCamera = transform.position - sprite.renderCamera.transform.position;

            if (newToCamera.sqrMagnitude != toCamera.sqrMagnitude)
            {
                toCamera = newToCamera;

                //
                if (ppfCamera == null || ppfCamera.camera != sprite.renderCamera)
                {
                    ppfCamera = sprite.renderCamera.GetComponent <exPixelPerfectCamera>();
                    if (ppfCamera == null)
                    {
                        ppfCamera = sprite.renderCamera.gameObject.AddComponent <exPixelPerfectCamera>();
                    }
                }
                ppfCamera.CalculatePixelPerfectScale(sprite, toCamera.magnitude);
            }
        }
    }
Пример #7
0
    // ------------------------------------------------------------------ 
    // Desc: 
    // NOTE: if in LateUpdate, it may not go into sprite.Commit while changes
    // ------------------------------------------------------------------ 

    void Update () {
        if ( sprite != null && sprite.renderCamera.orthographic == false ) {
            Vector3 newToCamera = transform.position - sprite.renderCamera.transform.position;

            if ( newToCamera.sqrMagnitude != toCamera.sqrMagnitude ) {
                toCamera = newToCamera;

                //
                if ( ppfCamera == null || ppfCamera.camera != sprite.renderCamera ) {
                    ppfCamera = sprite.renderCamera.GetComponent<exPixelPerfectCamera>();
                    if ( ppfCamera == null ) {
                        ppfCamera = sprite.renderCamera.gameObject.AddComponent<exPixelPerfectCamera>();
                    }
                }
                ppfCamera.CalculatePixelPerfectScale ( sprite, toCamera.magnitude );
            }
        }
    }