Beispiel #1
0
 IEnumerator CheckRadius()
 {
     for (; dead == false;)
     {
         if (hasAttacked == false && attacking == false)
         {
             Collider2D[] c2d   = Physics2D.OverlapCircleAll(transform.position, seekRadius);
             bool         tempb = false;
             foreach (Collider2D cl2d in c2d)
             {
                 if (cl2d.gameObject.GetComponent <Player>() != null)
                 {
                     tempb = true;
                 }
             }
             if (tempb)
             {
                 backMusic = Camera.main.GetComponentInChildren <BackMusicScript>();
                 backMusic.AddToList(gameObject);
                 backMusic.PlayBattleMusic(battleMusic.enemyMusic);
                 destinationSetter.target = player.transform;
                 animator.Play("Move");
             }
             else
             {
                 backMusic = Camera.main.GetComponentInChildren <BackMusicScript>();
                 backMusic.RemoveFromList(gameObject);
                 backMusic.PlayCalmMusic();
                 destinationSetter.target = temp.transform;
                 animator.Play("Idle");
             }
         }
         yield return(new WaitForSeconds(1f));
     }
 }
Beispiel #2
0
 IEnumerator CheckRadius()
 {
     for (;;)
     {
         Collider2D[] c2d = Physics2D.OverlapCircleAll(transform.position, seekRadius);
         if (c2d[0].GetComponent <Player>() != null)
         {
             backMusic = Camera.main.GetComponentInChildren <BackMusicScript>();
             backMusic.AddToList(gameObject);
             backMusic.PlayBattleMusic(battleMusic.enemyMusic);
             destinationSetter.target = player.transform;
         }
         else
         {
             backMusic = Camera.main.GetComponentInChildren <BackMusicScript>();
             backMusic.RemoveFromList(gameObject);
             backMusic.PlayCalmMusic();
             destinationSetter.target = temp.transform;
         }
         yield return(new WaitForSeconds(1f));
     }
 }