﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SoundController : MonoBehaviour
{
    private static AudioSource _audioSource;


    //Overload method
    public static void PlaySound(AudioSource source,AudioClip givenClip)
    {
        _audioSource = source;
        _audioSource.clip = givenClip;
        _audioSource.Play();
    }


    //Play give sound
    public static void PlaySound (string name, AudioClip givenClip)
    {
        _audioSource = GameObject.Find(name).GetComponent<AudioSource>();
        _audioSource.clip = givenClip;
        _audioSource.Play();
    }
}
