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;
            }
        }
    }
    void Update()
    {
        bool canSkipStep = currentStep < GameManager.puzzleStep[3];

        if (GameManager.puzzleStep[3] >= 5)
        {
            currentStep = GameManager.puzzleStep[3];
            gates[1].Complete();
            gates[2].Complete();
            rewardGate.Complete();
            Destroy(this);
        }
        else
        {
            if (part.pickedUp && !startPuzzle)
            {
                startPuzzle = true;
                Destroy(part.gameObject);
            }
            if (startPuzzle)
            {
                switch (currentStep)
                {
                case 0:
                    cams[0].Activate();
                    currentStep++;
                    break;

                case 1:
                    if (cams[0].locationReached)
                    {
                        gates[0].trigger = true;
                        lava.trigger     = true;
                        currentStep++;
                    }
                    break;

                case 2:
                    gates[1].trigger = true;
                    gates[2].trigger = true;
                    currentStep++;
                    break;

                case 3:
                    foreach (EnemySpawner es in spawners)
                    {
                        es.startSpawning = true;
                    }
                    currentStep++;
                    break;

                case 4:
                    if (CheckEnemies())
                    {
                        foreach (MoveObject gate in gates)
                        {
                            gate.reverseTrigger = true;
                        }
                        lava.reverseTrigger = true;
                        cams[1].Activate();
                        currentStep++;
                    }
                    break;

                case 5:
                    if (cams[1].locationReached)
                    {
                        rewardGate.trigger = true;
                        currentStep++;
                    }
                    break;

                case 6:
                    Destroy(this);
                    break;

                default: break;
                }
                if (GameManager.puzzleStep[3] != currentStep)
                {
                    GameManager.puzzleStep[3] = currentStep;
                }
            }
        }
    }
Beispiel #3
0
    void Update()
    {
        if (GameManager.puzzleStep[4] >= 2)
        {
            gate.Complete();
            foreach (ShootingTarget t in targets)
            {
                t.SetIsActivated(true);
            }
            currentStep = GameManager.puzzleStep[4];
            Destroy(this);
        }

        if (startPuzzle)
        {
            switch (currentStep)
            {
            case 0:     //Timer
                timer += Time.deltaTime;
                if (CheckAllTargets())
                {
                    timer        = 0.0f;
                    currentStep += 2;
                }
                if (timer >= time)
                {
                    currentStep += (CheckAllTargets()) ? 2 : 1;
                    timer        = 0.0f;
                }
                break;

            case 1:     //Failed
                ResetPuzzle();
                currentStep = 0;
                startPuzzle = false;
                break;

            case 2:     //Success
                gate.trigger = true;
                currentStep++;
                break;

            case 3:     //Delete this script
                Destroy(this);
                break;

            default: break;
            }
        }
        else
        {
            foreach (ShootingTarget t in targets)
            {
                if (t.GetIsActivated())
                {
                    Invoke("DropNextStone", time / droppingRocks.Length);
                    startPuzzle = true;
                    break;
                }
            }
        }
    }