Stop() public method

public Stop ( ) : void
return void
Esempio n. 1
0
    void CloseDialogue()
    {
        if (dialogueOpen)
        {
            StartCoroutine(DelayedAllowInput(0.25f));
            dialogueOpen = false;

            int childCount = textPanel.childCount;

            for (int i = childCount; i > 0; i--)
            {
                Destroy(textPanel.GetChild(i - 1).gameObject);
            }

            namePanel.text = "";
            animator.Play("Close");


            previewTriggers = null;

            if (emitter.IsPlaying())
            {
                emitter.Stop();
            }
        }
    }
Esempio n. 2
0
 public void PlayLevelVictory()
 {
     if (bgm != null)
     {
         bgm.Stop();
         levelEndMusic.Play();
     }
 }
Esempio n. 3
0
 void StopMusicEmitter()
 {
     CancelInvoke("StopMusicEmitter");
     emitter.Stop();
     canvas.enabled = true;
     continueButton.gameObject.SetActive(true);
     HandleContinueButtonClick();
 }
Esempio n. 4
0
    IEnumerator EndGameCoroutine()
    {
        yield return(new WaitForSeconds(1f));

        float alpha = endPanel.color.a;

        for (float t = 0.0f; t < 3.0f; t += Time.deltaTime)
        {
            Color newColor = new Color(1, 1, 1, Mathf.Lerp(alpha, 1f, t));
            endPanel.color = newColor;
            yield return(null);
        }
        endPanel.color = new Color(1, 1, 1, 1f);

        musicEmitter.Stop();
        ambientNoiseEmitter.Stop();

        if (GameManager.instance.collectedLesserArtifacts.Count == GameManager.instance.lesserArtifacts.Length)
        {
            SceneManager.LoadScene("endgame_b");
        }
        else
        {
            SceneManager.LoadScene("endgame_a");
        }
    }
Esempio n. 5
0
 void ShowNextNPCDialogueLine()
 {
     //stop any previous dialogue audio, then play a new one
     roboVoice.Stop();
     roboVoice.Play();
     // TODO: show each line manually, proceeding via player input
     while (story.canContinue)
     {
         // Continue gets the next line of the story
         string text = story.Continue();
         // This removes any white space from the text.
         text = text.Trim();
         // Display the text on screen!
         CreateContentView(text);
     }
 }
    private void OnTriggerExit2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Player")
        {
            //print("player is out");
            GameObject exitedPlayer = collision.gameObject.transform.parent.root.gameObject;

            if (players.Contains(exitedPlayer) == true)
            {
                int exitIndex = players.IndexOf(exitedPlayer);
                players.RemoveAt(exitIndex);
                playerMovementScripts.RemoveAt(exitIndex);

                playerIndicatorScripts[exitIndex].RevertImage();
                playerIndicatorScripts[exitIndex].DisableImage();   // make the campfire indicators disappear when a player leaves the campfire
                playerIndicatorScripts.RemoveAt(exitIndex);
            }

            if (players.Count < 2)
            {
                //unCompletedLevelInfo.SetActive(false);
                ChooseLevelInfoToDisplay(false);

                if (InteractionMusic != null)
                {
                    InteractionMusic.Stop();    // Stop Music
                }

                for (int i = 0; i < playerIndicatorScripts.Count; i++)
                {
                    playerIndicatorScripts[i].RevertImage();
                }
            }
        }
    }
Esempio n. 7
0
    void MagPullUpdate()
    {
        if (magPulling && !propFlying)
        {
            attractorParticles.transform.localScale = Vector3.Lerp(attractorParticles.transform.localScale, Vector3.one, Time.deltaTime * 5f);

            attractorParticles.SetEmission(true);

            if (!magStateSwapped)
            {
                emitter.Play();

                magStateSwapped = true;
            }
        }

        else
        {
            attractorParticles.transform.localScale = Vector3.Lerp(attractorParticles.transform.localScale, Vector3.zero, Time.deltaTime * 15f);
            attractorParticles.SetEmission(false);

            if (magStateSwapped)
            {
                emitter.Stop();
                FMODUnity.RuntimeManager.PlayOneShot("event:/MagLoopEnd");

                magStateSwapped = false;
            }
        }

        magAttachTimeElapsed += Time.deltaTime;
    }
