// Use this for initialization void Start() { audio_source = GetComponent <AudioSource>(); audio_source.clip = click_clip; touch_detection = GameObject.FindObjectOfType <TouchDetection>(); gesture_detector = GameObject.FindObjectOfType <GestureDetector>(); game_manager = GameObject.FindObjectOfType <GlassGameManager>(); touch_detection.DisableForNextGesture(true); gesture_detector.DisableTemporarily(true); guide_text = guide_text_object.GetComponent <Text>(); guide_text.color = new Color(guide_text.color.r, guide_text.color.g, guide_text.color.b, 0); guide_text.text = "Let's learn some basic control"; state = State.fading_in; stage = Stage.basic_control; stage_elapsed = stage_interval; next_button.SetActive(false); }
// Use this for initialization void Start() { audio_source = GetComponent <AudioSource>(); audio_source.clip = click_clip; touch_detection = GameObject.FindObjectOfType <TouchDetection>(); gesture_detector = GameObject.FindObjectOfType <GestureDetector>(); game_manager = GameObject.FindObjectOfType <GlassGameManager>(); powerup_manager = GameObject.FindObjectOfType <PowerUpManager>(); sprite_renderer = GetComponentInChildren <SpriteRenderer>(); powerup_meter = GameObject.FindObjectOfType <PowerupMeter>(); touch_detection.DisableForNextGesture(true); gesture_detector.DisableTemporarily(true); guide_text = guide_text_object.GetComponent <Text>(); guide_text.color = new Color(guide_text.color.r, guide_text.color.g, guide_text.color.b, 0); guide_text.text = "Let's learn about Power Up"; state = State.fading_in; stage = Stage.intro; stage_elapsed = stage_interval; next_button.SetActive(false); quit_button.SetActive(false); touch_detection.DisableForNextGesture(true); powerup_manager.DisableAllPowerUp(); sprite_renderer.enabled = false; // Fast jump for test mode //stage = Stage.supercharge_intro_3; //state = State.fading_out; //game_manager.InitializeBreakshot(); //game_manager.InitializePowerUpSpawner(); //touch_detection.DisableForNextGesture(false); //gesture_detector.DisableTemporarily(false); //PowerUpSpawner powerup_spawner = GameObject.FindObjectOfType<PowerUpSpawner>(); //powerup_spawner.enabled = false; //foreach (PowerupCalculator puc in GameObject.FindObjectsOfType<PowerupCalculator>()) { // Destroy(puc.gameObject); //} }
void HandleStageTransition() { stage_elapsed -= Time.deltaTime; if (stage_elapsed < 0) { stage_elapsed = stage_interval; switch (stage) { case Stage.intro: game_manager.InitializePowerUpSpawner(); stage = Stage.see_that; state = State.fading_out; foreach (ScoreTracker st in FindObjectsOfType <ScoreTracker>()) { st.SetGameHasStarted(true); } break; case Stage.see_that: stage = Stage.try_shooting; state = State.fading_out; break; case Stage.try_shooting: game_manager.InitializeBreakshot(); touch_detection.DisableForNextGesture(false); stage = Stage.try_shooting_2; state = State.fading_out; break; case Stage.try_shooting_2: stage = Stage.try_shooting_3; state = State.fading_out; break; case Stage.watch_collected: stage = Stage.watch_collected_2; state = State.fading_out; break; case Stage.watch_collected_2: stage = Stage.watch_collected_3; state = State.fading_out; break; case Stage.watch_collected_3: stage = Stage.watch_collected_4; state = State.fading_out; sprite_renderer.enabled = true; gesture_detector.DisableTemporarily(false); powerup_manager.allow_reinforced = true; break; case Stage.reinforced: stage = Stage.reinforced_2; state = State.fading_out; break; case Stage.reinforced_2: stage = Stage.reinforced_3; state = State.fading_out; break; case Stage.reinforced_3: stage = Stage.reinforced_4; state = State.fading_out; break; case Stage.reinforced_4: next_button.SetActive(true); stage = Stage.reinforced_5; state = State.fading_out; break; case Stage.triple_shot_intro: stage = Stage.triple_shot_1; state = State.fading_out; break; case Stage.triple_shot_1: stage = Stage.triple_shot_2; state = State.fading_out; break; case Stage.triple_shot_2: powerup_meter.FillToFull(); GameObject.Find("slide_up_gesture").GetComponent <SpriteRenderer>().enabled = true; powerup_manager.allow_triple_shot = true; stage = Stage.triple_shot_3; state = State.fading_out; break; case Stage.triple_shot_3: break; case Stage.triple_launched: stage = Stage.triple_launched_2; state = State.fading_out; break; case Stage.triple_launched_2: stage = Stage.triple_launched_3; state = State.fading_out; break; case Stage.triple_launched_3: next_button.SetActive(true); stage = Stage.triple_launched_4; state = State.fading_out; break; case Stage.triple_launched_4: stage = Stage.triple_launched_5; state = State.fading_out; break; case Stage.defensive_intro: game_manager.InitializeFakePaddles(); powerup_meter.FillToFull(); stage = Stage.defensive_intro_2; state = State.fading_out; break; case Stage.defensive_intro_2: powerup_manager.allow_safety = true; sprite_renderer.transform.position = new Vector3(4.15f, sprite_renderer.transform.position.y, 0); sprite_renderer.enabled = true; GameObject go_slide_up = GameObject.Find("slide_up_gesture"); go_slide_up.transform.rotation = Quaternion.Euler(0, 0, 180); go_slide_up.GetComponent <SpriteRenderer>().enabled = true; stage = Stage.defensive_intro_3; state = State.fading_out; break; case Stage.defensive_intro_3: break; case Stage.safe_activated: stage = Stage.safe_activated_1; state = State.fading_out; break; case Stage.safe_activated_1: next_button.SetActive(true); stage = Stage.safe_activated_2; state = State.fading_out; break; case Stage.safe_activated_2: stage = Stage.safe_activated_3; state = State.fading_out; break; case Stage.safe_activated_3: break; case Stage.supercharge_intro_2: stage = Stage.supercharge_intro_3; state = State.fading_out; break; case Stage.supercharge_intro_3: stage = Stage.supercharge_intro_4; state = State.fading_out; break; case Stage.supercharge_intro_4: next_button.GetComponentInChildren <Text>().text = "Quick Play"; next_button.SetActive(true); quit_button.SetActive(true); stage = Stage.supercharge_intro_5; state = State.fading_out; break; } } }