示例#1
0
    public void Be_Attacked()
    {
        // If RGB_Slime is in combat
        if (Doom_Shroom_St.Get_States() != Boss_States.Cinematic && Doom_Shroom_St.Get_States() != Boss_States.Dead)
        {
            // Make boss angrier
            Current_Health -= 1;
            Debug.Log("Doom Shroom Health : " + Current_Health);
            // If the boss has heath, he become stunt else he die
            if (Current_Health > 2)
            {
                // Debug
                Debug.Log("Doom shroom : Ouch");
                // Update To Attac so if Doom Shroom is waiting he will jump
                Doom_Shroom_St.Update_State(Boss_States.Attack);
                Doom_Shroom_An.Launch_Stunt_Animation();
            }
            else
            {
                Doom_Shroom_St.Update_State(Boss_States.Dead);
                Doom_Shroom_An.Launch_Death_Animation();
            }

            HUD.Update_Boss_Health_Bar(Current_Health, Max_Health);
        }
    }
    private IEnumerator Jump_Action(bool left)
    {
        // Stop potential jumps
        Is_Grounded = false;
        Doom_Shroom_RB.gravityScale = 0.3f;
        // Launch animation
        Doom_Shroom_An.Launch_Attack_Animation();
        // Wait for attack lenth
        yield return(new WaitForSeconds(Attack_Lenght));

        // Launch animation
        Doom_Shroom_An.Launch_Jump_Animation();
        // Move jump trigger inside th collision to block ground check while we wait for the next windows of action
        Ground_Checker.transform.localPosition = new Vector3(0, 0, 0);
        // If Doom_Shroom has to jump and is alive to the left go in the left direction or go to the right direction if not
        if (State != Boss_States.Dead)
        {
            if (left)
            {
                Doom_Shroom_RB.velocity = new Vector2(-Jump_Horizontal_Speed, Jump_Vertical_Speed);
            }
            else
            {
                Doom_Shroom_RB.velocity = new Vector2(Jump_Horizontal_Speed, Jump_Vertical_Speed);
            }
        }

        yield return(new WaitForSeconds(1.5f));

        Doom_Shroom_RB.gravityScale = 3f;

        yield return(new WaitForSeconds(Current_Jump_Delay));

        // Move jump trigger outside the collision to make ground check possible
        Ground_Checker.transform.localPosition = new Vector3(0, -2, 0);
        // Increase jump counter
        Jump_Counter++;
        // Check if jump counter is a multiple of je wait number to make doom shroom wait sometimes
        if (Jump_Counter % Number_Of_Jump_Before_Wait == 0)
        {
            // Update general state
            Doom_Shroom_St.Update_State(Boss_States.Wait);
            // Start wait time
            StartCoroutine(Wait());
        }
    }
 public void Launch_Cinematic(int id)
 {
     if (id == Cinematic_Id)
     {
         Doom_Shroom_St.Update_State(Boss_States.Attack);
         // Launch Boss_Music
         GetComponent <AudioSource>().Play();
         // Fade in boss music
         Audio_Mixer_Control.current.Fade_Boss(0, 1.0f);
         // Fade out normal music
         Audio_Mixer_Control.current.Fade_Music(-80, 1f);
     }
 }