// Token: 0x060003BA RID: 954 RVA: 0x0001D300 File Offset: 0x0001B500 private void OnInt32PropertyChange(Entity sender, Int32PropertyChangeEventArgs args) { int newValue = args.NewValue; if (newValue == args.OldValue) { return; } try { Unit9 unitFast = EntityManager9.GetUnitFast(sender.Handle); if (!(unitFast == null)) { string propertyName = args.PropertyName; if (!(propertyName == "m_iHealth")) { if (propertyName == "m_NetworkActivity") { if (unitFast.IsValid) { if (this.attackActivities.Contains(newValue)) { this.AttackStarted(unitFast); } else { this.AttackStopped(unitFast); } } } } else if (newValue > 0) { UnitMonitor.HealthEventHandler unitHealthChange = this.UnitHealthChange; if (unitHealthChange != null) { unitHealthChange(unitFast, (float)newValue); } } else { unitFast.DeathTime = Game.RawGameTime; this.AttackStopped(unitFast); this.attackSleeper.Remove(unitFast.Handle); UnitMonitor.EventHandler unitDied = this.UnitDied; if (unitDied != null) { unitDied(unitFast); } } } } catch (Exception exception) { Logger.Error(exception, sender, null); } }
// Token: 0x060003B5 RID: 949 RVA: 0x0001CFC0 File Offset: 0x0001B1C0 private void AttackStopped(Unit9 unit) { if (!this.attackSleeper.IsSleeping(unit.Handle)) { return; } if (!unit.IsControllable && !unit.IsTower && unit.IsHero) { unit.Target = null; } unit.IsAttacking = false; this.attackSleeper.Reset(unit.Handle); UnitMonitor.EventHandler attackEnd = this.AttackEnd; if (attackEnd == null) { return; } attackEnd(unit); }
// Token: 0x060003B4 RID: 948 RVA: 0x0001CEDC File Offset: 0x0001B0DC private void AttackStarted(Unit9 unit) { if (this.attackSleeper.IsSleeping(unit.Handle) || !unit.IsAlive) { return; } if (!unit.IsControllable && unit.IsHero) { unit.Target = (from x in EntityManager9.Units where x.IsAlive && !x.IsAlly(unit) && x.Distance(unit) <= unit.GetAttackRange(x, 25f) orderby unit.GetAngle(x.Position, false) select x).FirstOrDefault((Unit9 x) => unit.GetAngle(x.Position, false) < 0.35f); } unit.IsAttacking = true; this.attackSleeper.Sleep(unit.Handle, unit.GetAttackPoint(null)); UnitMonitor.EventHandler attackStart = this.AttackStart; if (attackStart == null) { return; } attackStart(unit); }