示例#1
0
    void Start()
    {
        mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>();

        centerCameraX = mainCamera.pixelWidth / 2;
        centerCameraY = mainCamera.pixelHeight / 2;

        rectTransform = GetComponent <RectTransform>();
        scrollImage   = scrollImageobject.GetComponent <ScrollImage>();
    }
示例#2
0
    void shuffleRight(ScrollImage s)
    {
        GameObject[] shuffle = new GameObject[3] {
            s.images[1], s.images[2], s.images[0]
        };
        s.images = shuffle;

        Vector3 newPos = s.images[1].transform.position;

        newPos.x += s.imageSize;
        s.images[2].transform.position = newPos;
    }
示例#3
0
    void shuffleImage(ScrollImage s)
    {
        Vector3 CameraPos  = new Vector3(cameraRig.transform.position.x, 0, 0);
        Vector3 rightImage = new Vector3(s.images[2].transform.position.x, 0, 0);
        Vector3 leftImage  = new Vector3(s.images[0].transform.position.x, 0, 0);

        if (Vector3.Distance(CameraPos, rightImage) < 1)
        {
            shuffleRight(s);
        }

        if (Vector3.Distance(CameraPos, leftImage) < 1)
        {
            shuffleLeft(s);
        }
    }
示例#4
0
 void followCamera(ScrollImage s)
 {
     s.imageHolder.transform.position = new Vector3(s.imageHolder.transform.position.x + test * s.scrollSpeed, s.imageHolder.transform.position.y, s.imageHolder.transform.position.z);
 }