コード例 #1
0
    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;
            }
        }
    }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.F10))
        {
            Die();
        }
        if (isActive)
        {
            transform.rotation = Quaternion.LookRotation(player.transform.position - transform.position, Vector3.up);
            transform.rotation = Quaternion.Euler(0, transform.rotation.eulerAngles.y, 0);

            attackCounter   += Time.deltaTime;
            rockFallCounter += Time.deltaTime;

            if (attackCounter >= attackWaitTime && !isAttacking && !GetComponent <AudioSource>().isPlaying)
            {
                animator.SetTrigger("Fireball");
                attackCounter = 0;
                isAttacking   = true;
            }

            if (rockFallCounter >= rockFallWaitTime && !GetComponent <AudioSource>().isPlaying)
            {
                animator.SetTrigger("RockRoar");
                PlaySound(2);
                GamePad.SetVibration(PlayerIndex.One, 1.0f, 1.0f);
                Invoke("DisableVibrate", 5.0f);
                for (int i = 4; i < transform.childCount; i++)
                {
                    GameObject fallingRock = Instantiate(fallingRockR);

                    fallingRock.transform.position = transform.GetChild(i).transform.position;
                }
                rockFallCounter = 0;
            }

            if (!pressurePlateDone1)
            {
                if (pressurePlate1.GetIsActivated())
                {
                    pressurePlateDone1 = true;
                    NextLevel();
                    enemyWaves[3].Activate();
                }
            }

            if (!pressurePlateDone2)
            {
                if (pressurePlate2.GetIsActivated())
                {
                    pressurePlateDone2 = true;
                    NextLevel();
                    enemyWaves[1].Activate();
                }
            }

            if (!shootingTargetDone1)
            {
                if (shootingTarget1.GetIsActivated())
                {
                    shootingTargetDone1 = true;
                    NextLevel();
                    enemyWaves[2].Activate();
                }
            }

            if (!shootingTargetDone2)
            {
                if (shootingTarget2.GetIsActivated())
                {
                    shootingTargetDone2 = true;
                    NextLevel();
                    enemyWaves[0].Activate();
                }
            }

            if (currentLevel == 4)
            {
                currentLevel++;
                Die();
                //GetComponent<Health>().enabled = true;
                enemyWaves[2].Activate();
            }
        }
    }
コード例 #3
0
    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;
                }
            }
        }
    }
コード例 #4
0
    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;
            }
        }
    }