Esempio n. 8
0
    private IEnumerator PlaySequence()
    {
        enabled = false;
        PlayerStatus.Instance.GetComponent <Movement>().ControlsEnabled = false;
        if (_particle_system)
        {
            _particle_system.Play();
        }
        _fire_sound.Play();
        float timer;

        for (int i = 0; i < _crystals.Length; i++)
        {
            _music_sequence[i].Play();
            _crystals[i].State = true;
            timer = delay;
            while (timer > 0)
            {
                yield return(null);

                timer -= Time.deltaTime;
            }
            _crystals[i].State = false;
        }
        enabled = true;
        PlayerStatus.Instance.GetComponent <Movement>().ControlsEnabled = true;
        if (_particle_system)
        {
            _particle_system.Stop();
        }
        _puzzle_manager.ResetPuzzle();
        _fire_sound.Stop();
    }
Esempio n. 9
0
    private void leaveState()
    {
        switch (currentState)
        {
        case State.GRUONDED:
            fm_running.Stop();
            break;

        case State.FALLING:
            fm_air.Stop();
            break;

        case State.DASHING:
            rb.useGravity = true;
            break;

        case State.DYING:
            break;

        case State.PAUSED:
            rb.isKinematic = false;
            rb.useGravity  = true;
            rb.AddForce(vec_pauseVelocity, ForceMode.VelocityChange);
            coll.enabled = true;
            anim.speed   = 1;
            break;
        }
    }
Esempio n. 10
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Player"))
     {
         bgMusicEmitter.Stop();
     }
 }
    private IEnumerator PlaySequence()
    {
        enabled = false;
        PlayerStatus.Instance.GetComponent <Movement>().ControlsEnabled = false;
        float timer;

        if (ParticleSystem)
        {
            ParticleSystem.Play();
        }
        _fire_sound.Play();
        for (int i = 0; i < _crystal_sound_sequence.Length; i++)
        {
            _crystal_sound_sequence[i].Play();
            timer = delay;
            while (timer > 0)
            {
                yield return(null);

                timer -= Time.deltaTime;
            }
        }
        enabled = true;
        PlayerStatus.Instance.GetComponent <Movement>().ControlsEnabled = true;
        if (ParticleSystem)
        {
            ParticleSystem.Stop();
        }
        _fire_sound.Stop();
    }
Esempio n. 12
0
    public void Restore()
    {
        if (!gameObject.activeSelf)
        {
            return;
        }

        sr.color           = new Color(sr.color.r, sr.color.g, sr.color.b, 0f);
        transform.position = defaultPosition;
        emitterStart.Stop();
        emitterLoop.Stop();
        gameObject.SetActive(false);

        Player player = FindObjectOfType <Player>();

        player.DeactivateActions();
    }
Esempio n. 13
0
 public void ChangeStation(Interactable source)
 {
     if (isPlaying)
     {
         musicEv.Stop();
         musicEv.Play();
     }
 }
Esempio n. 14
0
    public void StartScene()
    {
        player.disableInput = false;
        camera.TimedLookToggle(false, player.transform.position);

        if (mainthemeEmitter)
        {
            mainthemeEmitter.Stop();
            Destroy(mainthemeEmitter);
        }

        if (playerGravity != 1)
        {
            player.gravity = playerGravity;
        }

        fadeHandler.FadeIn(5f, Color.white);
    }
Esempio n. 15
0
 /// <summary>
 /// stop l'emmiter
 /// </summary>
 public void Stop()
 {
     if (!gameObject || !emitter)
     {
         return;
     }
     emitter.Stop();
     //SendMessage("Stop");
 }
Esempio n. 16
0
 public void RemoveMiko()
 {
     EvilMiko.SetActive(false);
     emitter.Stop();
     FMOD.Studio.EventInstance music = FMODUnity.RuntimeManager.CreateInstance("event:/BackgroundMusic");
     music.setParameterValue("NormalTown", 1f);
     music.start();
     StartCoroutine(MoveCredits());
 }
