public void StopCountdown()
 {
     current_time = 0.0f;
     active       = false;
     state        = 1;
     // Audio.ChangeState("PuzzleCountDownState", "State1");
     //audio = GetComponent<CompAudio>();
     audio.StopEvent("StartPuzzleCountdown");
 }
    public virtual void CheckHealth(float curr_hp, float max_hp, string breath_name)
    {
        //If HP is lower than 30% of max hp, play breathing ad heartbeat audio
        if (play_breathing_audio)
        {
            if ((curr_hp / max_hp * 100) <= 30.0f && currently_playing_b_audio == false)
            {
                PlayFx(breath_name);
                PlayFx("PlayHeartbeat");
                currently_playing_b_audio = true;

                Debug.Log("PLAY AUDIO: " + breath_name, Department.PLAYER, Color.BLUE);
            }
            else if ((curr_hp / max_hp * 100) >= 30.0f && currently_playing_b_audio == true)
            {
                audio.StopEvent("DaenerysBreathing");
                audio.StopEvent("TheonBreathing");
                audio.StopEvent("JaimeBreathing");
                audio.StopEvent("PlayHeartbeat");
                currently_playing_b_audio = false;

                Debug.Log("STOP AUDIO: " + breath_name, Department.PLAYER, Color.BLUE);
            }

            play_breathing_audio = false;
        }

        if (force_audio)
        {
            //STOP ALL PREVIOUS SOUNDS
            audio.StopEvent("DaenerysBreathing");
            audio.StopEvent("TheonBreathing");
            audio.StopEvent("JaimeBreathing");
            audio.StopEvent("PlayHeartbeat");
            currently_playing_b_audio = false;

            if ((curr_hp / max_hp * 100) <= 30.0f)
            {
                PlayFx(breath_name);
                PlayFx("PlayHeartbeat");
                currently_playing_b_audio = true;

                Debug.Log("PLAY AUDIO: " + breath_name, Department.PLAYER, Color.BLUE);
            }

            force_audio = false;
        }
    }
示例#3
0
    void Update()
    {
        //-- TMP: Debug -----

        /*  if(on_lever_animation && anim_controller.IsAnimationStopped(lever_animation_name))
         * {
         *    OnLeverAnimFinish();
         * }*/

        //-- Lever Triggered -----
        if (on_lever_range && !active_lever && !on_lever_animation)
        {
            //TODO: Change to GetKey_Action
            if (Input.GetInput_KeyDown("Interact", "Player"))
            {
                //Reset other puzzles if exists to avoid audio conflicts
                if (other_lever_1 != null)
                {
                    other_lever_1.GetComponent <Lever>().ResetPuzzle();
                    other_lever_1.GetComponent <PuzzleCountdown>().StopCountdown();
                }
                if (other_lever_2 != null)
                {
                    other_lever_2.GetComponent <Lever>().ResetPuzzle();
                    other_lever_2.GetComponent <PuzzleCountdown>().StopCountdown();
                }

                SetOrientationVectors();
                OnLeverActivated();
                GetComponent <CompAudio>().PlayEvent("Lever");
                lever_interact.SetActive(false);
            }
        }

        //---------------------

        if (on_lever_animation)
        {
            anim_controller = lever_go.GetComponent <CompAnimation>();
            if (anim_controller != null)
            {
                if (anim_controller.IsAnimationStopped(lever_animation_name))
                {
                    // The lever animation has stopped so puzzle must start.
                    OnLeverAnimFinish();
                }
            }
        }

        if (active_lever)
        {
            if (!phase1) // Set info all barrels
            {
                SetInfo(line1, 0);
                SetInfo(line2, 1);
                SetInfo(line3, 2);
                SetInfo(line4, 3);
                SetInfo(line5, 4);
                SetInfo(line6, 5);
                phase1 = true;
            }
            if (!phase2) // Move barrels mode.PUZZLE
            {
                MoveBarrels(line1);
                MoveBarrels(line2);
                MoveBarrels(line3);
                MoveBarrels(line4);
                MoveBarrels(line5);
                MoveBarrels(line6);
                phase3     = true;
                phase2     = true;
                phase_wait = true;
                time       = Time.realtimeSinceStartup + delay_second_mode;
                audio.PlayEvent("Chain");
                MoveChains(true);
            }

            if (phase_wait) // wait to move the other mode
            {
                // Wait delay to move other barrels
                float time_transcured = Time.realtimeSinceStartup;
                if (time_transcured >= time)
                {
                    phase3     = false;
                    phase_wait = false;
                }
            }
            if (!phase3) // Move barrels mode.FILLING
            {
                MoveBarrels(line1, true);
                MoveBarrels(line2, true);
                MoveBarrels(line3, true);
                MoveBarrels(line4, true);
                MoveBarrels(line5, true);
                MoveBarrels(line6, true);
                phase3  = true;
                editmap = true;
            }

            if (fill_barrel != null && fill_barrel.IsPlaced() == true)
            {
                if (editmap)
                {
                    audio.StopEvent("Chain");
                    SetPathWalkable(0, 3);
                    editmap = false;
                    countdown.StartCountdown();
                    MoveChains(false);
                }
                else if (countdown.IsCountdownOver())
                {
                    ResetPuzzle();
                }
            }
        }
    }