Example #1
0
 void Update()
 {
     //calmZone
     if (Vector3.Distance(enemy.transform.position, player.transform.position) > calmDistance && !inCalmZone)
     {
         Debug.Log("CalmZone..");
         inCalmZone   = true;
         inAlertZone  = false;
         inDangerZone = false;
         SoundManagerScript.PlayMusic(0, null, Ambientes, 0, 3);
         //SoundManagerScript.PlayMusic(gameObject, Ambientes[0]);
     }
     //alertZone
     if (Vector3.Distance(enemy.transform.position, player.transform.position) <= calmDistance &&
         Vector3.Distance(enemy.transform.position, player.transform.position) > alertDistance && !inAlertZone)
     {
         Debug.Log("alertZone..");
         inCalmZone   = false;
         inAlertZone  = true;
         inDangerZone = false;
         //SoundManagerScript.PlayMusic(gameObject, Ambientes[1]);
         //SoundManagerScript.PlayMusic(1,null,Ambientes,0,3);
     }
     //dangerZone
     if (Vector3.Distance(enemy.transform.position, player.transform.position) <= alertDistance && !inDangerZone)
     {
         Debug.Log("dangerZone..");
         inCalmZone   = false;
         inAlertZone  = false;
         inDangerZone = true;
         //SoundManagerScript.PlayMusic(2,null,Ambientes,0,3);
         //SoundManagerScript.PlayMusic(gameObject, Ambientes[2]);
     }
 }
    public override void DoAction()
    {
        SoundManagerScript sms = GameObject.Find("Settings").GetComponent <SoundManagerScript>();

        sms.PlayMusic(Clip);
    }