Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.58 KB | None | 0 0
  1. public class EntityHornet :
  2. {
  3.     // Fields
  4.     private const float ᢏᙃ = 80f;
  5.     private Vector3 ᢑᙃ;
  6.     private bool ᢒᙃ;
  7.     private int ᢓᙃ;
  8.     private int ᢔᙃ;
  9.     private List<Bounds> ᢕᙃ = new List<Bounds>();
  10.     private int ᢾᙃ;
  11.  
  12.     // Methods
  13.     protected override void Awake()
  14.     {
  15.         BoxCollider component = base.gameObject.GetComponent<BoxCollider>();
  16.         if (component != null)
  17.         {
  18.             component.center = new Vector3(0f, 0.35f, 0f);
  19.             component.size = new Vector3(0.4f, 0.4f, 0.4f);
  20.         }
  21.         base.Awake();
  22.         Transform transform = base.transform.Find("Graphics/BlobShadowProjector");
  23.         if (transform != null)
  24.         {
  25.             transform.gameObject.SetActive(false);
  26.         }
  27.     }
  28.  
  29.     protected override void falling(float _v, Vector3 _fallMotion)
  30.     {
  31.         if (this.IsDead())
  32.         {
  33.             base.falling(_v, _fallMotion);
  34.         }
  35.     }
  36.  
  37.     public override void Init(int _entityClass)
  38.     {
  39.         base.Init(_entityClass);
  40.         base.emodel.SetVisible(true);
  41.     }
  42.  
  43.     protected override bool isDetailedHeadBodyColliders()
  44.     {
  45.         return true;
  46.     }
  47.  
  48.     protected override bool isRadiationSensitive()
  49.     {
  50.         return false;
  51.     }
  52.  
  53.     protected override void updateTasks()
  54.     {
  55.         if (!GamePrefs.GetBool(EnumGamePrefs.DebugStopEnemiesMoving) && (GameStats.GetInt(EnumGameStats.GameState) != 2))
  56.         {
  57.             if (this.ᢔᙃ > 0)
  58.             {
  59.                 this.ᢔᙃ--;
  60.             }
  61.             if (this.ᢔᙃ <= 0)
  62.             {
  63.                 Vector3 vector = this.ᢑᙃ - base.ᤗᙂ;
  64.                 float sqrMagnitude = vector.sqrMagnitude;
  65.                 if ((sqrMagnitude < 1f) || (sqrMagnitude > 6400f))
  66.                 {
  67.                     if (!base.ᙅᙂ())
  68.                     {
  69.                         Vector3 vector2 =.៘ᙂ(this, 2 * base.(), 2 * base.(), base.().ᤗᙂ.ToVector3());
  70.                         if (!vector2.Equals(Vector3.zero))
  71.                         {
  72.                             this.ᢑᙃ = vector2;
  73.                             this.ᢒᙃ = true;
  74.                         }
  75.                     }
  76.                     else
  77.                     {
  78.                         this.ᢒᙃ = false;
  79.                         if (((base.ᙵᙂ() != null) && (base.ᙵᙂ().(this) < 6400f)) && (Random.value <= 0.5f))
  80.                         {
  81.                             this.ᢑᙃ = base.ᙵᙂ().GetPosition() + Vector3.up;
  82.                         }
  83.                         else
  84.                         {
  85.                             this.ᢑᙃ = base.GetPosition() + new Vector3((float) (((base.rand.NextDouble() * 2.0) - 1.0) * 16.0), (float) (((base.rand.NextDouble() * 2.0) - 1.0) * 16.0), (float) (((base.rand.NextDouble() * 2.0) - 1.0) * 16.0));
  86.                         }
  87.                     }
  88.                     this.ᢑᙃ.y = Mathf.Min(this.ᢑᙃ.y, 196f);
  89.                 }
  90.                 if (this.ᢾᙃ-- <= 0)
  91.                 {
  92.                     this.ᢾᙃ += base.rand.Next(5) + 2;
  93.                     if (this.ᢎᙃ(this.ᢑᙃ, out sqrMagnitude))
  94.                     {
  95.                         base.ᝥᙃ += (Vector3) ((vector / sqrMagnitude) * 0.1f);
  96.                     }
  97.                     else
  98.                     {
  99.                         this.ᢑᙃ = base.GetPosition();
  100.                     }
  101.                 }
  102.             }
  103.             if ((base.ᙵᙂ() != null) && base.ᙵᙂ().IsDead())
  104.             {
  105.                 base.ᙏᙂ(null);
  106.             }
  107.             if ((base.ᙵᙂ() == null) || (this.ᢓᙃ-- <= 0))
  108.             {
  109.                 base.ᙏᙂ(base.ᝰᙃ.ᡗᙂ(this, 80f));
  110.                 if (base.ᙵᙂ() != null)
  111.                 {
  112.                     this.ᢓᙃ = 20;
  113.                 }
  114.             }
  115.             float num2 = 0f;
  116.             if ((!this.ᢒᙃ && (base.ᙵᙂ() != null)) && ((num2 = base.ᙵᙂ().(this)) < 6400f))
  117.             {
  118.                 float y = base.ᙵᙂ().ᤗᙂ.x - this.ᤗᙂ.x;
  119.                 float x = base.ᙵᙂ().ᤗᙂ.z - this.ᤗᙂ.z;
  120.                 this.rotation.y = (Mathf.Atan2(y, x) * 180f) / 3.141593f;
  121.                 if ((((this.ᢔᙃ <= 0) && (num2 < 2.8f)) && ((this.ᤗᙂ.y >= base.ᙵᙂ().ᤗᙂ.y) && (this.ᤗᙂ.y <= base.ᙵᙂ().getHeadPosition().y))) && base.Attack(false))
  122.                 {
  123.                     this.ᢔᙃ = base.GetAttackTimeoutTicks();
  124.                     base.Attack(true);
  125.                 }
  126.             }
  127.             else
  128.             {
  129.                 this.rotation.y = (((float) Math.Atan2((double) this.ᝥᙃ.x, (double) this.ᝥᙃ.z)) * 180f) / 3.141593f;
  130.             }
  131.         }
  132.     }
  133.  
  134.     private bool ᢎᙃ(Vector3 ᙂ, out float ᡬᙂ)
  135.     {
  136.         float x =.x - this.ᤗᙂ.x;
  137.         float y =.y - this.ᤗᙂ.y;
  138.         float z =.z - this.ᤗᙂ.z;
  139.         ᡬᙂ = Mathf.Sqrt(((x * x) + (y * y)) + (z * z));
  140.         if (ᡬᙂ >= 1.5f)
  141.         {
  142.             x /= ᡬᙂ;
  143.             y /= ᡬᙂ;
  144.             z /= ᡬᙂ;
  145.             Bounds bounds = base.᝾ᙃ;
  146.             this.ᢕᙃ.Clear();
  147.             for (int i = 1; i < (ᡬᙂ - 1f); i++)
  148.             {
  149.                 bounds.center += new Vector3(x, y, z);
  150.                 base.ᝰᙃ.GetCollidingBounds(this, bounds, this.ᢕᙃ);
  151.                 if (this.ᢕᙃ.Count > 0)
  152.                 {
  153.                     return false;
  154.                 }
  155.             }
  156.         }
  157.         return true;
  158.     }
  159. }
  160.  
  161.  
  162. Collapse Methods
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement