Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        //if( !Application.isPlaying )
        //transform.position = startPos + (Vector3)(Vector2)(UnityEditor.SceneView.lastActiveSceneView.camera.transform.position - startPos) * ( 1 - 1 / (distance+1));
        //else {
        transform.position = startPosition + (Vector3)(Vector2)(cam.transform.position - startPosition) * (1 - 1 / ((distance / 10f) + 1));

        if (pixelSnap)
        {
            PixelPerfectCamera.SnapToPix(transform);
        }
        //}
        //UnityEditor.EditorUtility.SetDirty( gameObject );
    }
Ejemplo n.º 2
0
    void LateUpdate()
    {
                #if UNITY_EDITOR
        if (!UnityEditor.EditorApplication.isPlaying)
        {
            if (UnityEditor.SceneView.lastActiveSceneView != null && editorShowMesh && (tileX || tileY))
            {
                DrawMeshes(UnityEditor.SceneView.lastActiveSceneView.camera);
            }
            return;
        }
                #endif
        if (cam == null)
        {
            cam = Camera.main;
            if (cam == null)
            {
                return;
            }
        }
        if (!isFading && fadeQueue != null)
        {
            StartCoroutine(FadeSpritesCoroutine(fadeQueue.sprite, fadeQueue.tileX, fadeQueue.tileY, fadeQueue.tileXAmount, fadeQueue.tileYAmount, fadeQueue.time));
            fadeQueue = null;
        }

        transform.position = startPos + (Vector3)((Vector2)cam.transform.position - (Vector2)startPos + _offset) * ratio;
        if (pixelSnap)
        {
            PixelPerfectCamera.SnapToPix(transform);
        }
        if (tileX || tileY)
        {
            DrawMeshes(cam);
        }
    }