Ejemplo n.º 1
0
    // initialize and get pos & ori of a solution
    void initializeSolution()
    {
        // check if a real solution (not dropdown label) is selected
        // and if this solution is already initialized
        if (isPrevDone && !isInit)
        {
            // fetch the script on the PuzzleSolution object
            PuzzleAnimator animator = solution.gameObject.GetComponent <PuzzleAnimator>();

            // initialize the PuzzleAnimator
            animator.initialize();

            // get all the pos & ori info of that solution
            numBlocks = animator.getNumPieces();
            startPos  = animator.getStartPos();
            endPos    = animator.getEndPos();

            /*// get all children blocks
             * blocks = new Transform[numBlocks];
             * for (int i = 0; i < numBlocks; i++)
             * {
             * blocks[i] = solution.gameObject.transform.GetChild(i);
             * }*/

            startRot = animator.getStartRot();
            endRot   = animator.getEndRotQuat();

            isInit = true;
        }
    }
Ejemplo n.º 2
0
 private void Awake()
 {
     animator = GetComponent <PuzzleAnimator>();
 }