Ejemplo n.º 1
0
        private void OnUnitAdded(Unit9 unit)
        {
            try
            {
                if (!unit.IsLaneCreep || unit.Team == this.ownerTeam)
                {
                    return;
                }

                if (unit.BaseUnit.IsSpawned || !unit.BaseUnit.IsAlive || unit.IsVisible)
                {
                    return;
                }

                var lane = this.lanePaths.GetCreepLane(unit);
                if (lane == LanePosition.Unknown)
                {
                    return;
                }

                var wave = this.creepWaves.SingleOrDefault(x => !x.IsSpawned && x.Lane == lane);
                if (wave == null)
                {
                    this.creepWaves.Add(wave = new CreepWave(lane, this.lanePaths.GetLanePath(lane)));
                }

                wave.Creeps.Add(unit);
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Ejemplo n.º 2
0
 // Token: 0x0600020D RID: 525 RVA: 0x0001011C File Offset: 0x0000E31C
 private void OnUnitAdded(Unit9 unit)
 {
     try
     {
         if (unit.IsLaneCreep && unit.Team != this.ownerTeam)
         {
             if (!unit.BaseUnit.IsSpawned && unit.BaseUnit.IsAlive)
             {
                 LanePosition lane = this.lanePaths.GetCreepLane(unit);
                 if (lane != LanePosition.Unknown)
                 {
                     CreepWave creepWave = this.creepWaves.SingleOrDefault((CreepWave x) => !x.IsSpawned && x.Lane == lane);
                     if (creepWave == null)
                     {
                         this.creepWaves.Add(creepWave = new CreepWave(lane, this.lanePaths.GetLanePath(lane)));
                     }
                     creepWave.Creeps.Add(unit);
                 }
             }
         }
     }
     catch (Exception exception)
     {
         Logger.Error(exception, null);
     }
 }
Ejemplo n.º 3
0
 // Token: 0x0600020F RID: 527 RVA: 0x00010288 File Offset: 0x0000E488
 private void OnUpdate()
 {
     try
     {
         bool flag = !this.mergeSleeper.IsSleeping;
         for (int i = this.creepWaves.Count - 1; i > -1; i--)
         {
             CreepWave wave = this.creepWaves[i];
             if (wave.IsSpawned)
             {
                 if (!wave.IsValid)
                 {
                     this.creepWaves.RemoveAt(i);
                 }
                 else
                 {
                     if (flag)
                     {
                         CreepWave creepWave = this.creepWaves.Find((CreepWave x) => x.IsSpawned && x.Lane == wave.Lane && !x.Equals(wave) && x.PredictedPosition.Distance2D(wave.PredictedPosition, false) < 500f);
                         if (creepWave != null)
                         {
                             creepWave.Creeps.AddRange(wave.Creeps);
                             this.creepWaves.RemoveAt(i);
                             goto IL_AF;
                         }
                     }
                     wave.Update();
                 }
             }
             IL_AF :;
         }
         if (flag)
         {
             this.mergeSleeper.Sleep(2f);
         }
     }
     catch (Exception exception)
     {
         Logger.Error(exception, null);
     }
 }
Ejemplo n.º 4
0
 // Token: 0x0600020E RID: 526 RVA: 0x000101EC File Offset: 0x0000E3EC
 private void OnUnitRemoved(Unit9 unit)
 {
     try
     {
         if (unit.IsLaneCreep && unit.Team != this.ownerTeam)
         {
             CreepWave creepWave = this.creepWaves.Find((CreepWave x) => x.Creeps.Contains(unit));
             if (creepWave != null)
             {
                 creepWave.Creeps.Remove(unit);
                 if (!creepWave.IsValid)
                 {
                     this.creepWaves.Remove(creepWave);
                 }
             }
         }
     }
     catch (Exception exception)
     {
         Logger.Error(exception, null);
     }
 }