void Update() { if (Input.GetKeyDown(KeyCode.Space)) { if (freestyle_mode) { // Cleanup for transition from freestyle mode to customization mode. SetStarVisibilityForAllLaunchers(false); GameObject launcher_go = launchers[curr_launcher_index]; if (launcher_go.GetComponent(typeof(CustomizationSceneLauncher))) { CustomizationSceneLauncher launcher_script = ( CustomizationSceneLauncher )launcher_go.GetComponent(typeof(CustomizationSceneLauncher)); launcher_script.PlayParticleSystem(); } } else { // Cleanup for transition from customization mode to freestyle mode. StopAllLaunchers(); SetStarVisibilityForAllLaunchers(true); } freestyle_mode = !freestyle_mode; } if (freestyle_mode) { DetectFreestyleModeInput(); } else { DetectCustomizationModeInput(); } }
private void SetStarVisibilityForAllLaunchers(bool display_star) { for (int i = 0; i < 8; ++i) { GameObject launcher_go = launchers[i]; if (launcher_go.GetComponent(typeof(CustomizationSceneLauncher))) { CustomizationSceneLauncher launcher_script = ( CustomizationSceneLauncher )launcher_go.GetComponent(typeof(CustomizationSceneLauncher)); launcher_script.SetStarVisibility(display_star); } } }
private void StopAllLaunchers() { for (int i = 0; i < 8; ++i) { GameObject launcher_go = launchers[i]; if (launcher_go.GetComponent(typeof(CustomizationSceneLauncher))) { CustomizationSceneLauncher launcher_script = ( CustomizationSceneLauncher )launcher_go.GetComponent(typeof(CustomizationSceneLauncher)); launcher_script.StopParticleSystem(); } } }
private void InitializeFireworkLaunchers() { for (int i = 0; i < 8; ++i) { GameObject launcher_go = launchers[i]; if (launcher_go.GetComponent(typeof(CustomizationSceneLauncher))) { CustomizationSceneLauncher launcher_script = ( CustomizationSceneLauncher )launcher_go.GetComponent(typeof(CustomizationSceneLauncher)); curr_particle_index = launcher_particle_correspondences[i]; launcher_script.SetParticleSystem(curr_particle_index); launcher_script.StopParticleSystem(); } } }
private void SwapParticleSystems() { launcher_particle_correspondences[curr_launcher_index] = curr_particle_index; //Store the firework index for cross-scene access PlayerPrefs.SetInt(curr_launcher_index.ToString(), curr_particle_index); GameObject launcher_go = launchers[curr_launcher_index]; if (launcher_go.GetComponent(typeof(CustomizationSceneLauncher))) { CustomizationSceneLauncher launcher_script = ( CustomizationSceneLauncher )launcher_go.GetComponent(typeof(CustomizationSceneLauncher)); launcher_script.SetParticleSystem(curr_particle_index); } }
private void UpdateFireworkLaunchers() { curr_particle_index = launcher_particle_correspondences[curr_launcher_index]; GameObject launcher_go = launchers[prev_launcher_index]; if (launcher_go.GetComponent(typeof(CustomizationSceneLauncher))) { CustomizationSceneLauncher launcher_script = ( CustomizationSceneLauncher )launcher_go.GetComponent(typeof(CustomizationSceneLauncher)); launcher_script.StopParticleSystem(); } launcher_go = launchers[curr_launcher_index]; if (launcher_go.GetComponent(typeof(CustomizationSceneLauncher))) { CustomizationSceneLauncher launcher_script = ( CustomizationSceneLauncher )launcher_go.GetComponent(typeof(CustomizationSceneLauncher)); launcher_script.PlayParticleSystem(); } }
void Start() { curr_particle_index = 0; prev_launcher_index = 0; curr_launcher_index = 0; launcher_particle_correspondences = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }; freestyle_mode = false; InitializeFireworkLaunchers(); // Set launcher #5 of 8 to be on at startup. curr_launcher_index = 4; GameObject launcher_go = launchers[curr_launcher_index]; if (launcher_go.GetComponent(typeof(CustomizationSceneLauncher))) { CustomizationSceneLauncher launcher_script = ( CustomizationSceneLauncher )launcher_go.GetComponent(typeof(CustomizationSceneLauncher)); launcher_script.PlayParticleSystem(); } }