Ejemplo n.º 1
0
    void SetPage(EFlyThroughStates page)
    {
        foreach (GameObject go in pages)
        {
            if (go == pages[(int)page])
            {
                go.SetActive(true);
                continue;
            }

            go.SetActive(false);
        }
    }
Ejemplo n.º 2
0
    void Update()
    {
        if(Input.GetKeyUp(KeyCode.P))
        {
            timeElapsed = waitTimes[(int)currentState];
        }

        timeElapsed += Time.deltaTime;

        if (timeElapsed >= waitTimes[(int)currentState])
        {
            timeElapsed = 0.0f;

            currentState++;
            if (currentState >= EFlyThroughStates.Max)
            {
                currentState = EFlyThroughStates.Title;
            }

            SetPage(currentState);
        }

        switch (currentState)
        {
            case EFlyThroughStates.Title:
                {

                }
                break;
            case EFlyThroughStates.Highscores:
                {

                }
                break;
            case EFlyThroughStates.Controls:
                {

                }
                break;
            case EFlyThroughStates.Robot:
                {

                }
                break;
            case EFlyThroughStates.Window:
                {

                }
                break;
            case EFlyThroughStates.Max:
                {

                }
                break;
            default:
                break;
        }

        // At any stage the players can hit START to enter the game.
        bool playerReady = false;

        if (InputDevice.GetStart(0))
        {
            playerStates[0] = MenuControl.ControllerState.READY;
            playerReady = true;
        }
        if (InputDevice.GetStart(1))
        {
            playerStates[1] = MenuControl.ControllerState.READY;
            playerReady = true;
        }

        if (InputDevice.GetA_Up(0) || InputDevice.GetA_Up(1))
        {
            timeElapsed = 0.0f;

            currentState++;
            if (currentState >= EFlyThroughStates.Max)
            {
                currentState = EFlyThroughStates.Title;
            }

            SetPage(currentState);
        }

        if (playerReady)
        {
            PlayGame();
        }
    }