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; } } }
// 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(); } } }