예제 #1
0
    // Update is called once per frame
    void Update()
    {
        //assign pic_A and pic_B values when the pic_child is selected by mouse
        assign_tmpPic();

        //if user has selected two pics, exchange them and reset pic_A & pic_B
        if (isAnimating == false)
        {
            if (pic_A != null && pic_B != null)
            {
                isAnimating  = true;
                pic_A_script = pic_A.GetComponent <bgRimShow>();
                pic_B_script = pic_B.GetComponent <bgRimShow>();

                //set Animating status
                pic_A_script.isAnimating = true;
                pic_B_script.isAnimating = true;

                //exchange pic_A and pic_B's positions
                exchange(pic_A, pic_B);
            }
        }
        else //check if pic_A and pic_B's animations are over
        {
            isAnimating = (pic_A_script.isAnimating || pic_B_script.isAnimating);
            if (!isAnimating) //上一帧有动画, 而这一帧没有动画了, 表示A, B两段动画已经播放完毕了, 那么重置pic_A和pic_B的值
            {
                pic_A = pic_B = null;
            }
        }
    }
예제 #2
0
    //assign pic_A and pic_B values when the pic_child is selected by mouse
    void assign_tmpPic()
    {
        for (int i = 0; i < pic_children.Length; i++) //find if there are selected pics
        {
            bgRimShow child_script = pic_children[i].GetComponent <bgRimShow>();

            if (child_script.isBGActive)
            {
                //Debug.Log("Active pic found: " +  pic_children[i].name);
                if (pic_A == null)
                {
                    pic_A = pic_children[i];
                }
                else
                {
                    if (pic_A != pic_children[i])
                    {
                        pic_B = pic_children[i];
                    }
                }
            }
        }
    }