Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class EntityHornet : ᝧ
- {
- // Fields
- private const float ᢏᙃ = 80f;
- private Vector3 ᢑᙃ;
- private bool ᢒᙃ;
- private int ᢓᙃ;
- private int ᢔᙃ;
- private List<Bounds> ᢕᙃ = new List<Bounds>();
- private int ᢾᙃ;
- // Methods
- protected override void Awake()
- {
- BoxCollider component = base.gameObject.GetComponent<BoxCollider>();
- if (component != null)
- {
- component.center = new Vector3(0f, 0.35f, 0f);
- component.size = new Vector3(0.4f, 0.4f, 0.4f);
- }
- base.Awake();
- Transform transform = base.transform.Find("Graphics/BlobShadowProjector");
- if (transform != null)
- {
- transform.gameObject.SetActive(false);
- }
- }
- protected override void falling(float _v, Vector3 _fallMotion)
- {
- if (this.IsDead())
- {
- base.falling(_v, _fallMotion);
- }
- }
- public override void Init(int _entityClass)
- {
- base.Init(_entityClass);
- base.emodel.SetVisible(true);
- }
- protected override bool isDetailedHeadBodyColliders()
- {
- return true;
- }
- protected override bool isRadiationSensitive()
- {
- return false;
- }
- protected override void updateTasks()
- {
- if (!GamePrefs.GetBool(EnumGamePrefs.DebugStopEnemiesMoving) && (GameStats.GetInt(EnumGameStats.GameState) != 2))
- {
- if (this.ᢔᙃ > 0)
- {
- this.ᢔᙃ--;
- }
- if (this.ᢔᙃ <= 0)
- {
- Vector3 vector = this.ᢑᙃ - base.ᤗᙂ;
- float sqrMagnitude = vector.sqrMagnitude;
- if ((sqrMagnitude < 1f) || (sqrMagnitude > 6400f))
- {
- if (!base.ᙅᙂ())
- {
- Vector3 vector2 = ᠦ.៘ᙂ(this, 2 * base.ᥰ(), 2 * base.ᥰ(), base.ᥫ().ᤗᙂ.ToVector3());
- if (!vector2.Equals(Vector3.zero))
- {
- this.ᢑᙃ = vector2;
- this.ᢒᙃ = true;
- }
- }
- else
- {
- this.ᢒᙃ = false;
- if (((base.ᙵᙂ() != null) && (base.ᙵᙂ().ᥛ(this) < 6400f)) && (Random.value <= 0.5f))
- {
- this.ᢑᙃ = base.ᙵᙂ().GetPosition() + Vector3.up;
- }
- else
- {
- 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));
- }
- }
- this.ᢑᙃ.y = Mathf.Min(this.ᢑᙃ.y, 196f);
- }
- if (this.ᢾᙃ-- <= 0)
- {
- this.ᢾᙃ += base.rand.Next(5) + 2;
- if (this.ᢎᙃ(this.ᢑᙃ, out sqrMagnitude))
- {
- base.ᝥᙃ += (Vector3) ((vector / sqrMagnitude) * 0.1f);
- }
- else
- {
- this.ᢑᙃ = base.GetPosition();
- }
- }
- }
- if ((base.ᙵᙂ() != null) && base.ᙵᙂ().IsDead())
- {
- base.ᙏᙂ(null);
- }
- if ((base.ᙵᙂ() == null) || (this.ᢓᙃ-- <= 0))
- {
- base.ᙏᙂ(base.ᝰᙃ.ᡗᙂ(this, 80f));
- if (base.ᙵᙂ() != null)
- {
- this.ᢓᙃ = 20;
- }
- }
- float num2 = 0f;
- if ((!this.ᢒᙃ && (base.ᙵᙂ() != null)) && ((num2 = base.ᙵᙂ().ᥛ(this)) < 6400f))
- {
- float y = base.ᙵᙂ().ᤗᙂ.x - this.ᤗᙂ.x;
- float x = base.ᙵᙂ().ᤗᙂ.z - this.ᤗᙂ.z;
- this.rotation.y = (Mathf.Atan2(y, x) * 180f) / 3.141593f;
- if ((((this.ᢔᙃ <= 0) && (num2 < 2.8f)) && ((this.ᤗᙂ.y >= base.ᙵᙂ().ᤗᙂ.y) && (this.ᤗᙂ.y <= base.ᙵᙂ().getHeadPosition().y))) && base.Attack(false))
- {
- this.ᢔᙃ = base.GetAttackTimeoutTicks();
- base.Attack(true);
- }
- }
- else
- {
- this.rotation.y = (((float) Math.Atan2((double) this.ᝥᙃ.x, (double) this.ᝥᙃ.z)) * 180f) / 3.141593f;
- }
- }
- }
- private bool ᢎᙃ(Vector3 ᙂ, out float ᡬᙂ)
- {
- float x = ᙂ.x - this.ᤗᙂ.x;
- float y = ᙂ.y - this.ᤗᙂ.y;
- float z = ᙂ.z - this.ᤗᙂ.z;
- ᡬᙂ = Mathf.Sqrt(((x * x) + (y * y)) + (z * z));
- if (ᡬᙂ >= 1.5f)
- {
- x /= ᡬᙂ;
- y /= ᡬᙂ;
- z /= ᡬᙂ;
- Bounds bounds = base.ᙃ;
- this.ᢕᙃ.Clear();
- for (int i = 1; i < (ᡬᙂ - 1f); i++)
- {
- bounds.center += new Vector3(x, y, z);
- base.ᝰᙃ.GetCollidingBounds(this, bounds, this.ᢕᙃ);
- if (this.ᢕᙃ.Count > 0)
- {
- return false;
- }
- }
- }
- return true;
- }
- }
- Collapse Methods
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement