Exemplo n.º 1
0
 void iniSeting()
 {
     if (seting == null)
     {
         seting = GameObject.FindGameObjectWithTag("setings_game").GetComponent <setings>();
     }
 }
Exemplo n.º 2
0
    void iniSound()
    {
        if (seting == null)
        {
            seting = GameObject.FindGameObjectWithTag("setings_game").GetComponent <setings>();
        }
        if (seting != null && audioSource1 == null && audioSource2 == null && audioClip != null && audioClip.Length > 0)
        {
            audioSource1 = gameObject.AddComponent <AudioSource>();
            audioSource2 = gameObject.AddComponent <AudioSource>();

            Player player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();
            dist = Vector3.Distance(player.gameObject.transform.position, gameObject.transform.position);

            float distCoof = dist / 500;
            if (distCoof > 1)
            {
                distCoof = 1;
            }
            audioSource1.priority = (int)(distCoof * 127);
            audioSource2.priority = (int)(distCoof * 127);

            audioSource1.volume = seting.game.volume_all * seting.game.volume_sound;
            audioSource2.volume = seting.game.volume_all * seting.game.volume_sound;

            audioSource1.spatialBlend = 0.8f;
            audioSource2.spatialBlend = 0.8f;

            audioSource1.minDistance = 2;
            audioSource2.minDistance = 2;

            audioSource1.maxDistance = 1000;
            audioSource2.maxDistance = 1000;
        }
    }
Exemplo n.º 3
0
 void iniSetings()
 {
     if (seting == null || gameParam == null)
     {
         seting    = GameObject.FindGameObjectWithTag("setings_game").GetComponent <setings>();
         gameParam = GameObject.FindGameObjectWithTag("setings_game").GetComponent <GameplayParametrs>();
     }
 }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        audioSource = gameObject.GetComponent <AudioSource>();

        //ищем обьект по тегу
        GameObject main_canvas = GameObject.FindWithTag("setings_game");

        //вытаскиваем настройки
        if (main_canvas != null)
        {
            seting = main_canvas.GetComponent <setings>();
        }
    }
Exemplo n.º 5
0
 //Привязать настройки игры
 void get_seting_game()
 {
     //Если настроек нет
     if (seting == null)
     {
         //ищем обьект по тегу
         GameObject main_canvas = GameObject.FindWithTag("setings_game");
         //вытаскиваем настройки
         if (main_canvas != null)
         {
             seting = main_canvas.GetComponent <setings>();
         }
     }
 }
Exemplo n.º 6
0
 void set_seting()
 {
     //Если настроек нет
     if (seting == null)
     {
         //ищем обьект по тегу
         GameObject obj = GameObject.FindWithTag("setings_game");
         //вытаскиваем настройки
         if (obj != null)
         {
             seting = obj.GetComponent <setings>();
         }
     }
 }