Esempio n. 17
0
 // Start is called before the first frame update
 void Start()
 {
     _spotLightHandler       = this.GetComponent <SpotlightHandler>();
     _chladniTalkBoard       = this.gameObject.AddComponent <FMODUnity.StudioEventEmitter>();
     _chladniTalkBoard.Event = _tutorialSounds[0];
     _chladniTalkBoard.EventInstance.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(chladniSoundEmitter.transform));
     _soundAfterTutorial       = this.gameObject.AddComponent <FMODUnity.StudioEventEmitter>();
     _soundAfterTutorial.Event = GLOB.BackgroundSound;
     _soundAfterTutorial.Stop();
 }
Esempio n. 18
0
    public void DisableAndFadeOut()
    {
        Collider2D collider = GetComponent <Collider2D>();

        collider.enabled = false;
        StartCoroutine(FadeOut());
        emitterStart.Stop();
        emitterLoop.Stop();
        bgMusic.Stop();
    }
    // Update is called once per frame
    void Update()
    {
        if (terrorist == null)
        {
            terrorist = GameObject.Find("Terrorist(Clone)");
        }
        if (player == null)
        {
            player = GameObject.Find("Server_FPS(Clone)");
            return;
        }

        // Parameters: InGame / Death / Intensity / Victory

        float param_InGame    = player.GetComponent <MoveFPS> ().enabled ? 1f : 0f;
        float param_Death     = Global.GameOver ? 1f : 0f;
        float param_Intensity = 0f;

        if (terrorist != null)
        {
            param_Intensity = 1f - ((transform.position - terrorist.transform.position).magnitude / 20f);
        }
        float param_Victory = (Global.victory) ? 1f : 0f;

        MusicLoop.SetParameter("InGame", param_InGame);
        MusicLoop.SetParameter("Death", param_Death);
        MusicLoop.SetParameter("Intensity", param_Intensity);
        MusicLoop.SetParameter("Victory", param_Victory);

        HeartBeats.SetParameter("Intensity", param_Intensity);
        HeartBeats.SetParameter("Death", Mathf.Min(1f, param_Death + param_Victory));

        float param_Timer = 1f - Global.timeLeft / Global.duration;

        if (Global.GameOver || Global.victory)
        {
            param_Timer = 0f;
        }

        if (!CopsSounds.IsPlaying())
        {
            CopsSounds.Play();
        }
        CopsSounds.SetParameter("Timer", param_Timer);

        if (Global.phoneRing && !phoneRing.IsPlaying())
        {
            phoneRing.Play();
        }
        if (!Global.phoneRing && phoneRing.IsPlaying())
        {
            phoneRing.Stop();
        }
    }
Esempio n. 20
0
 /// <summary>
 /// Either play or stop the inserted StudioEventEmitter-component.<para></para>
 /// TRUE = Play sound.
 /// <para></para> FALSE = Stop the sound.
 /// </summary>
 public void PlayStopSound(FMODUnity.StudioEventEmitter fmodComponent, bool playStop)
 {
     if (playStop)
     {
         fmodComponent.Play();
     }
     else
     {
         fmodComponent.Stop();
     }
 }
Esempio n. 21
0
 // Start is called before the first frame update
 void Awake()
 {
     if (CombatInfo.FightType != 1)
     {
         bossMusic.Stop();
         battleSound.Play();
     }
     else
     {
         bossMusic.Play();
         battleSound.Stop();
     }
     SelectEnvironment(CombatInfo.Env);
 }
Esempio n. 22
0
    public override void AttachToTransform(Transform newParent)
    {
        transform.position = newParent.position;
        transform.rotation = newParent.rotation;
        transform.parent   = newParent;
        beingHeld          = true;
        _animator.SetBool(Str.Held, true);
        _emitter.Stop();

        if (!pickedUpAlready)
        {
            FModMusicManager.FoundItem();
            pickedUpAlready = true;
        }
    }
