예제 #1
0
 // Update is called once per frame
 void Update()
 {
     if (targetSelected == false && beingAttacked == false)
     {
         if (monsterBehavior.IsVisible())
         {
             target         = monsterBehavior.GetObjVisible().transform;
             targetSelected = true;
         }
         else
         {
             monsterBehavior.Idle();
         }
     }
     else if (beingAttacked && targetSelected == false)
     {
         if (monsterBehavior.IsVisible())
         {
             target         = monsterBehavior.GetObjVisible().transform;
             targetSelected = true;
         }
         monsterBehavior.Find();
     }
     else
     {
         if (target != null)
         {
             monsterBehavior.Attack();
             if (!selectLayer)
             {
                 gameObject.layer = 9;
                 selectLayer      = true;
             }
         }
         else
         {
             targetSelected = false;
             beingAttacked  = false;
         }
     }
 }