예제 #1
0
    /**
     * Play the 'fake game', using the tutorial hand to display how to finish a level...
     */
    private IEnumerator playTutoCoroutine()
    {
        // move hand over the pipe to turn
        Vector3 worldPos = objectGrid[(int)tutoBadPipePosition.x, (int)tutoBadPipePosition.y].transform.position;

        tutoScript.hand.moveToWorldPosition(worldPos, 1.8f);

        // when the hand is over the pipe, display a 'click', and turn the pipe as if it was touched
        yield return(new WaitForSeconds(2));

        tutoScript.hand.setHandKind(TutoHandScript.HandKind.HandClick);
        yield return(new WaitForSeconds(0.1f));

        PipeElementScript badPipe = objectGrid[(int)tutoBadPipePosition.x, (int)tutoBadPipePosition.y];

        badPipe.rotateClockwiseOnce();

        yield return(new WaitForSeconds(0.2f));

        tutoScript.hand.setHandKind(TutoHandScript.HandKind.HandNormal);

        // hide the hand, the rest of the tutorial is handled by onEffectiveWin() ;)
        yield return(new WaitForSeconds(0.5f));

        tutoScript.hand.setVisibility(false);

        //tutoScript.getOut();
    }
예제 #2
0
    private void instanciatePipeGrid(PipeElement[,] grid)
    {
        objectGrid = new PipeElementScript[GRID_SIZE, GRID_SIZE];
        for (int y = 0; y < GRID_SIZE; y++)
        {
            for (int x = 0; x < GRID_SIZE; x++)
            {
                if (grid[x, y] != null)
                {
                    PipeElement       origin = grid[x, y];
                    PipeElementScript prefab = null;
                    switch (origin.type)
                    {
                    case PipeElement.Type.PIPE_I:
                        prefab = pipeI;
                        break;

                    case PipeElement.Type.PIPE_L:
                        prefab = pipeL;
                        break;

                    case PipeElement.Type.PIPE_IN:
                        prefab = pipeIn;
                        break;

                    case PipeElement.Type.PIPE_OUT:
                        prefab = pipeOut;
                        break;
                    }

                    PipeElementScript pipeSprite = (PipeElementScript)Instantiate(prefab);

                    // set internal pipe element
                    pipeSprite.setPipeElement(origin);

                    // set to the appropriate parent (Pipe Container) and position inside
                    pipeSprite.transform.parent        = parentArea;
                    pipeSprite.transform.localPosition =
                        new Vector3(x + ORIGIN_X, -y + ORIGIN_Y, 0);

                    // not very clever, allow/disallow rotation depending on pipe type
                    if (origin.type == PipeElement.Type.PIPE_IN || origin.type == PipeElement.Type.PIPE_OUT)
                    {
                        pipeSprite.setTouchEnable(false);
                    }

                    objectGrid[x, y] = pipeSprite;
                }
            }
        }
    }