private static void ReBindLandStacker(Unit _Bomb) { LandStack _Stacker = Config._LandStacks.FirstOrDefault <LandStack>((Func <LandStack, bool>)(x => (int)x._Unit.Handle == (int)_Bomb.Handle)); if (_Stacker == null) { return; } LandBomb _NewUnit = Config._LandBombs.Where <LandBomb>((Func <LandBomb, bool>)(x => (Entity)x._Unit != (Entity)_Bomb)).MinOrDefault <LandBomb, float>((Func <LandBomb, float>)(x => x._Unit.Distance2D(_Stacker._Unit, false))); if (_NewUnit != null && (double)_NewUnit._Unit.Distance2D(_Stacker._Unit, false) < 100.0) { if (!Config._LandStacks.Where <LandStack>((Func <LandStack, bool>)(x => x.Id != _Stacker.Id)).Any <LandStack>((Func <LandStack, bool>)(x => (double)x._Unit.Distance2D(_NewUnit._Unit, false) <= 100.0))) { _Stacker._Unit = _NewUnit._Unit; } else { Config._LandStacks.Remove(_Stacker); } } else { Config._LandStacks.Remove(_Stacker); } }
public static void OnUpdate() { foreach (LandStack landStack in Core.Config._LandStacks.Where<LandStack>((Func<LandStack, bool>) (x => x.MoveForKill))) { LandStack _SB = landStack; Hero hero = EntityManager<Hero>.Entities.FirstOrDefault<Hero>((Func<Hero, bool>) (x => { if (x.Team != Core.Config._Hero.Team && TargetChecker.PreCheck(x)) return (double) x.Distance2D(_SB._Unit.Position) <= 450.0; return false; })); if ((Entity) hero != (Entity) null) { _SB.IsRunToKill = true; foreach (LandBomb landBomb in Core.Config._LandBombs.Where<LandBomb>((Func<LandBomb, bool>) (x => (double) x._Unit.Distance2D(_SB._Unit, false) <= 450.0))) landBomb._Unit.Move(hero.Position); } else if (_SB.IsRunToKill) { _SB.IsRunToKill = false; foreach (LandBomb landBomb in Core.Config._LandBombs.Where<LandBomb>((Func<LandBomb, bool>) (x => (double) x._Unit.Distance2D(_SB._Unit, false) <= 450.0))) landBomb._Unit.Stop(); } } }