Exemple #1
0
    private void AnimateRotate()
    {
        target.rotation = Quaternion.RotateTowards(target.rotation, targetRotation, rotationSpeed * Time.deltaTime);

        if (target.rotation == targetRotation)
        {
            state = EnumCubeAnimState.idle;

            if (RotationComplete != null)
            {
                RotationComplete.Invoke();
            }
        }
    }
Exemple #2
0
    // Use this for initialization
    void Start()
    {
        History = new Stack <Move>();
        cubies  = GameObject.FindGameObjectsWithTag("cubie");

        state   = EnumCubeAnimState.idle;
        xSlices = new List <Slice> {
            new Slice(), new Slice(), new Slice()
        };
        ySlices = new List <Slice> {
            new Slice(), new Slice(), new Slice()
        };
        zSlices = new List <Slice> {
            new Slice(), new Slice(), new Slice()
        };
    }
Exemple #3
0
    private void DoRotate()
    {
        if (state != EnumCubeAnimState.idle)
        {
            return;
        }

        state = EnumCubeAnimState.animating;
        int direction = rotationDirection == EnumDirection.positive ? 1 : -1;

        RebuildSlices();

        switch (animationType)
        {
        case EnumAnimType.cube:
            SetupCubeAnimation(direction);
            break;

        case EnumAnimType.slice:
            SetupSliceAnimation(direction);
            break;
        }
    }