release() public method

public release ( ) : RESULT
return RESULT
Beispiel #1
0
    void Update()
    {
        if (shake != null)
        {
            if (!shake.IsPlaying())
            {
                if (mainCam.transform.localPosition != camPos)
                {
                    mainCam.transform.localPosition = camPos;
                }
            }
        }

        // Checks playing track to see if it is finished playing
        if (playingTrack.isValid())
        {
            FMOD.Studio.PLAYBACK_STATE playbackState;
            playingTrack.getPlaybackState(out playbackState);
            if (playbackState == FMOD.Studio.PLAYBACK_STATE.STOPPED)
            {
                //Debug.Log("DEBUG: Releasing stopped track.");
                playingTrack.release();



                playing = null;
                notifier.Stop();
            }
        }
        else
        {
            IsStopping = false;
        }
    }
Beispiel #2
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Joystick1Button6) || Input.GetKeyDown(KeyCode.Joystick2Button6))
     {
         icecubeDestroy.release();
     }
 }
Beispiel #3
0
    void Update()
    {
        if (title)
        {
            transform.Translate(3 * Time.deltaTime, 0, 0);
            return;
        }
        transform.position = player.position + offset;
        targetZoom         = Mathf.Lerp(zoomRange.x, zoomRange.y,
                                        Mathf.Clamp(player.GetComponent <Rigidbody2D>().velocity.magnitude / maxSpeed, 0, 1));
        GetComponent <Camera>().orthographicSize = Mathf.Lerp(GetComponent <Camera>().orthographicSize, targetZoom, Time.deltaTime);

        if (portalCom.isActive)
        {
            musicInstance.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
            musicInstance.release();
        }

        if (playerMovement.isDed)
        {
            delay += Time.deltaTime;
            if (delay >= 5)
            {
                SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
            }
            musicInstance.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
            musicInstance.release();
        }
    }
Beispiel #4
0
    public void FMODMusicChange(string path)
    {
        FMODmusic.release();
        FMODmusic = FMODUnity.RuntimeManager.CreateInstance(path);
        FMODmusic.setUserData(GCHandle.ToIntPtr(timelineHandle));

        FMODmusic.setCallback(beatCallback, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT | FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER);
    }
Beispiel #5
0
 void OnDestroy()
 {
     if (chainEventInstance != null)
     {
         chainEventInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
         chainEventInstance.release();
         chainEventInstance = null;
     }
 }
Beispiel #6
0
    public void OnBlock()
    {
        m_Animator.SetBool(m_blockAnimBool, false); // Ends block animation.

        // Plays the sound for when the player successfully blocks an attack.
        FMODUnity.RuntimeManager.PlayOneShot(blockSFX, transform.position);
        blockingSFX_Instance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); // Stops blocking sound
        blockingSFX_Instance.release();
    }
Beispiel #7
0
 private void OnDestroy()
 {
     StopAllEvents();
     //--------------------------------------------------------------------
     // 6: This shows how to release resources when the unity object is
     //    disabled.
     //--------------------------------------------------------------------
     windChimeState.release();
 }
    public void OnRestartButton()
    {
        endMusic.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
        SetEndCanvas(false);
        PauseGame(false);

        Managers.Player.Respawn();
        endMusic.release();
        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }
Beispiel #9
0
 void on_return_button_click()
 {
     if (m_player_state.isValid())
     {
         m_player_state.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
         m_player_state.release();
         m_player_state.clearHandle();
     }
     m_scene_switcher.m_scene_name = "StartScene";
     StartCoroutine(m_scene_switcher.LoadYourAsyncScene());
 }
Beispiel #10
0
 private void EndScreen()
 {
     Highscores.SaveHighscores(score, "HighscoresZimZim");
     endScore.text = "score: " + score.ToString();
     endTitle.text = "Success!";
     endPanel.GetComponent <Image>().tintColor = new Color(0.16f, 0.65f, 0.89f);
     endPanel.SetActive(true);
     Time.timeScale = 0;
     maintheme.release();
     maintheme.clearHandle();
 }
Beispiel #11
0
    void waitState()
    {
        passosAranhaEv.release();
        passosAranhaEv.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
        anim.SetBool("New Bool", false);
        rb.velocity = new Vector2(0, 0);

        if (!vivo)
        {
            GetComponent <Collider2D> ().enabled = false;
            rb.gravityScale = 0;
        }
    }
