void Update()
    {
        //Manage Blood Feedback Sprite --------------------
        if (alpha > 0.0f)
        {
            float decrease_val = Time.deltaTime / blood_time;
            alpha -= decrease_val;
        }

        if (alpha <= 0.0f)
        {
            damage = false;
        }
        //-------------------------------------------------

        //Manage Fade to Black ----------------------------
        if (dead)
        {
            if (mult_dead >= 0.0f)
            {
                float decrease_val = Time.deltaTime / dying_time;
                mult_dead += decrease_val;
                fade_image.GetComponent <CompImage>().SetAlpha(mult_dead);
            }

            if (mult_dead >= 1.0f)
            {
                mult_dead = 1.0f;
                dead      = false;
                reviving  = true;
            }
        }

        if (reviving)
        {
            curr_dead_time += Time.deltaTime;
            if (curr_dead_time > fade_maintained_time)
            {
                float increase_val = Time.deltaTime / dying_time;
                mult_dead -= increase_val;
                fade_image.GetComponent <CompImage>().SetAlpha(mult_dead);
            }
            if (mult_dead <= 0.0f)
            {
                mult_dead = 0.0f;
                fade_image.GetComponent <CompImage>().SetAlpha(0.0f);
                curr_dead_time           = 0.0f;
                reviving                 = false;
                characters_manager.dying = false;
            }
        }
        //--------------------------------------------------

        mat.SetBool("damage", damage);
        mat.SetFloat("alpha", alpha);


        if (total_dead)
        {
            if (mult_dead >= 0.0f)
            {
                float decrease_val = Time.deltaTime / dying_time;
                mult_dead += decrease_val;
                total_fade_image.GetComponent <CompImage>().SetAlpha(mult_dead);
            }

            if (mult_dead >= 1.0f)
            {
                last_dying_current_timer += Time.deltaTime;
                float decrease_val = Time.deltaTime / dying_time;
                you_died_value += decrease_val;
                you_died_image.GetComponent <CompImage>().SetAlpha(you_died_value);
                if (last_dying_current_timer >= last_dying_timer && you_died_value >= 1.5f)
                {
                    if (SceneManager.CheckMultiSceneReady())
                    {
                        SceneManager.RemoveSecondaryScene();
                    }
                    SceneManager.LoadScene("LoseMenuV2");
                    StatsScore.SoftReset();
                    characters_manager.dying = false;
                }
            }
        }
    }
Exemple #2
0
    void LoadScene()
    {
        scene = (SceneToLoad)scene_load;
        switch (scene)
        {
        case SceneToLoad.TUTORIAL:
        {
            SceneManager.LoadNewOclusionMap("Map_Level_Tutorial_oclusion");
            SceneManager.LoadNewWalkableMap("Map_Level_Tutorial");
            SceneManager.LoadScene("Tutorial Real Scene");
            StatsScore.SoftReset();
            break;
        }

        case SceneToLoad.ALPHA2_LEVEL_1_1:
        {
            SceneManager.LoadNewOclusionMap("Map_Level_1_1_oclusion");
            SceneManager.LoadNewWalkableMap("Map_Level_1_1");
            if (DifficultySelector.hard_mode == true)
            {
                SceneManager.LoadScene("Alpha2_Level_1_1_HARD");
            }
            else
            {
                SceneManager.LoadScene("Alpha2_Level_1_1_EASY");
            }
            StatsScore.SetDefinitiveScore();
            StatsScore.SoftReset();
            break;
        }

        case SceneToLoad.ALPHA2_LEVEL_1_2:
        {
            SceneManager.LoadNewOclusionMap("Map_Level_1_2_oclusion");
            SceneManager.LoadNewWalkableMap("Map_Level_1_2");
            if (DifficultySelector.hard_mode == true)
            {
                SceneManager.LoadScene("Alpha2_Level_1_2_HARD");
            }
            else
            {
                SceneManager.LoadScene("Alpha2_Level_1_2_EASY");
            }
            StatsScore.SetDefinitiveScore();
            StatsScore.SoftReset();
            break;
        }

        case SceneToLoad.ALPHA2_LEVEL_1_3:
        {
            SceneManager.LoadNewOclusionMap("Map_Level_1_3_oclusion");
            SceneManager.LoadNewWalkableMap("Map_Level_1_3");
            if (DifficultySelector.hard_mode == true)
            {
                SceneManager.LoadScene("Alpha2_Level_1_3_HARD");
            }
            else
            {
                SceneManager.LoadScene("Alpha2_Level_1_3_EASY");
            }
            StatsScore.SetDefinitiveScore();
            StatsScore.SoftReset();
            break;
        }

        case SceneToLoad.LVL2_ZONE1:
        {
            //SceneManager.LoadNewWalkableMap("LVL2_Zone1");
            if (SceneManager.CheckMultiSceneReady())
            {
                SceneManager.RemoveSecondaryScene();
            }
            SceneManager.LoadScene("Lvl1_3ToLvl2_1");
            StatsScore.SetDefinitiveScore();
            StatsScore.SoftReset();
            break;
        }

        case SceneToLoad.LVL2_ZONE2:
        {
            SceneManager.LoadNewOclusionMap("LVL2_Zone2_oclusion");
            SceneManager.LoadNewWalkableMap("LVL2_Zone2");
            if (DifficultySelector.hard_mode == true)
            {
                SceneManager.LoadScene("LVL2_Zone_2_HARD");
            }
            else
            {
                SceneManager.LoadScene("LVL2_Zone_2_EASY");
            }
            StatsScore.SetDefinitiveScore();
            StatsScore.SoftReset();
            break;
        }

        case SceneToLoad.LVL2_ZONE3:
        {
            SceneManager.LoadNewOclusionMap("LVL2_Zone3_oclusion");
            SceneManager.LoadNewWalkableMap("LVL2_Zone3");
            if (DifficultySelector.hard_mode == true)
            {
                SceneManager.LoadScene("LVL2_Zone_3_HARD");
            }
            else
            {
                SceneManager.LoadScene("LVL2_Zone_3_EASY");
            }
            StatsScore.SetDefinitiveScore();
            StatsScore.SoftReset();
            break;
        }
        }
    }