Exemple #1
0
    void Update()
    {
        switch (currentIndex)
        {
        case 0:
            if (part.pickedUp)
            {
                Destroy(part.gameObject);
                cam.Activate();
                Invoke("OpenGate1", 7.0f);
                Invoke("MoveRock", 8.0f);
                Invoke("OpenGate2", 18.0f);
                currentIndex++;
            }
            break;

        default: break;
        }
    }
    void Update()
    {
        bool canSkipStep = currentStep < GameManager.puzzleStep[2];

        if (canSkipStep)
        {
            switch (currentStep)
            {
            case 0:
                plate.setIsActivated(true);
                gates[0].Complete();
                currentStep++;
                break;

            case 1:
                currentStep++;
                break;

            case 2:
                target.SetIsActivated(true);
                gates[1].Complete();
                foreach (LoopingObject lo in stones)
                {
                    lo.trigger = true;
                }
                currentStep++;
                Destroy(this);
                break;

            default: break;
            }
        }
        else
        {
            switch (currentStep)
            {
            case 0:     //Shooting target
                if (target.GetIsActivated())
                {
                    gates[0].trigger = true;
                    currentStep++;
                }
                break;

            case 1:     //Pressure plate
                if (plate.GetIsActivated())
                {
                    cam.Activate();
                    currentStep++;
                }
                break;

            case 2:     //End of puzzle
                if (cam.locationReached)
                {
                    gates[1].trigger = true;
                    foreach (LoopingObject lo in stones)
                    {
                        lo.trigger = true;
                    }
                    Destroy(this);
                }
                break;

            default: break;
            }
            if (GameManager.puzzleStep[2] != currentStep)
            {
                GameManager.puzzleStep[2] = currentStep;
            }
        }
    }
    void Update()
    {
        if (GameManager.puzzleStep[1] > 5 && GameManager.puzzleStep[1] != 999)
        {
            CorrectSolution();
            platform.trigger = true;
            currentStep      = GameManager.puzzleStep[1];
            Destroy(this);
        }
        else
        {
            if (startSimonSays)
            {
                if (resetButton.GetIsActivated())
                {
                    ResetPuzzle();
                    Invoke("ResetResetButton", 1.0f);
                }
                switch (currentStep)
                {
                case 0:     //Playing cycle
                    if (inputOrder.Count < 4)
                    {
                        PlayParticleOrder();
                        CheckPressurePlates();
                    }
                    else if (inputOrder.Count == 4)
                    {
                        currentStep++;
                        Invoke("NextStep", 1.0f);
                    }
                    break;

                case 1:     //Checking input
                    if (canCheck)
                    {
                        if (CheckInputWithSolution())
                        {
                            currentStep += 2;
                        }
                        else
                        {
                            currentStep++;
                        }
                    }
                    break;

                case 2:     //InCorrect Solution
                    IncorrectSolution();
                    Invoke("ResetPuzzle", 3.0f);
                    currentStep = 999;
                    break;

                case 3:     //Correct Solution
                    CorrectSolution();
                    currentStep++;
                    break;

                case 4:     //Reward
                    cameraCutscene.Activate();
                    currentStep++;
                    break;

                case 5:     //Starting platform
                    if (cameraCutscene.locationReached)
                    {
                        platform.trigger = true;
                        currentStep++;
                        Destroy(this);
                    }
                    break;

                default: break;
                }
                if (GameManager.puzzleStep[1] != currentStep)
                {
                    GameManager.puzzleStep[1] = currentStep;
                }
            }
        }
    }
    void Update()
    {
        bool canSkipStep = currentStep < GameManager.puzzleStep[0];

        if (canSkipStep)
        {
            switch (currentStep)
            {
            case 0:
                gate.Complete();
                pressurePlates[0].setIsActivated(true);
                pressurePlates[1].setIsActivated(true);
                currentStep++;
                break;

            case 1:
                rock.Complete();
                shootingTarget.SetIsActivated(true);
                currentStep++;
                break;

            case 2:
                Destroy(part);
                currentStep++;
                break;

            case 3:
                fallingRock.Complete();
                currentStep++;
                break;

            case 4:
                Destroy(this);
                break;

            default: break;
            }
        }
        else
        {
            switch (currentStep)
            {
            case 0:
                if (AllPlatesActivated())
                {
                    gate.trigger = true;
                    currentStep++;
                }
                break;

            case 1:
                if (shootingTarget.GetIsActivated())
                {
                    rock.trigger = true;
                    currentStep++;
                }
                break;

            case 2:
                if (part.GetComponent <PickUpPart>().pickedUp)
                {
                    Destroy(part);
                    currentStep++;
                    cutsceneCam.Activate();
                    fallingRock.trigger = true;
                }
                break;

            case 3:
                if (checkpoint)
                {
                    checkpoint.Activate();
                }
                Destroy(this);
                break;

            default: break;
            }
            if (GameManager.puzzleStep[0] != currentStep)
            {
                GameManager.puzzleStep[0] = currentStep;
            }
        }
    }