Beispiel #12
0
    private void InitializeTitleScreenAmbience()
    {
        cityMusicInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
        cityMusicInstance.release();

        homeMusicInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);

        thunderAmbianceInstance.setTimelinePosition(0);
        FMOD.Studio.ParameterInstance param;
        thunderAmbianceInstance.getParameter("Location", out param);
        param.setValue(0);
        thunderAmbianceInstance.start();
    }
    public void PlaySwim()
    {
        FMOD.Studio.PLAYBACK_STATE playingState;
        swimmingInstance.getPlaybackState(out playingState);

        if (playingState == FMOD.Studio.PLAYBACK_STATE.STOPPED)
        {
            swimmingInstance.release();
            swimmingInstance = FMODUnity.RuntimeManager.CreateInstance(swimEvent);
            FMODUnity.RuntimeManager.AttachInstanceToGameObject(swimmingInstance, transform, rb);
            swimmingInstance.start();
        }
    }
 public void OnExit()
 {
     if (isPlayheadInside)
     {
         if (eventInstance.isValid())
         {
             if (stopType != STOP_MODE.None)
             {
                 eventInstance.stop(stopType == STOP_MODE.Immediate ? FMOD.Studio.STOP_MODE.IMMEDIATE : FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
             }
             eventInstance.release();
         }
         isPlayheadInside = false;
     }
 }
 private void OnDestroy()
 {
     musicInstance.setUserData(IntPtr.Zero);
     musicInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
     musicInstance.release();
     timelineHandle.Free();
 }
Beispiel #16
0
 /// <summary>
 ///  Stops the instance from playing any more sound, and releases the instance from the timelineHandle.
 /// </summary>
 public void StopAndClear(FMOD.Studio.EventInstance instance)
 {
     instance.setUserData(IntPtr.Zero);
     instance.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
     instance.release();
     timelineHandle.Free();
 }
Beispiel #17
0
    virtual public void Damage(Enemy enemy)
    {
        if (enemy.gameObject.activeInHierarchy)
        {
            if (attackKill)
            {
                // TODO: FreeParallax use the enemy object reference.
                // Needs review this implementation

                // Destroy(enemy.gameObject);
                //Plays sound

                enemySound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(enemy.gameObject));
                enemySound.start();
                enemySound.release();


                enemy.gameObject.SetActive(false);
                if (OnKillEnemy != null)
                {
                    OnKillEnemy(1);
                }
                rewardsAmount += 1;
            }
            else
            {
                Debug.LogError("Only one attack kill is not implemented yet. Please, mark attackKill inspector property");
            }
        }
    }
 void PlayRanged(string path)
 {
     //Debug.Log("play charged");
     FMOD.Studio.EventInstance PlayRanged = FMODUnity.RuntimeManager.CreateInstance(path);
     PlayRanged.start();
     PlayRanged.release();
 }
Beispiel #19
0
    // function called directly from animation events when
    // player animation steps(must be set up in each animation used)
    private void PlayStep()
    {
        if (SceneManagerFTTE.fmodEnable)
        {
            float velocity = GetComponent <Rigidbody>().velocity.magnitude;
            Footstep = FMODUnity.RuntimeManager.CreateInstance(FootstepEvent);
            Footstep.setParameterByName("Velocity", velocity);
            Footstep.setParameterByName("CharacterType", characterType);
            Footstep.setParameterByName("Material", material);

            Footstep.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject));

            Footstep.start();
            Footstep.release();
        }

        // pick & play a random footstep sound from the array,
        // excluding sound at index 0
        //int n = Random.Range(1, TPC.m_FootstepSounds.Length);
        //TPC.m_AudioSource.clip = TPC.m_FootstepSounds[n];
        //TPC.m_AudioSource.PlayOneShot(TPC.m_AudioSource.clip);
        //// move picked sound to index 0 so it's not picked next time
        //TPC.m_FootstepSounds[n] = TPC.m_FootstepSounds[0];
        //TPC.m_FootstepSounds[0] = TPC.m_AudioSource.clip;
    }
Beispiel #20
0
    // Use this for initialization
    private void Start()
    {
        m_fSoundRadius = GetComponent <FMODUnity.StudioEventEmitter>().OverrideMaxDistance;       //Use the FMOD events distance

        m_fmSoundEventInstance = FMODUnity.RuntimeManager.CreateInstance(m_sSoundToPlay);         //Create a sound instance that we can control
        m_fmSoundEventInstance.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(transform)); //Make the sound here
        m_fmSoundEventInstance.start();                                                           //Start the sound
        m_fmSoundEventInstance.release();

        Collider[] cTargetsInViewRadius = Physics.OverlapSphere(transform.position, m_fSoundRadius, m_GuardAlertMask);//Get all guards in radius

        foreach (Collider cCurrentTarget in cTargetsInViewRadius)
        {
            CS_GuardHearing cGuardRef = cCurrentTarget.GetComponent <CS_GuardHearing>();
            if (cGuardRef != null)
            {
                if (a_bRadio)
                {
                    cGuardRef.AlertHearRadio(transform);
                }
                else
                {
                    cGuardRef.AlertHearOtherSound(transform);
                }
            }
        }
    }
    void OnDestroy()

    {
        if (isShuttingDown)
        {
            return;
        }



        FMOD.Studio.UnityUtil.Log("Destroy called");

        if (evt != null && evt.isValid())

        {
            if (getPlaybackState() != FMOD.Studio.PLAYBACK_STATE.STOPPED)

            {
                FMOD.Studio.UnityUtil.Log("Release evt: " + path);

                ERRCHECK(evt.stop(FMOD.Studio.STOP_MODE.IMMEDIATE));
            }



            ERRCHECK(evt.release());

            evt = null;
        }
    }
