Пример #1
0
        public void SpecifyAnimation(AnimationSpecification animationSpecification)
        {
            cubeAxis          = animationSpecification.cubeAxis;
            cubeSlices        = animationSpecification.cubeSlices;
            rotationDirection = animationSpecification.rotationDirection;

            isAnimating = true;
        }
Пример #2
0
        public void AddMove(AnimationSpecification animationSpecification)
        {
            RotationDirection rotationDirection = animationSpecification.rotationDirection;
            CubeAxis          cubeAxis          = animationSpecification.cubeAxis;
            CubeSlices        cubeSlices        = animationSpecification.cubeSlices;
            MoveType          moveType          = animationSpecification.moveType;

            string s = "";

            switch (cubeAxis)
            {
            case CubeAxis.x:
                s = "x";
                break;

            case CubeAxis.y:
                s = "y";
                break;

            case CubeAxis.z:
                s = "z";
                break;
            }

            switch (cubeSlices)
            {
            case CubeSlices.s0:
                s += "0";
                break;

            case CubeSlices.s01:
                s += "01";
                break;

            case CubeSlices.s1:
                s += "1";
                break;

            case CubeSlices.s2:
                s += "2";
                break;

            case CubeSlices.s3:
                s += "3";
                break;

            case CubeSlices.s34:
                s += "34";
                break;

            case CubeSlices.s4:
                s += "4";
                break;

            case CubeSlices.s01234:
                s += "01234";
                break;
            }

            if (rotationDirection == RotationDirection.reverse)
            {
                s += "R";
            }
            if (moveType == MoveType.doubleMove)
            {
                s += "D";
            }

            GameObject g1 = Instantiate(prefab);

            g1.gameObject.transform.SetParent(contentRect, false);

            g1.SetActive(true);

            var g1m = g1.GetComponent <MyMove>();

            g1m.text.text = "  " + s;

            Canvas.ForceUpdateCanvases();

            contentObj.GetComponent <VerticalLayoutGroup>().CalculateLayoutInputVertical();
            contentObj.GetComponent <ContentSizeFitter>().SetLayoutVertical();

            sr.content.GetComponent <VerticalLayoutGroup>().CalculateLayoutInputVertical();
            sr.content.GetComponent <ContentSizeFitter>().SetLayoutVertical();

            sr.normalizedPosition = new Vector2(0, 0);

            _numMoves++;
            SetTitle();
        }