Esempio n. 23
0
    private void FadeOutSandPour()
    {
        if (_sandPourParticle.isPlaying)
        {
            _sandPourParticle.Stop();
        }

        _sandPourSoundEmitter.EventInstance.getVolume(out sandPourVolume, out float finalvolume);
        if (sandPourVolume > 0)
        {
            _sandPourSoundEmitter.EventInstance.setVolume(audioStartVolume * (1 - ((Time.time - fadeStartTime) / FadeTime)));
        }
        else
        {
            _sandPourSoundEmitter.Stop();
            _sandPourPlaying = false;
        }
    }
    private IEnumerator PlaySequence()
    {
        enabled = false;
        PlayerStatus.Instance.GetComponent <Movement>().ControlsEnabled = false;
        if (_particle_system)
        {
            _particle_system.Play();
        }
        _fire_sound.Play();
        float timer;

        for (int i = 0; i < _crystals.Length; i++)
        {
            _crystals[i].GetComponentInChildren <FMODUnity.StudioEventEmitter>().Play();
            _crystals[i].State = true;
            timer = delay;
            while (timer > 0)
            {
                yield return(null);

                timer -= Time.deltaTime;
            }
            _crystals[i].State = false;
        }
        if (_crystals_not_involved != null)
        {
            for (int i = 0; i < _crystals_not_involved.Length; i++)
            {
                _crystals_not_involved[i].State = false;
            }
        }

        enabled = true;
        PlayerStatus.Instance.GetComponent <Movement>().ControlsEnabled = true;
        if (_particle_system)
        {
            _particle_system.Stop();
        }
        _fire_sound.Stop();
    }
Esempio n. 25
0
    void CalculateNumberOfCollectedPieces()
    {
        int totalPlayerPieces = 0;

        // get the player health from the movment script
        for (int i = 0; i < playerHealthScripts.Count; i++)
        {
            totalPlayerPieces += (int)playerHealthScripts[i].health;
        }

        totalPlayerPieces = totalPlayerPieces - 2;  // Subract two to account for the player characters
        //these are for the save manager
        caughtBoys = totalPlayerPieces;

        TotalPlayerPieces pieceCounter = TotalPlayerPieces.instance;

        allBoys = pieceCounter.totalPlayerPieces - 2;
        TextMesh boyCountText = playerPieceCountText.GetComponent <TextMesh>();

        if (totalPlayerPieces < pieceCounter.totalPlayerPieces - 2 && totalPlayerPieces != 1)   // for > 1 camper
        {
            boyCountText.text = "You Collected " + totalPlayerPieces + " Campers!";
        }
        else if (totalPlayerPieces < pieceCounter.totalPlayerPieces - 2 && totalPlayerPieces == 1)  // for 1 camper
        {
            boyCountText.text = "You Collected " + totalPlayerPieces + " Camper!";
        }
        else if (totalPlayerPieces >= pieceCounter.totalPlayerPieces - 2)       // for all campers collected
        {
            boyCountText.text = "You Collected all the Campers!";

            // set the music to the wistle theme
            if (musicEmitter != null)
            {
                musicEmitter.Stop();
            }
            allCampersCollected = true;
        }
    }
Esempio n. 26
0
    // Update is called once per frame
    void Update()
    {
        //Outdoor ambiancen stängs av i Indoor Large

        /*if (audioManager.material <= 4 && !outdoorEmitter.IsPlaying())
         * {
         *      outdoorEmitter.Play ();
         *      Debug.Log ("Outdoor_Play");
         * }
         * if (audioManager.material >= 4 && outdoorEmitter.IsPlaying ())
         * {
         *      outdoorEmitter.Stop ();
         *      Debug.Log ("Outdoor_Stop");
         * }*/

        //Small Cave Ambiance spelas upp i indoor small
        if (audioManager.material == 3 && !indoorSmallEmitter.IsPlaying())
        {
            indoorSmallEmitter.Play();
            Debug.Log("IndoorSmall_Play");
        }
        if (audioManager.material != 3 && indoorSmallEmitter.IsPlaying())
        {
            indoorSmallEmitter.Stop();
            Debug.Log("IndoorSmall_Stop");
        }

        if (audioManager.material == 4 && !indoorLargeEmitter.IsPlaying())
        {
            indoorLargeEmitter.Play();
            Debug.Log("IndoorLarge_Play");
        }
        if (audioManager.material != 4 && indoorLargeEmitter.IsPlaying())
        {
            indoorLargeEmitter.Stop();
            Debug.Log("IndoorLarge_Stop");
        }
    }
