// Update is called once per frame void Update() { if (loadedControls == null) { GrabControls(); } if (!started) { if (ToyBox.GetPandora()) { ToyBox.GetPandora().TimePaused = false; started = true; } } if (!curtainOpen) { if (ActivityManager.Instance) { ActivityManager.Instance.DrawCurtain(); curtainOpen = true; } } if (!playedMusic) { if (AudioPlayer.GetPlayer()) { AudioPlayer.GetPlayer().PlayAudioClip(Music); playedMusic = true; Debug.LogError("MUSIC PLAYED!"); } else { Debug.LogError("NO PLAYER!"); } } switch (currentState) { case State.Intro: { // Camera.SetupCurrent( GameObjectTracker.instance.World.CurrentCamera ); // currentState = State.Null; // if(!playedMusic) // if(AudioPlayer.GetPlayer()) // { // AudioPlayer.GetPlayer().PlayAudioClip(Music); // playedMusic = true; // Debug.LogError("MUSIC PLAYED!"); // // } // else // { // Debug.LogError("NO PLAYER!"); // } // break; } case State.Null: { //Subtract wiat timer. MovementWaitTimer -= Time.deltaTime; if (ShieldIN == true) { break; } if (MovementWaitTimer <= 0.0f) { //If the timer is up actiate the shield and trigger the animation. loadedControls.Shield.gameObject.SetActive(true); loadedControls.AnimateShield(); ShieldIN = true; //Debug.LogError("Shield Bring IN"); } break; } case State.FirstWave: { if (Waves[0].IsCompleted()) { ToyBox.GetPandora().SceneBallStack.NumberBalls = 10; currentState = State.SecondWave; Destroy(Waves[0].gameObject); //Instantuate wave. Waves[1] = Instantiate(Waves[1]) as StandardWave; //Bring in shoot button. //If the timer is up actiate the shield and trigger the animation. loadedControls.Shoot.gameObject.SetActive(true); loadedControls.AnimateShoot(); } break; } case State.SecondWave: { if (Waves[1].IsCompleted()) { currentState = State.ThirdWave; Destroy(Waves[1].gameObject); ToyBox tb = ToyBox.GetPandora(); tb.SceneBallStack.NumberBalls = 30; //Spawner the zebra. tb.AssignSlot(EntityFactory.CannonTypes.Zebra, 0); tb.CommandCenter_01.CannonSlots[0].TriggerSpawn(); //Instantuate wave. Waves[2] = Instantiate(Waves[2]) as StandardWave; } break; } case State.ThirdWave: { if (Waves[2].IsCompleted()) { currentState = State.ComboWave; Destroy(Waves[2].gameObject); //Turn on the combos now. //This is tutorial mode.. turn combos off. if (GameObjectTracker.instance) { GameObjectTracker.instance.TrackCombo = true; } //Instantuate wave. Waves[3] = Instantiate(Waves[3]) as StandardWave; } //If combo > 10 do boss. break; } case State.ComboWave: { break; } case State.Death: { //In dealth state we wait till our timer is out then we switch scenes. MovementWaitTimer -= Time.deltaTime; if (MovementWaitTimer <= 0.0f) { //Kill the wave. Destroy(Waves[4].gameObject); //Set the tutorial mode to false. GameObjectTracker.instance._PlayerData.IsTutorial = false; //Pull curtain ActivityManager.Instance.PullCurtain(); currentState = State.End; ActivityManager.Instance.SetActive = false; GameObjectTracker.instance.RestartButtonPushed(true); } break; } case State.BossWave: { if (ToyBox.GetPandora().CommandCenter_01.IsDestroyed()) { currentState = State.Death; ToyBox.GetPandora().SetSlowMotion(true); //Fade to black here? ActivityManager.Instance.ToggleHud(); ActivityManager.Instance.FadeToBlack(); MovementWaitTimer = 1.33f; } break; } default: { break; } } }