Пример #1
0
 private void FindNaturalEnemy()
 {
     if (naturalEnemies == null)
     {
         return;
     }
     if (naturalEnemies.Length == 0)
     {
         return;
     }
     using (
         List <Entity> .Enumerator enumerator =
             this.world.GetEntitiesInBounds(typeof(EntityAlive),
                                            BoundsUtils.BoundsForMinMax(this.position.x - 50f, this.position.y - 50f,
                                                                        this.position.z - 50f, this.position.x + 50f,
                                                                        this.position.y + 50f,
                                                                        this.position.z + 50f), new List <Entity>()).GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             EntityAlive _other = enumerator.Current as EntityAlive;
             if (Array.Exists(naturalEnemies, s => s.Equals(_other.EntityName)))
             {
                 if (_other.IsAlive())
                 {
                     //if (base.CanSee(_other))
                     {
                         if (_other.GetWaterLevel() < 0.5f)
                         {
                             if (debug)
                             {
                                 Debug.Log("Found natural enemy!");
                             }
                             base.SetRevengeTarget(_other);
                             isHunting = true;
                             return;
                         }
                     }
                 }
             }
         }
     }
 }