Esempio n. 27
0
 private void ChangeSounds(string pGlobName, bool pBoolInterrupt = true)
 {
     if (_chladniTalkBoard.IsPlaying())
     {
         if (pBoolInterrupt)
         {
             _chladniTalkBoard.Stop();
         }
     }
     else
     {
         for (int i = 0; i < videos.Length; i++)
         {
             videos[i].PlayChladniVideo(Array.IndexOf(_tutorialSounds, pGlobName));
         }
         _chladniTalkBoard.ChangeEvent(pGlobName);
         _chladniTalkBoard.Play();
         _soundShouldChange = false;
         if (pGlobName == _tutorialSounds[4])
         {
             _fsliderSoundHasPlayed = true;
         }
         if (pGlobName == _tutorialSounds[3])
         {
             _sandMoveSoundHasPlayed = true;
         }
         if (pGlobName == _tutorialSounds[5])
         {
             _sliderMoveSoundHasPlayed = true;
         }
         if (pGlobName == _tutorialSounds[7])
         {
             Debug.Log("Yes hello");
             _goodbyeHasPlayed = true;
         }
     }
 }
Esempio n. 28
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.F5))
        {
            Debug.Log("Complete tutorial");
            _currentStage    = 6;
            readyToComplete  = true;
            isSwitchingStage = true;
            CompleteStage(6);
            videos[0].PlayChladniVideo(7);
            videos[1].PlayChladniVideo(7);
            videos[0].clipIndex = 7;
            videos[1].clipIndex = 7;
            _spotLightHandler.SwitchLights(SpotlightHandler.LightState.JARS);
            _spotLightHandler.SwitchLights(SpotlightHandler.LightState.PLATE);
            _spotLightHandler.SwitchLights(SpotlightHandler.LightState.SLIDERA);
            _spotLightHandler.SwitchLights(SpotlightHandler.LightState.SLIDERF);
            _spotLightHandler.SwitchLights(SpotlightHandler.LightState.FINISHED);
        }
        if (_chladniTalkBoard.Event == _tutorialSounds[0] && !_chladniTalkBoard.IsPlaying() && _welcomeSoundHasPlayed)
        {
            _soundTargetString = _tutorialSounds[1];
            _soundShouldChange = true;
        }
        if (_chladniTalkBoard.Event == _tutorialSounds[3] && !_chladniTalkBoard.IsPlaying() && _sandMoveSoundHasPlayed)
        {
            _soundTargetString = _tutorialSounds[4];
            _soundShouldChange = true;
        }
        if (_chladniTalkBoard.Event == _tutorialSounds[4] && !_chladniTalkBoard.IsPlaying() && _fsliderSoundHasPlayed)
        {
            _soundTargetString = _tutorialSounds[5];
            _soundShouldChange = true;
        }
        if (_chladniTalkBoard.Event == _tutorialSounds[7] && !_chladniTalkBoard.IsPlaying() && _goodbyeHasPlayed && !_soundAfterTutorial.IsPlaying())
        {
            _soundAfterTutorial.Play();
        }
        if (_currentStage <= 0)
        {
            if (Time.time - SceneStartTime >= StartDelay)
            {
                ResetTutorial();
            }
            else
            {
                return;
            }
        }
        if (isSwitchingStage)
        {
            if (Time.time - stageSwitchTime >= NextStageDelay)
            {
                _currentStage++;
                if (_currentStage == 3)
                {
                    _spotLightHandler.ChangeLight((SpotlightHandler.LightState)_currentStage, 10);
                }
                else if (_currentStage == 4)
                {
                    _spotLightHandler.ChangeLight((SpotlightHandler.LightState)_currentStage, 4);
                    CompleteDelay = 5.5f;
                }
                else
                {
                    _spotLightHandler.ChangeLight((SpotlightHandler.LightState)_currentStage);
                }
                isSwitchingStage = false;
                if (CompleteDelay > 0)
                {
                    stageStartTime  = Time.time;
                    readyToComplete = false;
                }
            }
        }
        if (!readyToComplete)
        {
            if (Time.time - stageStartTime >= CompleteDelay)
            {
                readyToComplete = true;
            }
        }

        if (!_sceneStarting)
        {
            if (Time.time > _startupTime + _delayOnStart)
            {
                _sceneStarting = true;
            }
        }
        if (_soundShouldChange)
        {
            ChangeSounds(_soundTargetString, true);
            _soundAfterTutorial.Stop();
            //For some reason it justs randomly starts.
        }
    }
