public override void Play(string name)
    {
        DynamicSound s = GetDynamicSound(name);

        s.ConfigureAudioSource(audioSource);

        if (!audioSource.isPlaying)
        {
            audioSource.Play();
        }
        CheckIfEnemyIsInRange(s);
    }
Exemple #2
0
    public override void Play(string name)
    {
        DynamicSound s = GetDynamicSound(name);

        if (s == null)
        {
            return;
        }
        s.ConfigureAudioSource(audioSource);

        if (!audioSource.loop)
        {
            audioSource.Play();
        }
        else if (!audioSource.isPlaying)
        {
            audioSource.Play();
        }
        CheckIfEnemyIsInRange(s);
    }
Exemple #3
0
    public void Play2DClipAtPoint(string name, Vector2 position)
    {
        //  Create a temporary audio source object
        GameObject tempAudioSource = new GameObject("TempAudio");

        // Set Position
        tempAudioSource.transform.position = position;

        AudioSource audioSource = tempAudioSource.AddComponent <AudioSource>();

        DynamicSound s = GetDynamicSound(name);

        s.ConfigureAudioSource(audioSource);

        CheckIfEnemyIsInRange(s);

        if (!audioSource.loop || !audioSource.isPlaying)
        {
            audioSource.Play();
        }

        //  Set it to self destroy
        Destroy(tempAudioSource, s.clip.length);
    }
Exemple #4
0
    public void SetupAudioSource(string name)
    {
        DynamicSound s = GetDynamicSound(name);

        s.ConfigureAudioSource(audioSource);
    }