Example #1
0
 public void Play()
 {
     StatsScore.ResetScore();
     Debug.Log("Remove asdasdasdadadadsasdasdadasdads", Department.PHYSICS, Color.RED);
     Input.SetInputManagerActive("GUI", false);
     SceneManager.RemoveNoDestroy();
 }
Example #2
0
 public void Play()
 {
     if (reset)
     {
         StatsScore.ResetScore();
     }
     Audio.ChangeVolume(volume);
     Input.SetInputManagerActive("GUI", false);
     SceneManager.RemoveNoDestroy();
 }
    public bool ApplyDamage(float damage)
    {
        if (boss_active)
        {
            GetComponent <CompAudio>().PlayEvent("BossHurt");

            current_hp           -= damage;
            current_interpolation = current_hp / total_hp;

            hp_bar_boss.GetComponent <BossHPBar>().SetHPBar(current_interpolation);

            if (current_hp <= 0)
            {
                state       = AI_STATE.AI_DEAD;
                phase       = BOSS_STATE.BOSS_DEAD;
                next_action = GetComponent <Die_Action>();
                current_action.Interupt();
                GetComponent <CompAudio>().PlayEvent("BossDeath");
                StatsScore.BossDead();

                hp_bar_boss.GetComponent <BossHPBar>().ActivateHPBar(false);
                hp_bar_boss.SetActive(false);

                //todosforme
                GetLinkedObject("enemies_manager").GetComponent <EnemiesManager>().DeleteBoss();

                boss_dead = true;
            }
            else if (phase != BOSS_STATE.BOSS_PHASE2 && current_hp < total_hp * damaged_limit)
            {
                Debug.Log("BOSS PHASE2!!!!!");
                phase = BOSS_STATE.BOSS_PHASE2;
                current_action.Interupt();
                next_action = GetComponent <PhaseChange_Action>();

                //Change the boss values
                //mov vel/ attack / damages
                GetComponent <Movement_Action>().max_accel                   = phase2_mov_accel;
                GetComponent <Movement_Action>().max_rot_accel               = phase2_rot_accel;
                GetComponent <BossAttackSwordDown_Action>().damage           = phase2_down_damage;
                GetComponent <BossAttackSwordDown_Action>().preparation_time = phase2_down_time;
                GetComponent <BossWideAttack_Action>().damage                = phase2_wide_damage;
                GetComponent <BossWideAttack_Action>().preparation_time      = phase2_wide_time;
            }

            Debug.Log(current_hp);

            return(true);
        }
        else
        {
            return(false);
        }
    }
    public override bool ActionStart()
    {
        anim_comp  = GetComponent <CompAnimation>();
        audio_comp = GetComponent <CompAudio>();

        anim_comp.PlayAnimationNode("Die");
        //TODO_AI: Die audio
        audio_comp.PlayEvent("Enemy_SwordDrop");

        //PLAY COMBAT MUSIC
        Audio.ChangeState("MusicState", "None");
        GetLinkedObject("event_manager").GetComponent <PerceptionManager>().player_seen = false;
        Debug.Log("COMBAT OFF", Department.PLAYER, Color.BLUE);

        StatsScore.KillEnemy();

        //Play Dead Audio
        if (GetComponent <EnemyShield_BT>() != null)
        {
            audio_comp.PlayEvent("Enemy3_Dead");
        }
        else if (GetComponent <EnemySpear_BT>() != null)
        {
            audio_comp.PlayEvent("Enemy2_Dead");
        }
        else if (GetComponent <EnemySword_BT>() != null)
        {
            audio_comp.PlayEvent("Enemy1_Dead");
        }

        //Deactivate Listener
        if (GetComponent <SpearGuard_Listener>() != null)
        {
            GetComponent <SpearGuard_Listener>().SetEnabled(false);
        }
        else if (GetComponent <ShieldGuard_Listener>() != null)
        {
            GetComponent <ShieldGuard_Listener>().SetEnabled(false);
        }
        else if (GetComponent <SwordGuard_Listener>() != null)
        {
            GetComponent <SwordGuard_Listener>().SetEnabled(false);
        }

        anim_comp.SetClipDuration("Die", duration);
        GetComponent <CompCollider>().CollisionActive(false);
        return(true);
    }
    void DisplayTime()
    {
        StatsScore.GetTime();

        int minutes = (int)StatsScore.time / 60;
        int seconds = (int)StatsScore.time % 60;

        string text = minutes.ToString("D2") + ":" + seconds.ToString("D2");

        time_text.GetComponent <CompText>().SetText(text);

        if (StatsScore.time < gold_time)
        {
            time_text.GetComponent <CompText>().SetColor(new Vector3(1.0f, 1.0f, 0.0f), 1.0f);
        }
    }
    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;
                }
            }
        }
    }
Example #7
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;
        }
        }
    }