Esempio n. 29
0
    // Update is called once per frame
    void Update()
    {
        if (soundEmitter != null && soundWhenOpened && (isOpen || isOpening()) && !soundEmitter.IsPlaying())
        {
            soundEmitter.Play();
        }
        if (soundEmitter != null && soundWhenOpened && (isClose || isClosing()) && soundEmitter.IsPlaying() && !playAllsound)
        {
            soundEmitter.Stop();
        }
        if (soundEmitter != null && !soundWhenOpened && (isOpen || isOpening()) && soundEmitter.IsPlaying() && !playAllsound)
        {
            soundEmitter.Stop();
        }
        if (soundEmitter != null && !soundWhenOpened && (isClose || isClosing()) && !soundEmitter.IsPlaying())
        {
            soundEmitter.Play();
        }

        if (movableObject == null && autoClose && isOpen)
        {
            isOpen  = !isOpen;
            isClose = !isClose;
        }


        if (!isActionEnded)
        {
            if (needOpen)
            {
                if (amplitudeActual >= amplitudeMaxAbs)
                {
                    isActionEnded   = true;
                    amplitudeActual = amplitudeMaxAbs;
                    isOpen          = true;
                    isClose         = false;
                    if (autoClose)
                    {
                        Action(lastActionner);
                    }
                }
                else
                {
                    amplitudeActual += Time.deltaTime * movementSpeed;
                }
            }
            else
            {
                if (amplitudeActual <= 0.0f)
                {
                    isActionEnded   = true;
                    amplitudeActual = 0.0f;
                    isClose         = true;
                    isOpen          = false;
                }
                else
                {
                    amplitudeActual -= Time.deltaTime * movementSpeed;
                }
            }
        }

        if (movableObject)
        {
            if (movementIsRotation)
            {
                movableObject.transform.localEulerAngles = initialLocalEulerAngles + amplitudeMaxSigne * new Vector3(direction.x * amplitudeActual, direction.y * amplitudeActual, direction.z * amplitudeActual);
            }
            else
            {
                movableObject.transform.position = initialPosition + amplitudeMaxSigne * new Vector3(direction.x * amplitudeActual, direction.y * amplitudeActual, direction.z * amplitudeActual);
            }
        }

        if (activeWhenOpened)
        {
            if (particuleSystem && !isClose && needOpen && !particuleSystem.isPlaying)
            {
                particuleSystem.Play();
            }
            if (particuleSystem && !isOpen && !needOpen && !particuleSystem.isStopped)
            {
                particuleSystem.Stop();
            }
        }
        else
        {
            if (particuleSystem && !isOpen && !needOpen && !particuleSystem.isPlaying)
            {
                particuleSystem.Play();
            }
            if (particuleSystem && !isClose && needOpen && !particuleSystem.isStopped)
            {
                particuleSystem.Stop();
            }
        }

        if (enableWhenOpened)
        {
            for (int i = 0; i < dependences.Length; i++)
            {
                dependences [i].SetActive(isOpen);
            }
        }
        else
        {
            for (int i = 0; i < dependences.Length; i++)
            {
                dependences [i].SetActive(isClose);
            }
        }
    }
Esempio n. 30
0
 public void PlaySound(FMODUnity.StudioEventEmitter emitter, string ev)
 {
     emitter.Stop();
     emitter.Event = ev;
     emitter.Play();
 }