Beispiel #22
0
    void BushSound(bool isMoving)
    {
        if (isMoving && !isHardPlaying)
        {
            hardNoise = FMODUnity.RuntimeManager.CreateInstance("event:/Outside/BushNoiseHard");
            hardNoise.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject));
            hardNoise.start();
            hardNoise.release();
            isHardPlaying = true;
        }
        else if (!isMoving)
        {
            hardNoise.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
            isHardPlaying = false;
        }

        if (MouseMovment() && !isSoftPlaying)
        {
            softNoise = FMODUnity.RuntimeManager.CreateInstance("event:/Outside/BushNoiseSoft");
            softNoise.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject));
            softNoise.start();
            softNoise.release();
            isSoftPlaying = true;
        }
        else if (!MouseMovment())
        {
            softNoise.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
            isSoftPlaying = false;
        }
    }
Beispiel #23
0
 void PlayDeath(string path)
 {
     FMOD.Studio.EventInstance Death = FMODUnity.RuntimeManager.CreateInstance(path);
     Death.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject));
     Death.start();
     Death.release();
 }
Beispiel #24
0
 private void OnEnterTitleScreen(EnterTitleScreenEvent e)
 {
     StopCoroutine(HoldUpPhotoAtStart());
     introVoiceOverInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
     introVoiceOverInstance.release();
     playerCanRaisePhoto = false;
 }
Beispiel #25
0
 void StopMoving()
 {
     walkingState.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
     walkingState.release();
     walkingSoundPlaying = false;
     animator.SetBool("isMoving", false);
 }
Beispiel #26
0
    void OnCollisionEnter(Collision col)
    {
        float impact = col.relativeVelocity.magnitude;

        if (impact > 10)
        {
            if (col.gameObject.transform.tag == "Player")
            {
                impact *= 0.75f;
                int damage = Mathf.RoundToInt(impact);

                Player player = col.gameObject.GetComponent <Player>();

                player.Damage(damage, col.transform.position);
            }
        }

        if (col.gameObject.name == "Ground")
        {
            groundImpactSFX.setParameterValue("force", impact);
            groundImpactSFX.start();
            FMODUnity.RuntimeManager.AttachInstanceToGameObject(groundImpactSFX, GetComponent <Transform>(), GetComponent <Rigidbody>());
            groundImpactSFX.release();
        }

        if (col.gameObject.name == "Wall" || col.gameObject.name == "Wall (1)" || col.gameObject.name == "Wall (2)" || col.gameObject.name == "Wall (3)")
        {
            wallImpactSFX.setParameterValue("force", impact);
            wallImpactSFX.start();
            FMODUnity.RuntimeManager.AttachInstanceToGameObject(wallImpactSFX, GetComponent <Transform>(), GetComponent <Rigidbody>());
            wallImpactSFX.release();
        }
    }
Beispiel #27
0
 void PlayFootsteps(string path)
 {
     FMOD.Studio.EventInstance Footsteps = FMODUnity.RuntimeManager.CreateInstance(path);
     Footsteps.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject));
     Footsteps.start();
     Footsteps.release();
 }
 private void OnDestroy()
 {
     if (SceneManagerFTTE.fmodEnable)
     {
         ArmourSound.release();
     }
 }
 /// <summary>
 /// Stops playback of the current song and starts playback of the song pointed to by 'songEvent'.
 /// </summary>
 public void PlaySong()
 {
     songEventInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
     songEventInstance.release();
     songEventInstance = FMODUnity.RuntimeManager.CreateInstance(songEvent);
     songEventInstance.start();
 }
    void PlaySound()
    {
        //Defaults
        m_Water = 0.0f;
        m_Dirt  = 0.0f;
        m_Sand  = 0.0f;
        m_Wood  = 0.0f;


        if (m_EventPath != null)
        {
            FMOD.Studio.EventInstance e = FMODUnity.RuntimeManager.CreateInstance(m_EventPath);
            e.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(transform.position));



            SetParameter(e, "Wood", m_Wood);
            SetParameter(e, "Dirt", m_Dirt);
            SetParameter(e, "Sand", m_Sand);
            SetParameter(e, "Water", m_Water);

            e.start();
            e.release();    //Release each event instance immediately, there are fire and forget, one-shot instances.
        }
    }
Beispiel #31
0
 public static void StopEvent(EventInstance evt)
 {
     if (evt != null && evt.isValid())
     {
         UnityUtil.ERRCHECK(evt.stop(STOP_MODE.ALLOWFADEOUT));
         UnityUtil.ERRCHECK(evt.release());
     }
 }