Beispiel #1
0
 void FixedUpdate()
 {
     if (character.AttackContactWillLand())
     {
         character.AttackContact();
     }
     else
     {
         if (lastUpdateTime + updateRate + updateOffset < Time.time)
         {
             Transform closestTarget = character.GetClosestTargetTransformInVisionRange();
             if (closestTarget != null)
             {
                 target = closestTarget;
             }
             lastUpdateTime = Time.time;
         }
         if (target == null)
         {
             GetRandomTarget();
         }
         if (target != null)
         {
             character.MoveToPosition(target.position);
         }
     }
 }